It seems that the ".Net Assembly Import" is actually a "C# Assembly Import"...
I am trying to import a VB.Net Assembly (Tools > Application Integration > .Net Assembly Import) only to find that it cannot be done.
I get the error:
"Error trying to load Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Could not load file
or assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified."
I usually don't have problems importing C# Assemblies, so I tried to create an intermediate C# class to access the methods of the Vb.Net one.... But it also seems that I can't import C# assemblies into Gx, when they have a reference to a Vb.Net class.
How can I access the methods of a VB.Net Assembly?
Did you put the vb.net assembly .dll into bin folder of your application?
Theoretically vb.net code and c# code turns into bytecode compiled by .net framework
I found this url that convertĀ“s the code from vb.net to c# and vice versa (if you have the source, if not try decompile)
http://converter.telerik.com/
Hope that helps.
Regards, Felipe.
Related
I have a library used in various project and made with .net core 2.0; the library is called 'Coconut'; the test is done on Windows.
When I try to build a simple test project to test some functionalities, the test code will not run.
The test is very simple:
but when I run it:
And the output is:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'Coconut, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
and the console shows the same problem:
What I don't understand is that the DLL that is not found is built in the same solution and everything was built through Visual Studio's tooling.
We can clearly see the dll in the same folder.
Edit:
When checking with procmon, there is not a single operation trying to load 'coconut.dll'; that string is completely absent from the log.
I have a C# project that I'd like to use as a .NET Standard 2.0 library for other .NET assemblies and as a COM component for native code. I could create the COM object just fine when I targeted the full .NET Framework, but when I created a new project targeting .NET Standard, I got this error when I tried register it:
regasm /codebase /tlb MyLib.dll
RegAsm : error RA0000 : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
How can I build and register a DLL that is compatible with both .NET Standard and COM?
Ensure that .NET 4.7.1 is installed. Even then, since Visual Studio doesn't copy NuGet packages to the output directory, expect to get a similar "Could not load file or assembly" error for one of those.
If you can live with a single project but two DLLs, this is an alternative: In your .csproj, remove the TargetFramework line and replace it with multiple targets, according to what your code needs, for example:
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
Then use the net461 DLL for use by COM and the netstandard2.0 for use by .NET.
In a Xamarin.Forms project I am getting an error on Windows 8.1 and UWP:
Could not load file or assembly 'FSharp.Core, Version=3.259.3.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
The actual version of F# used throughout the solution is 3.7.4.0:
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetProfile>netcore</TargetProfile>
<TargetFSharpCoreVersion>3.7.4.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
There is an F# PCL project and C# platform-specific projects. The error occurs only when using F# libraries from Nuget in the PCL. These packages tend to use:
<TargetFSharpCoreVersion>3.259.3.1</TargetFSharpCoreVersion>
I have tried the following, but they do not change the error:
Putting an app.config file with a binding redirect to 3.7.4.0 in the F# project and/or the build directory
Installing the FSharp.Core Nuget package into all projects
Very grateful for any help.
Edit: in the original question there was an incompatibility between the profile (111) and the intended TargetFSharpCoreVersion (3.7.4.0) which was causing additional issues.
I am using prism and I get an exception that: The type 'Microsoft.Practices.Prism.Bootstrapper' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.Prism.Composition, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null'
the problem is that I already have an assembly reference to Microsoft.Practices.Prism.Composition in my project
any help? thanks
It seems Microsoft.Practices.Prism.UnityExtensions need a reference to Microsoft.Practices.Prism.Composition assembly.
Just download Prism 5.0 for WPF, compile the source code of ModularityWithUnity.Desktop.sln at \Source\Quickstarts\Modularity\Desktop\ModularityWithUnity and copy all Prism assemblies from bin\Debug directory and paste it in your app's location.
This fixed my same problem.
I am building a Cpp/Clr dll with .NET Framework 2.0. Builds fine. However, when I create an Example program to use the dll, also with 2.0, I get this error:
The primary reference "C:\...\MemBuffDll.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
I have very carefully rebuild the entire solution (not too hard, only two projects in it) and made sure I used only cut and paste of code from one file to another in the re-creation. I as VERY careful to make sure I specified the 2.0 Framework.
When I exclude the Example Solution, everything builds fine. When I reload it, I get the above message. So, I searched in the contents of every file in the entire solution and found the reference in both the .dll and in a file ending with .metagen. The metagen lines of interest are:
ImageRuntimeVersion: v4.0.30319
Assembly MemBuffDll, Version=0.0.*, Culture=Invariant Language (Invariant Country):
hash=SHA1, flags=PublicKey
Assembly mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:
hash=None, flags=None
Assembly mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:
hash=None, flags=None
Assembly System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:
hash=None, flags=None
Why are the two lines with 4.0.0.0 in there? This is supposed to be a 2.0 build.
Really puzzled,
-greenhorn greg
The answer to the question is:
"The C++ IDE does not support multi-targeting"
Because I didn't understand this answer when I'd seen it in other posts, I'm going to try and clarify for the benefit of other poor souls who stumble upon this "feature".
What this means is that my VS 2010 cannot (correctly) target .net 2.0 when I'm doing a C++ project. I had specified .net framework 2.0 for both of my projects in my solution and the settings were accepted. However, the C++ portion (actually C++/CLI) actually built with two references, both the v2.0 that I had specified and v4.0 that is the native(?) for my VS 2010. Note that it did not throw an error or warning and only the .dll and the .metagen files contained this reference.
When the other project in my solution tried to reference the project, I got the error mentioned in my OP. It would not build.
The solution to the problem is twofold:
Install VS 2008 and recreate the problem project under that. Will probably need refactoring. Note that the Express edition worked just fine for this.
Change your targets to .net 4.0. This is what I did because refactoring the dll would be a PITA and the target platform (Windows Embedded 8 Standard) supports .net 4.0
Hope this helps somebody else like me that runs into this.