[xbuild] Pick the correct base path for target frameworks.
authorAnkit Jain <jankit@suse.de>
Thu, 3 Nov 2011 15:32:09 +0000 (21:02 +0530)
committerAnkit Jain <jankit@suse.de>
Thu, 3 Nov 2011 16:49:11 +0000 (22:19 +0530)
Don't depend on Environment.GacPath to figure out the framework
base path ("..../xbuild-frameworks"). This broke on fedora, where
it mapped to $prefix/lib/mono instead of $prefix/lib64/mono .
Which caused framework assemblies to be picked from "lib" instead
of "lib64".

mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs

index 796296e35bde960d6ef7b80dddd62211ace444d0..138594a60dec13c7fbb3db3fa6be7d89a51aa3f2 100644 (file)
@@ -227,18 +227,9 @@ namespace Microsoft.Build.Tasks
 
                static string DefaultFrameworksBasePath {
                        get {
-                               if (framework_base_path == null) {
-                                       // NOTE: code from mcs/tools/gacutil/driver.cs
-                                       PropertyInfo gac = typeof (System.Environment).GetProperty (
-                                                       "GacPath", BindingFlags.Static | BindingFlags.NonPublic);
-
-                                       if (gac != null) {
-                                               MethodInfo get_gac = gac.GetGetMethod (true);
-                                               string gac_path = (string) get_gac.Invoke (null, null);
-                                               framework_base_path = Path.GetFullPath (Path.Combine (
-                                                                       gac_path, Path.Combine ("..", "xbuild-frameworks")));
-                                       }
-                               }
+                               if (framework_base_path == null)
+                                       framework_base_path = Path.Combine (Path.GetDirectoryName (typeof (object).Assembly.Location),
+                                                               Path.Combine ("..", "xbuild-frameworks"));
                                return framework_base_path;
                        }
                }