Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies - c#

I have this exception generated on some user machines (~1 of 20):
Could not load file or assembly 'System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified.
I found several references to this error over the web and this site but nothing helped.
I have an add-in application which uses WCF to connect to the server. The add-in built with .NET Framework 3.5 with VS 2008.
The error is reproducible on one of the test machines in only one user account. I install my application and can only reproduce this from one account on this machine everywhere else it is working fine. Furthermore it is only reproducible with only one version of host application which I created add-in for (I assume because it uses differnet .NET Frameworks).
I have checked the fuse logs and I see the following:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\SolidWorks Corp\SolidWorks\sldworks.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Home\User
LOG: DisplayName = System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/SolidWorks Corp/SolidWorks/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
So by some reasons it is trying to use v2.0.50727\mscorwks.dll loader to load the Version=4.0.0.0 of System.dll. On build machine I'm referring 2.0.0.0 version of System.dll.

I had this same problem - some users could pull from git and everything ran fine. Some would pull and get a very similar exception:
Could not load file or assembly '..., Version=..., Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.
In my particular case it was AjaxMin, so the actual error looked like this but the details don't matter:
Could not load file or assembly 'AjaxMin, Version=4.95.4924.12383, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies. The system cannot find the file specified.
It turned out to be a result of the following actions on a Solution:
NuGet Package Restore was turned on for the Solution.
A Project was added, and a Nuget package was installed into it (AjaxMin in this case).
The Project was moved to different folder in the Solution.
The Nuget package was updated to a newer version.
And slowly but surely this bug started showing up for some users.
The reason was the Solution-level packages/respositories.config kept the old Project reference, and now had a new, second entry for the moved Project. In other words it had this before the reorg:
<repository path="..\Old\packages.config" />
And this after the reorg:
<repository path="..\Old\packages.config" />
<repository path="..\New\packages.config" />
So the first line now refers to a Project that, while on disk, is no longer part of my Solution.
With Nuget Package Restore on, both packages.config files were being read, which each pointed to their own list of Nuget packages and package versions. Until a Nuget package was updated to a newer version however, there weren't any conflicts.
Once a Nuget package was updated, however, only active Projects had their repositories listings updated. NuGet Package Restore chose to download just one version of the library - the first one it encountered in repositories.config, which was the older one. The compiler and IDE proceeded as though it chose the newer one. The result was a run-time exception saying the DLL was missing.
The answer obviously is to delete any lines from this file that referenced Projects that aren't in your Solution.

I got this after downgrading a project from .net 4.5 to .net 3.5.
To resolve I had to go in to the project - properties - settings window and delete all my settings, save the project, exit and restart visual studio, go back into project - properties -settings window and re-enter all my settings and their default values

This worked for me.
Go to Project->Propertied->Target Frawork->Change frame work like 3.5 to 4.0

I had the problem under Linux and I needed to install those. I don't know which one actually fixed the problem, but that error was gone after that:
apt-get install mono-utils mono-runtime-sgen mono-runtime-common \
mono-runtime-boehm mono-runtime-dbg mono-xbuild

I've seen this a couple times, and it is usually fixed by running a repair on .NET Framework (whichever version the application is trying to use).

You are using .net 4? - Maybe on the clients there is only the ".net framework 4 client profile" installed. Try to install full package!!
Download here

In my case, I was able to find issue with ScriptManager by setting Debug=true in web.config file

I answered too late but it has worked in my case.If you are facing this issue in your project please add the following line in your web.config :
<compilation batch="false" >
This worked in my case. If you already have compilation tag in your web.config then add only batch="false" property to it.

You can enable NuGet packages and update you dlls. so that it work.
or you can update the package manually by going through the package manager in your vs if u know which version you require for your solution.

Even I have experience some more strange things, I can see there is no dll in GAC from where the dll is loading but windows > Module shows system.dll version=4.0.0.0 loaded

i just changed my target .net framework and it worked .in my case i changed from .net 4.7 to .net 4.
Right click your solution and select properties
selct properties
Click Application >> Target Framework

FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
this is my problem. I installed system.configuration assembly in the project and other class libraries also. now the problem has gone.

am used net 6.0 with aspcore.report and problem like this happened with me
I installed system.configuration assembly in the server project problem solved

