Blazor 包含不带公共类的动态引用程序集
我有一个客户端Blazor项目,它引用了nuget包Microsoft.CodeAnalysis.CSharp.Features。我正试图通过MEF加载它:Blazor 包含不带公共类的动态引用程序集,blazor,.net-standard-2.0,Blazor,.net Standard 2.0,我有一个客户端Blazor项目,它引用了nuget包Microsoft.CodeAnalysis.CSharp.Features。我正试图通过MEF加载它: var lAssemblies = new[] { Assembly.Load("Microsoft.CodeAnalysis"), Assembly.Load("Microsoft.CodeAnalysis.CSharp"), Assembly.Load("Microsoft.CodeAnalysis.Featur
var lAssemblies = new[]
{
Assembly.Load("Microsoft.CodeAnalysis"),
Assembly.Load("Microsoft.CodeAnalysis.CSharp"),
Assembly.Load("Microsoft.CodeAnalysis.Features"),
Assembly.Load("Microsoft.CodeAnalysis.CSharp.Features"),
}.Concat(MefHostServices.DefaultAssemblies).Distinct().ToArray();
var lHost = MefHostServices.Create(lAssemblies);
在运行时,我显式加载的前三个程序集可以很好地找到,但我无法加载Microsoft.codealysis.CSharp.Features
WASM: [System.IO.FileNotFoundException] Could not load the file 'Microsoft.CodeAnalysis.CSharp.Features'.
WASM: at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly) <0x4ac92d8 + 0x00070> in <b1ad3c5cea744bd399337592aed7f58e>:0
WASM: at System.AppDomain.Load (System.String assemblyString) <0x4ac9290 + 0x00014> in <b1ad3c5cea744bd399337592aed7f58e>:0
WASM: at System.Reflection.Assembly.Load (System.String assemblyString) <0x4ac91c8 + 0x00010> in <b1ad3c5cea744bd399337592aed7f58e>:0
WASM:[System.IO.FileNotFoundException]无法加载文件“Microsoft.codealysis.CSharp.Features”。
WASM:位于:0中的System.AppDomain.Load(System.String assemblyString、System.Security.Policy.Evidence assemblySecurity、System.Boolean ReOnly)
WASM:位于中的System.AppDomain.Load(System.String assemblyString):0
WASM:位于中的System.Reflection.Assembly.Load(System.String assemblyString):0
通常我会通过添加typeof(Some.Type.In.The.Assembly)
来解决这个问题,但是这个程序集没有任何公共类型。如何强制编译输出包含此程序集
注意:我也尝试过直接通过浏览器访问它,只是想看看它是否在那里(/\u framework/\u bin/Microsoft.codealysis.CSharp.Features.dll
)。这将导致404错误