in Visual Studio I have a solution with several projects. In one project I added a reference to another project. All fine. I can see the namespaces/classes of the another project in autocomplete, etc.
When I try to do
OtherProjectNamespace.Class a = new OtherProjectNamespace.Class();
I'm getting this:
Could not load file or assembly '**OtherProjectNamespace**, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
There is no line, nothing, I tried try... catch around the new line and is not even catching the exception.
What could be the cause?
Thanks,
Carlos
Some possible directions:
Does the class you are trying to create have any dependency on a class in another assembly? If it does, try adding a reference to the third assembly.
Did the assembly get copied to the running directory of your application? Ensure that the Copy Local property of the reference is set to true.
If you still don't resolve the problem, use a tools such as Fusion Log View (comes with Visual Studio, run fuslogvw.exe from VS command line) to get the exact name of the file that was missing, and the locations from which the CLR tried to load it. Maybe this way you'll find another file that you need to copy.
Try this:
In the project references, change the "Specific Version" property to false. Right click on the project and select Clean. Then rebuild the project.
Related
I am trying to implement A DLL into an existing project. I am getting this Error:
{"Could not load file or assembly 'Aspose.Words, Version=21.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56' or one of its dependencies. The system cannot find the file specified.":"Aspose.Words, Version=21.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56"} System.IO.FileNotFoundException
Every time it try to run the method that creates the Aspose(dll) object it goes straight to catch, with this message. But it's odd though because when i Run the exact same code with the exact same package and path, it works just fine in a new standalone program.
Any tips ?
The problem seems quite straightforward, windows can't find the .dll. So probably the reference points to nowhere. Can you try to debug and see where exactly does it look for it, in what location? Then open file explorer and verify if it actually exists there.
It might look for the .Dll in project or in Global Assembly Cache. Try cleaning the cache and try again.
I'm newbie to .net projects. Although I was able to code in c# & use it's frameworks, Some times I face exceptions which I really didn't get any proper resource/suggestion to modify or rectify them. Hope I would get clear this time.
The exception which I faced is as follows :
Could not load file or assembly 'Microsoft.AspNetCore.Cryptography.KeyDerivation, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
I'm really confused with such type of exceptions. What's the reason for those & how we needs to cross check to clear those ?
Here is what I did install: "Microsoft.AspNetCore.Cryptography.KeyDerivation" from nuget console with version 2.2.0.
My installed packages list image :
The main reason for this type of error is a result of your output folder. Take a look at where your binary outputs were placed. Inside of that folder (usually your .exe or .dll output, not sure what kind of .NET project you're writing), you should also have all of your dependency dlls. In this case, the dll related to Microsoft.AspNetCore.Cryptography.KeyDerivation is missing. So when you go to run your executable, it complains "Could not load file or assembly KeyDerivation" because it couldn't find it.
To resolve this issue, double check your project's references and that there are no issues with the Microsoft.AspNetcore.Cryptography.KeyDerivation reference (what I mean is, make sure there are no yellow exclamations or other icons showing up next to this reference in your Solution Explorer). If you have any issues, remove the reference, then add the nuget package again.
Hi I am creating new project in visual studio using the following structure:
Now the way things will be referenced will be using the following structure:
Client projects will only reference Commercify.Product.Contracts
Commercify.Products will reference Commercify.Product.Contracts and Commercify.DataAccess.Contracts
Commercify.DataAccess references Commercify.DataAccess.Contracts
Infrastructure.Injector will be referenced only in client and will be used for registering dependencies
In startup I am calling the following code:
Assembly assembly = Assembly.Load(new AssemblyName("Commercify.DataAccess"));
When this code gets executed I get the following exception:
{"Could not load file or assembly 'Commercify.DataAccess, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Commercify.DataAccess, Culture=neutral, PublicKeyToken=null"}
Now I am assuming that this is happening because Visual Studio does not seem to see that Commercify.DataAccess is actualy needed because its not referenced anywhere in the other projects. I had the exact same problem problem in a project that used csproj type of projects so it is not a dxsproj problem.
I had solved it by using a post build event.
I would prefer to have a more clean solution to this if there is one.
Can anyone tell me how to solve the problem?
You are loading dynamically a DLL, so Visual Studio doesn't has a clue that it needs to be copied.
Or you stick with the post-build events (I am working in an exact case like that and that's the best approach) or you add a reference to the project on the other projects, but it defeats the purpose of loading dynamically an assembly.
I am developing a .net solution. Due to certain complications, I have been asked to add dlls to the solution and then reference the dlls from within the solution.
It works fine on the local box , and builds perfectly on TFS Build server,
but when I run it on the server after deploying , I get a run time exception saying :
Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Would you know what I should be doing at this point ?
I can provide you more detailed info if needed.. please let me know.
It seems like you need to get Microsoft.TeamFoundation.Client.dll file,
then add it as a reference to your application
this is the dependencies you described:
Two possible resolutions
Set CopyLocal property to true so that when build is done local copy of dll is added.
Check reference folder has been checked in TFS or not. Sometimes it happens that reference folder is not added in TFS.
I'm writing a WebService that references another managed DLL which then uses a third-party DLL. When I start debugging my WebService I get the following error:
Could not load file or assembly 'AForge.Video.FFMPEG.DLL' or one of
its dependencies.
As recommended in many other posts, I tried these steps:
Changed from AnyCPU to x86
Copied all DLLs to %system32% directory
But had no success so far. Any ideas?
Thanks, Matthias
Could not load file or assembly 'AForge.Video.FFMPEG.DLL' or one of its dependencies.
You are either copying the file(s) to the wrong place or not copying the correct files.
Get to the bottom of this by downloading Dependency Walker
You can then drag AForge.Video.FFMPEG.DLL into the application and it will tell you what is missing.
Also, determine the base directory for your application to ensure you are copying the files to the correct folder at runtime. You can do this by writing System.AppDomain.CurrentDomain.BaseDirectory to the console (or add it to your watch)
Also see this
I re-engineered the project structure in VisualStudio to get rid of the dependency to AForder.Video.FFMPEG.DLL. That helped. I found no other solution so far.