Related

System.Data.SqlXml Version 2 not installed on system

One of our build agent servers does not have System.Data.SqlXml Version=2.0.0.0 under C:\Windows\assembly but every other machine we have does. Unfortunately this causes nunit-summary.exe on that box to fail with:
EXEC Could not load file or assembly 'System.Data.SqlXml,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or
one of its dependencies. The system cannot find the file specified.
error MSB3073: The command ""../tools/nunit-summary.exe" artifacts/Test_*.xml" exited with code -1.
I tried installing MSXML 4 to no avail. I have not been able to figure out how to install version 2, any ideas?
Two possible solutions.
a) In the project, expand references to find the reference to the library. Go to properies and set Copy Local to be True. The .dll will then be included in the bin folder when the project is built.
b) Install SQLXML from Microsoft (this is different to MSXML which you tried). Details about the library (including the download link) are available at https://learn.microsoft.com/en-us/sql/relational-databases/sqlxml/what-s-new-in-sqlxml-4-0-sp1

Add Reporting.WinForms Reference to VS2015

I'm looking at adding the reference;
Microsoft.Reporting.WinForms
to my VisualStudio (2015) project but when I go to Add the Reference in the Solution Explorer I couldn't find it.
Eventually I added it through NuGet but now I am getting the error message;
Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
which leads me to believe I just haven't added the package properly. I've installed Microsoft SQL Server Data Tools through program features but still no luck.
What am I missing?
You can try by executing this into Package Manager Console
Install-Package Microsoft.Reporting.WinForms.v11

Application requires that assembly office version 12.0.0.0 be installed in GAC

I have a .csproj that I want to publish to a clickonce server.
When I publish the application from one development computer it works and the program can be started from the server without any problems.
I download the same project from svn to another computer and try to publish it. That step kinda works, i guess, since the program is published successfully without any errors.
But when I try to start the program from the server I get the error:
Application requires that assembly office version 12.0.0.0 be installed in the Global Assembly Cache(GAC) first.
Update: (also posted info in comments). I am receiving this warning on both machines though I don't know how to solve. But it's probably the cause of the problem I guess:
No way to resolve conflict between "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" and "office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Choosing "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" arbitrarily.
1> Consider app.config remapping of assembly "office, Culture=neutral, PublicKeyToken=71e9bce111e9429c" from Version "12.0.0.0" [C:\Windows\assembly\GAC\office\12.0.0.0__71e9bce111e9429c\office.dll] to Version "14.0.0.0" [D:\Visual Studio\Visual Studio Tools for Office\PIA\Office14\office.dll] to solve conflict and get rid of warning.
So I finally solved this.
First I thougt I'd describe how the project looked. Under references there was no reference to the office.dll file though this actually ended up in the published directory when computer1, which was able to publish a working copy, published the project. Also under properties->publish->ApplicationFiles the office.dll was listed as exluded.
computer2, which couldn't publish a working project, had the same installed programs as computer1. So I tried to add the reference to office.ddl, set it to copy local and include it in applicationfiles. Now there was a office.dll copied to the published directory but the same error appeared. installed and re-installed a bunch of programs, no improvement. After I've been trying alot of randomstuff I ended up copying the dll from computer1, referenced it, set it to copy local and included it. And, voila, it worked?

Callisto multiple reference errors

Recently I tried to install callisto 1.1.0 and 1.2.6 for a windows store application. But after installation my application stopped running and popped out this error
Error 1 An assembly with the same simple name 'Callisto,
Version=1.2.6.0, Culture=neutral, PublicKeyToken=null has already been
imported. Try removing one of the references or sign them to enable
side-by-side. c:\Program Files (x86)\Microsoft
SDKs\Windows\v8.0\ExtensionSDKs\Callisto\1.2.6\References\CommonConfiguration\neutral\Callisto.dll Callisto_AppBar
I tried removing the dll files from the installed location and reinstalling the latest version of callisto. But still the same error is popping up. It would be great if someone could share a solution for it.
You can't have multiple versions of this library in your project...only one is permitted.

Entity Framework 5 - Could not load file or assembly EntityFramework, Version=5.0.0.0

