@@ -36,8 +36,7 @@ public CodeGenTests(ITestOutputHelper logger)
36
36
var workspace = new AdhocWorkspace ( ) ;
37
37
var project = workspace . CurrentSolution . AddProject ( "test" , "test" , "C#" )
38
38
. WithCompilationOptions ( new CSharpCompilationOptions ( OutputKind . DynamicallyLinkedLibrary ) )
39
- . AddMetadataReferences ( GetReferences ( "Profile78" ) )
40
- . AddMetadataReference ( MetadataReference . CreateFromFile ( Assembly . Load ( "netstandard, Version=2.0.0.0" ) . Location ) )
39
+ . AddMetadataReferences ( GetNetStandard20References ( ) )
41
40
. AddMetadataReference ( MetadataReference . CreateFromFile ( typeof ( GenerateImmutableAttribute ) . Assembly . Location ) )
42
41
. AddMetadataReference ( MetadataReference . CreateFromFile ( typeof ( CodeGenerationAttributeAttribute ) . Assembly . Location ) )
43
42
. AddMetadataReference ( MetadataReference . CreateFromFile ( typeof ( Optional ) . Assembly . Location ) )
@@ -337,10 +336,11 @@ private static string EscapeLineEndingCharacters(string whitespace)
337
336
return builder . ToString ( ) ;
338
337
}
339
338
340
- private static IEnumerable < MetadataReference > GetReferences ( string profile )
339
+ private static IEnumerable < MetadataReference > GetNetStandard20References ( )
341
340
{
342
- string profileDirectory = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . ProgramFilesX86 ) , @"Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile" , profile ) ;
343
- foreach ( string assembly in Directory . GetFiles ( profileDirectory , "*.dll" ) )
341
+ string nugetPackageRoot = Environment . GetEnvironmentVariable ( "NUGET_PACKAGES" ) ?? Environment . ExpandEnvironmentVariables ( @"%USERPROFILE%\.nuget\packages" ) ;
342
+ string netstandardRoot = Path . Combine ( nugetPackageRoot , @"netstandard.library\2.0.3\build\netstandard2.0\ref" ) ;
343
+ foreach ( string assembly in Directory . GetFiles ( netstandardRoot , "*.dll" ) )
344
344
{
345
345
yield return MetadataReference . CreateFromFile ( assembly ) ;
346
346
}
0 commit comments