加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

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

发布时间:2020-12-14 05:38:51 所属栏目:Windows 来源:网络整理
导读:我创建了一个可移植的类库,应该在xamarin项目中使用,我删除了Project中显式的Microsoft.VisualBasic引用. 在xamarin项目中使用库会导致以下编译时错误: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly ‘M
我创建了一个可移植的类库,应该在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”.但还没有测试过.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读