Add CSC_SDK_PATH_DISABLED workaround
authorMarek Safar <marek.safar@gmail.com>
Thu, 17 Mar 2016 09:21:54 +0000 (10:21 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 3 May 2016 09:42:42 +0000 (11:42 +0200)
mcs/class/referencesource/mscorlib/system/runtime/interopservices/runtimeenvironment.cs

index e1a5ec44f728dd54b9761e09248f3b3a2951276f..fdfbf0273603fc74852ed2bf1c39053f5f8b1322 100644 (file)
@@ -97,6 +97,18 @@ namespace System.Runtime.InteropServices {
         [ResourceConsumption(ResourceScope.Machine)]
         public static String GetRuntimeDirectory()
         {
+#if !MOBILE
+            //
+            // Workaround for csc hardcoded behaviour where executing mscorlib
+            // location is always the first path to search for references unless
+            // they have full path. Mono build is using simple assembly names for
+            // references and -lib for path which is by default csc dehaviour never
+            // used
+            //
+            var sdk = Environment.GetEnvironmentVariable ("CSC_SDK_PATH_DISABLED");
+            if (sdk != null)
+                return null;
+#endif
             String dir = GetRuntimeDirectoryImpl();
             new FileIOPermission(FileIOPermissionAccess.PathDiscovery, dir).Demand();
             return dir;