I have a.net core 3.1 Web API project and I have to use functions from a dll programmed in vb.
and I am not allowed to modify the dll.
when running the service,I get the error:
"Could not load type 'Microsoft.VisualBasic.Devices.Computer' from assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=fghda'.",
I tried addind this dll in .netframework web API project and by adding "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" nuget to the references ,I could successfully run the service.
the problem is this nuget is not working in .net core and using similiar nugets were useless.
I also added microsoft.visualbasic dll but nothing changed.
So anybody knows how to resolve the issue?
.NET Core still does not seem to support VB .NET. It was mentioned in the previous statement that it will be supported in the future.
https://devblogs.microsoft.com/vbteam/visual-basic-in-net-core-3-0/
Related
I am trying to use a C# application to interact with a Trimble Connect Project. To do this, I'm trying to follow this link: APIs tutorial.
The problem is that after adding a lot of missed dependencies I'm stuck with this:
Could not load type 'System.ServiceModel.Description.DispatcherSynchronizationBehavior' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
This problem is becasue you are trying to build this application using .Net Core framework. .net Core core 5.0 framework did changes on ServiceModel along with other. You can refer this link
Here how you can use application. As per documentation of SDK, they supported .Net Framework 4.0 and onwards. Hence you need to use VS 2017 with framework 4.6 or 4.7. Here is the sample running application code from github. you can download this application and open in VS 2017.
You can also download other running code based on different targets from here. Incase you are strugging with Trimble, you can write mail on 'connect-integrate#trimble.com'
Getting this error:
System.IO.FileNotFoundException HResult=0x80070002 Message=Could
not load file or assembly 'System.Data.Entity, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot
find the file specified. Source=... StackTrace: at ....
I create an azure function referencing a class library.
I checked on the class library, System.Data.Entity is being referenced.
But when I run the azure function, I get this error.
What might be wrong here?
The Azure function is on .Net Core 3.1.
The referenced class library (as a project so I can debug it) is on .Net Framework 4.7.2
Is a class library of .net Framework 4.7.2 supported when referenced on .net Core 3.1 (why its not loading System.Data.Entity)?
From this post we can know:
.NET Core doesn't support inclusion of .NET Framework libraries. Period. However, .NET Core supports .NET Standard, and since .NET Framework also implements .NET Standard, Microsoft made a special exception in the compiler to allow you include .NET Framework libraries, with the caveat that they may not actually function at all or totally. You get a warning to this effect when you include a .NET Framework library in a .NET Core project, and it's on you to ensure that the library works correctly end-to-end.
Because .NET Core supports .NET Standard library, you can use the package of .NET Standard. This post is similar to your problem, his solution may inspire you.
I developed a .NET Standard 2.0 Nuget package (local) for a class library with a dependency on WindowsAzure.Storage, Version=9.3.0.0. It passed unit tests and ran fine when invoked from a .NET Core 2.0 console app. However, when I added my package to an Azure Function project (.Net Standard 2.0) it caused an exception to be thrown whenever I attempted to run the azure function from the VS2017 debugger.
System.Private.CoreLib: Could not load file or assembly
'WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60
I had the same sort of problem with Microsoft.Extensions.Configuration 2.1.1.0 and this was resolved by downgrading to v2.0.0.0 - see Stackoverflow post
Question 1: What version of WindowsAzure.Storage works with .NET Standard 2.0 Azure Functions?
Question 2: Apart from trial and error, how are people using this package meant to find out what it works with?
You will have to downgrade the WindowsAzure.Storage package. I am using version 7.2.1 with Azure Functions v2.
Here is the link of all the file for v1. I asked for v2 but no update yet.
https://gist.github.com/fabiocav/8fcccd4d54ec298e3b120cbc1230c02a
I've ran into a weird problem.
I basically have my own web-stack for .NET-core which I've built into a few .dlls, and I want to reference these from another ASP CORE-solution.
VS seems to find the assemblies, where I can navigate types etc.
I can also build the project without any issues, but when IIS then runs the server I get an internal server error stating:
FileNotFoundException: Could not load file or assembly 'myDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
The referenced DLLs are in the debug-folder, and the really weird thing is that if I create a new ASP Core project in the same solution as the web-stack, I can reference and use it without any problems.
Why is this happening only when running on a project outside the web-stack's solution, and what can I do to make it runnable everywhere?
The .NET Core Tooling in VS 2017 (< 15.3 preview) / .NET CLI < 2.0 doesn't fully support referencing assemblies on disk. You need to package the library up as a NuGet package or use a project reference ("same solution"). The technical reason is that all the required assemblies and versions are resolved during compilation and written to the .deps.json file. When loading arbitrary assemblies, this might fail because either the assembly or its dependencies cannot be found (or a conflict with each other).
for load the external dll in core project, needed to:
vs 2017 with version 15.3 or upper.
Microsoft.Extensions.DependencyModel NuGet package installed in your project.
I have updated my existing Web Api project to use the latest System.IdenityModel.Tokens.Jwt package and I am getting the following error:
Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
Everything works fine with 4.0 version of the same package. How can I resolve this?
If you want to use the new version(v5) of System.IdentityModel.Tokens.Jwt and don't want to restrict your project to the v4 version, I have created a Nuget and Github project called EasyJwtAuth that uses v5(Very simple to use):
Nuget package:
https://www.nuget.org/packages/EasyJwtAuth
Instructions on how to use:
https://github.com/Xela101/EasyJwtAuth
Feel free to update the repository with more features, or just learn/copy the code and make your own authentication wrapper.