Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Saturday, January 16, 2016

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

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


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

Any help is much appreciated.

Thanks, Artem

Answer by Cadburry for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


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

Answer by Chris Moschini for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


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:

  1. NuGet Package Restore was turned on for the Solution.

  2. A Project was added, and a Nuget package was installed into it (AjaxMin in this case).

  3. The Project was cloned to another folder in a Solution reorganization.

  4. 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 clone brought every Project setting over to the new directory EXCEPT the Solution-level packages/respositories.config file's contents. That file instead copied the Project to a new line. In other words it had this before the reorg:

    

And this after the reorg:

        

So the first line now refers to a Project that, while on disk, is no longer part of my Solution.

As a result, with Nuget Package Restore on, both packages.config files were being read, which each pointed to their own list of Nuget packages to restore. Until the Nuget package was updated to a newer version however this created no conflicts.

Once the Nuget package was updated, however, NuGet Package Restore started choosing to download just one version of the library - the first one it encountered in the repositories.config, which was the older one. Meanwhile the compiler proceeded as though the newer one was present. The result was a run-time exception saying the DLL was missing.

The users who didn't encounter this issue likely did not have the older clone of this Project and thus NuGet Package Restore would look there and find nothing, and the issue was avoided.

The answer obviously is to delete any lines from this file that referenced Projects that aren't in your Solution.

Answer by Dan Liu for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


Thanks for reporting this issue. We've ported this issue to NuGet on codeplex as https://nuget.codeplex.com/workitem/3816. Please check there for any updated regarding to the fix. Thanks!

Answer by Sofia Khwaja for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


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

Answer by killer for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


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 :

  

This worked in my case. If you already have compilation tag in your web.config then add only batch="false" property to it.

Answer by Rizwan for Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies


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.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.