Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

.net - Xamarin.Android and VB.Net Libraries

Though it is far from my choice, I'm forced to work with some libraries that were written in VB.Net. One of these libraries has some DTOs I'm looking to reuse in a Xamarin.Android project I'm working on. I've included the references just fine, but when I attempt to build, I get the following error:

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

Is anyone familiar with this issue, and is there a fix (preferably not involving the inclusion of that DLL)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same issue and could overpass it by rebuilding the VB project after adding the following line:

<VBRuntime>Embed</VBRuntime>

to the PropertyGroup section of the file NameOfProject.VBPROJ (do it using Notepad, eventually). It will finally look something like this:

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

Some hint came from here:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...