@@ -87,9 +87,7 @@ public static string ReferenceAssembyPath
87
87
{
88
88
var programFilesPath = PclExport . Instance . GetEnvironmentVariable ( "ProgramFiles(x86)" ) ?? @"C:\Program Files (x86)" ;
89
89
var netFxReferenceBasePath = programFilesPath + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\" ;
90
- if ( ( netFxReferenceBasePath + @"v4.6\" ) . DirectoryExists ( ) )
91
- referenceAssembyPath = netFxReferenceBasePath + @"v4.6\" ;
92
- else if ( ( netFxReferenceBasePath + @"v4.5.2\" ) . DirectoryExists ( ) )
90
+ if ( ( netFxReferenceBasePath + @"v4.5.2\" ) . DirectoryExists ( ) )
93
91
referenceAssembyPath = netFxReferenceBasePath + @"v4.5.2\" ;
94
92
else if ( ( netFxReferenceBasePath + @"v4.5.1\" ) . DirectoryExists ( ) )
95
93
referenceAssembyPath = netFxReferenceBasePath + @"v4.5.1\" ;
@@ -98,9 +96,24 @@ public static string ReferenceAssembyPath
98
96
else if ( ( netFxReferenceBasePath + @"v4.0\" ) . DirectoryExists ( ) )
99
97
referenceAssembyPath = netFxReferenceBasePath + @"v4.0\" ;
100
98
else
99
+ {
100
+ var dir = new DirectoryInfo ( netFxReferenceBasePath ) ;
101
+ if ( dir . Exists )
102
+ {
103
+ var fxDirs = dir . GetDirectories ( ) ;
104
+ foreach ( var fxDir in fxDirs )
105
+ {
106
+ if ( fxDir . Name . StartsWith ( "v4" ) )
107
+ {
108
+ return referenceAssembyPath = netFxReferenceBasePath + fxDir . Name + @"\" ;
109
+ }
110
+ }
111
+ }
112
+
101
113
throw new FileNotFoundException (
102
114
"Could not infer .NET Reference Assemblies path, e.g '{0}'.\n " . Fmt ( netFxReferenceBasePath + @"v4.0\" ) +
103
115
"Provide path manually 'Env.ReferenceAssembyPath'." ) ;
116
+ }
104
117
}
105
118
#endif
106
119
return referenceAssembyPath ;
0 commit comments