Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...