1

虽然这不是我的选择,但我不得不使用一些用 VB.Net 编写的库。其中一个库有一些我希望在我正在处理的 Xamarin.Android 项目中重用的 DTO。我已经很好地包含了引用,但是当我尝试构建时,我收到以下错误:

Error   1   Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Microsoft.VisualBasic.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly)
   at Xamarin.Android.Tasks.ResolveAssemblies.Execute() TnT

有没有人熟悉这个问题,是否有修复(最好不涉及包含该 DLL)?

4

2 回答 2

2

我有同样的问题,可以通过在添加以下行后重建 VB 项目来解决它:

<VBRuntime>Embed</VBRuntime>

到文件NameOfProject .VBPROJ的 PropertyGroup 部分(最终使用记事本完成)。它最终看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
[...]
  <PropertyGroup>
    [...]
    <VBRuntime>Embed</VBRuntime>
  </PropertyGroup>
[...]

一些提示来自这里:

http://blogs.msdn.com/b/lucian/archive/2010/01/29/core6-vb-core-make-the-vb-runtime-optional-without-break-ctype-c.aspx

于 2013-11-15T15:59:16.357 回答
1

您还可以通过 NuGet 安装包“Microsoft.VisualBasic”来解决此问题。

于 2017-08-06T08:07:46.587 回答