11namespace Microsoft . AspNetCore . Mvc . Basic
22{
33 using Microsoft . AspNetCore . Mvc . ApplicationParts ;
4- using Microsoft . AspNetCore . Mvc . Razor ;
54 using Microsoft . AspNetCore . Mvc . Versioning ;
6- using Microsoft . Extensions . DependencyInjection ;
7- using System . Linq ;
8- using System . Reflection ;
9- using static Microsoft . CodeAnalysis . MetadataReference ;
10- using static System . Reflection . Assembly ;
115
126 public class UIFixture : HttpServerFixture
137 {
@@ -18,27 +12,5 @@ protected override void OnConfigurePartManager( ApplicationPartManager partManag
1812 partManager . FeatureProviders . Add ( ( IApplicationFeatureProvider ) FilteredControllerTypes ) ;
1913 partManager . ApplicationParts . Add ( new AssemblyPart ( GetType ( ) . Assembly ) ) ;
2014 }
21-
22- protected override void OnConfigureServices ( IServiceCollection services )
23- {
24- services . Configure < RazorViewEngineOptions > ( options =>
25- {
26- options . CompilationCallback += context =>
27- {
28- var assembly = GetType ( ) . GetTypeInfo ( ) . Assembly ;
29- var assemblies = assembly . GetReferencedAssemblies ( ) . Select ( x => CreateFromFile ( Load ( x ) . Location ) ) . ToList ( ) ;
30-
31- assemblies . Add ( CreateFromFile ( Load ( new AssemblyName ( "mscorlib" ) ) . Location ) ) ;
32- #if NET461
33- assemblies . Add ( CreateFromFile ( Load ( new AssemblyName ( "netstandard" ) ) . Location ) ) ;
34- #else
35- assemblies . Add ( CreateFromFile ( Load ( new AssemblyName ( "System.Private.Corelib" ) ) . Location ) ) ;
36- #endif
37- assemblies . Add ( CreateFromFile ( Load ( new AssemblyName ( "System.Dynamic.Runtime" ) ) . Location ) ) ;
38- assemblies . Add ( CreateFromFile ( Load ( new AssemblyName ( "Microsoft.AspNetCore.Razor" ) ) . Location ) ) ;
39- context . Compilation = context . Compilation . AddReferences ( assemblies ) ;
40- } ;
41- } ) ;
42- }
4315 }
4416}
0 commit comments