I have included an external reference of Moneris library eSELECTplus_dotNet_API.dll to my ASP.NET 5 RC1 project. It wrapped it alright and I can build project and run it using Kestrel. But when I publish it from VS or command line I got following error:
The package ID 'eSELECTplus_dotNet_API' contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'.
I tried to rename library to a better name to fit nuget specs and it worked so I can publish it. But now when I run my project I got runtime error saying following:
System.IO.FileNotFoundException : Could not load file or assembly 'eSELECTplus_dotNet_API, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8cb9cd598f87e276' or one of its dependencies. The system cannot find the file specified.
Please advice.
Related
I am using PdfSharpCore version 1.3.40 in a MVC ASP.Net netcoreapp2.1 and it works perfectly on my windows localhost, but when I publish it on a server Linux running Apache the follow exception occurs:
Could not load file or assembly 'PdfSharpCore, Version=1.3.40.0, Culture=neutral, PublicKeyTo ken=null'. The system cannot find the file specified.
I already checked that the PdfSharpCore dll is there, but the system couldn't find it.
Does anyone know what's going on?
We managed to solve the problem, we were forgetting to replace the .deps.json file that contains the dependencies with the new PdfSharpCore.dll dll included in the project. Solved!
I created a .net core 2.2 project using the AWS Lambda function template. Added a MySQL EntityFramework nuget package. My project targets .NET Core 2.2. I have code which uses DbContext and EF stuff. When I run the app using their lambda test tool, I get this error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.2.0.0, .....
Using Process Monitor, I can see the app is trying to load Microsoft.EntityFrameworkCore.dll from ...\bin\Debug\netcoreapp2.2\Microsoft.EntityFrameworkCore.dll which doesn't exist.
My question is why aren't any of the supporting assemblies in that folder? The only assembly (.dll file) in the folder is my app's.
Following step help you to solve this problem:
Delete all bin and obj folders.
Clean Solution. [Build>Clean Solution].
Rebuild Solution
Try to use some type of Microsoft.EntityFrameworkCore namespace explicitly somewhere in your code. For example:
var _ = new Microsoft.EntityFrameworkCore.DbContextOptionsBuilder();
It sould force the build to copy the assembly to result directory.
I have some ideas.
Firstly check, if the folder that you want to refer allows the Visual to have access.
If it do not work, try reinstaling packages through nugget (If I remember correctly I had this same error.). If it shows that its not installed in nugget manager, just install it, even a few times.
Here is the anwser for your question at the end:
Where does NuGet put the dll?
I had a similar problem, in my case removing the line from the .csproj file helped
<PublishReadyToRun>true</PublishReadyToRun>
Specific Exception received: “Could not load file or assembly ‘System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0, Culture=neutral’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.”
I have two projects, one is a sort of “Proof of concept” and the exact same code works perfectly there, while the other is a large solution in which I’m adding code to one of the existing projects.
I am getting an exception in the second (failing) project when running the following line of code:
LibGit2Sharp.Repository.Clone(baseGitHubURL + ourOrg + “/“ + ourRepo.Name, ourRepoPath + #“\” + ourRepo.Name, co);
Ahead of this code, I’ve got it printing the arguments being passed, which are as follows in the output from BOTH projects (again - identical code in each):
GitHub path: https://github.company.com/TESTING/CA4F
Filesystem path: C:\Users\User\CA4F
The creation of CloneOptions is identical in both projects with static values being used (it uses a personal access token as a username).
I am suspecting there is something wrong with how LibGit2Sharp was added to the failing project. Note that the PROCESS was the same for both:
From NuGet console: “Install-Package LibGit2Sharp”
Both have the same version (latest, version 0.25.0).
Despite these facts, the working project has a “Dependencies” section under the project listing LibGit2Sharp, while the non functioning project does not have this section. LibGit2Sharp WAS added as a reference to my actual project when I went to Nuget Package Manager and told it to install to ALL projects in the solution.
Another piece of information - the working project does NOT have a NuGet package for “LibGit2Sharp.NativeBinaries”, while the failing project does. On a whim, I tried deleting it from the failing project, but Nuget says “Unable to uninstall ‘LibGit2Sharp.NativeBinaries.1.0.210’ because ‘LibGit2Sharp.0.25.0’ depends on it.”
Just to close this up - I was able to resolve this by adding the following to the first configuration property group under the PropertyGroup tag in the csproj of every single project in the solution:
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
After doing that, a recompile and run allowed me to successfully call LibGit2Sharp! :)
Note that this was the solution provided by “bording” over on the LibGit2Sharp git issues “forum”.
I just start to write a new application with Net Core 2.0 and I have this structure:
ConsoleApp
Library
the ConsoleApp import the Library reference that is a dll, and Library import HtmlAgilityPack 1.8.0 that's the last version available.
When I run the ConsoleApp, I get this error:
Unhandled exception of type 'System.IO.FileNotFoundException' in Library.dll
Could not load file or assembly 'HtmlAgilityPack, Version=1.8.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a'. The specified file could not be found.
The file is available, as you can see in the image:
Seems that I was able to fix the "bug". To summarize, I have two applications, the first one is a .NET Core Console Application, and the second one is a .NET Core Library. So I've removed the second assembly (.NET Core Library), and I've created the same project as .NET Standard Library.
I got the same problem: when I run the Console Application, the compiler shows the error message:
Unhandled exception of type 'System.IO.FileNotFoundException' in Library.dll Could not load file or assembly 'HtmlAgilityPack, Version=1.8.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a'. The specified file could not be found.
So I've tried to install the HtmlAgilityPack also on the Console Application, and, like dark magic, this worked perfectly.
So I guess that I should add the dependency used on the Library imported also to the Console Application, because .NET Core must be sure that all the dependencies of the imported Library are compatible with .NET Core.
IMHO, this should be specified by Microsoft, and again, this problem should be handled by Visual Studio itself. Why do I need to add the dependencies twice?
Of course, I'm not going to accept my own answer; I prefer to wait for someone who explains this situation.
I'm trying to follow the instructions at https://developers.google.com/optimization/introduction/installing.html#windows_binary so that I can use or-tools inside my C# application.
I'm stuck on the make all step. I am in the Developer Command Prompt, but this command says:
'make' is not recognized as an internal or external command,
operable program or batch file.
I tried downloading GNU make, but that fails also. make install says "no target", and a bare make says:
process_begin: CreateProcess(NULL, cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DNDEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\src\windows /DGFLAGS_DLL_DECL= /DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /Iexamples -DUSE_GLOP -DUSE_BOP -c examples\cpp\costas_array.cc /Foobjs\costas_array.obj, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [objs\\costas_array.obj] Error 2
I also tried copying the DLLs from the bin folder directly into my project. I was able to compile against them by doing this, but when I tried to run it I got an error:
System.BadImageFormatException: 'Could not load file or assembly 'Google.OrTools, Version=5.1.6235.37215, Culture=neutral, PublicKeyToken=7a052e3db761d3be' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
What am I missing?
Regarding the System.BadImageFormatException:
The OrTools binary format is provided in a 64bit dll.
Make sure, that your project is set to 64bit:
In Visual Studio you can check it out by right clicking on the Project --> Properties --> Build, Platform Target: This should be set to x64.
In case you have the same issue with web application, just enable 64 bits on IIS Express using Tools -> Options -> Projects and Solutions -> Web Projects -> Use the 64-bit version on IIS Express for web sites and projects
I was having this issue when using OR-Tools in a Web Application (it worked fine in a console application). I was getting:
System.BadImageFormatException HResult=0x8007000B Message=Could not load file or assembly 'Google.OrTools' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Using x64 didn't help, and Octopus was not building the project correctly either. The solution that worked for me was specifying which ASPNETCOMPILER to use (x64) in the project's .csproj :
<Project .... >
<PropertyGroup>
<AspNetToolPath>$(windir)\Microsoft.NET\Framework64\v4.0.30319</AspNetToolPath>
</PropertyGroup>