.net可移植类库包含Microsoft.VisualBasic作为依赖项

前端之家收集整理的这篇文章主要介绍了.net可移植类库包含Microsoft.VisualBasic作为依赖项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了一个可移植的类库,应该在xamarin项目中使用,我删除了Project中显式的Microsoft.VisualBasic引用.
在xamarin项目中使用库会导致以下编译时错误

Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly ‘Microsoft.VisualBasic,Version=10.0.0.0,
Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a’. Perhaps it doesn’t
exist in the Mono for Android profile?Dateiname:
“Microsoft.VisualBasic.dll” bei
Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference
reference,ReaderParameters parameters) bei
Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1
assemblies,AssemblyDefinition assembly,Boolean topLevel) bei
Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection
1
assemblies,Boolean topLevel) bei
Xamarin.Android.Tasks.ResolveAssemblies.Execute()

当我使用依赖性walker(ildasm.exe)检查.dll文件时,我注意到,Microsoft.VisualBasic被列为依赖项:

.assembly extern Microsoft.VisualBasic
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 10:0:0:0
}

谁能告诉我为什么Microsoft.VisualBasic仍然是类库的依赖项以及如何解决这个问题?

谢谢Ced

解决方法

好奇,因为我之前没有尝试过这个.找到一些可能有用的细节,经过一些挖掘后,有一个编译器选项可以使用-novbruntimeref(旧代码项目 Article).搜索该文本会给出一些引导,表明您可以手动编辑项目文件并向属性添加行也可以执行相同的操作.

<NoVBRuntimeReference>On</NoVBRuntimeReference>

虽然有些页面的值为“true”而不是“on”.但还没有测试过.

猜你在找的Windows相关文章