I am trying to use Entity Framework 5 for my project but I seem to be having some issue getting the assembly installed to comply. And since I installed this initially using nuget, I am not certain what I need to do to cause this to work as I expect . Any help on what I need to do to fix this problem please?
*System.IO.FileNotFoundException : Could not load file or assembly EntityFramework, Version=5.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089' or one of it's dependencies The System cannot find the file specified.WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registy value . . . *
by using fusion log, i got this
*** Assembly Binder Log Entry (7/17/2012 # 9:29:09 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = WORKALOT\Tokorie
LOG: DisplayName = Budget.Data, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = vstest.executionengine.x86.exe
Calling assembly : Budget.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data.DLL.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data/Budget.Data.DLL.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data.EXE.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data/Budget.Data.EXE.
LOG: All probing URLs attempted and failed.
Run the fusion log tool as suggested by the error message to get more information about where the runtime is looking for the dll's so you get a better idea of why it is failing.
There is a good article about Fusion-loggning by Scott Hanselman, how you enable it etc, then just run fuslogw as admin from command prompt.
Update
The fusion log shows us where the runtime is looking for your DLLs, in this case Budget.Data, which it looks for in:
bin/Release/Budget.Data.DLL
bin/Release/Budget.Data/Budget.Data.DLL
bin/Release/Budget.Data.EXE
bin/Release/Budget.Data/Budget.Data.EXE
Can you verify that the DLL is in fact in one of these directories ? If it is check the target framework on your DLL (check the project properties) ? Is the target framework compatible with EF 5.0 ? What is the target framework of your other assemblies (if any)
Are you sure the path is correct? Try to remove the "Entity Framework" reference and re-adding it manually.
Right click to add a reference, then browse here and add the dll:
C:\PATH\TO\SOLUTION\packages\EntityFramework.5.0.0-rc\lib\net45\EntityFramework.dll
Also make sure the path is set in the csproj file of the project (right click project, unload, right click again and then "Edit projectname.csproj"), you should have something like this:
<Reference Include="EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.5.0.0-rc\lib\net45\EntityFramework.dll</HintPath>
</Reference>
Other things to check would be the packages.config file to make sure it's referenced there, and also make sure that the Entity Framework reference's "Copy Local" property is set to true. You might also have to reference the assembly in your web.config file if you're using it in an ASP.NET projcet or something similar.
Check the flag "copy local"
Check the assembly dll exists in out put folder
Check reference in solution. Try readd reference.
Check the version and public key of assembly and in solution file (You can open the visual studio solution file and edit it in text editor. Try remove public key from solution file and set correct version if its difers)
Also this problem can hapen when some assembly you add to solution references to assembly that you did't have. If that try to get correct assembly or try rebuild assembly with libraries you have.
Good luck!
I actually had this problem myself the other day, when working with version control (git) and the Nuget package for ef5-rc. What solved the issue for me was to remove (delete in Windows explorer) the assembly from the solutions' "packages" folder. When i restarted Visual Studio Nuget gave me the opportunity to restore packages. Hope this helps!
What blocks are you using from EntLib5? Since you are calling it from the DAL, I will assume you are calling Microsoft.Practice.EnterpriseLibrary.Data.
If so, I just want to point out that I always needed all of the following DLLs to get the EntLib5 DAAB to work for me.
Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.Unity
Microsoft.Practices.Unity.Interception
Missing any one of those references will cause my project to error out at runtime, even if compiles fine.
I would also try running the EntLib5 installer from http://www.microsoft.com/en-us/download/details.aspx?id=15104, since it sticks the DLLs into the GAC.
I ended up solving this for a project I am working on. I ended up deleting everything in the .bin folder for the project that was throwing the error. I assume that these files only get re-written as specific times or when a .dll changes etc. and was not handled by the migration over. Deleting those files, cleaning the solution and rebuilding seemed to solve the problem for me.
I'm getting this problem too. So I did a bit of a look around and found the following.
In the "Common Problems" section of http://msdn.microsoft.com/en-us/data/jj618307.aspx it says...
"This typically means that you are running a .NET 4 application without the Redirect.config file. You need to copy the Redirect.config to the same location as migrate.exe and rename it to migrate.exe.config."
Unfortunately, I don't know where Redirect.config is located. The cannot find it anywhere in the NuGet package's directory contents.

Categories