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


i have exception generated on user machines (~1 of 20):

could not load file or assembly 'system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' or 1 of dependencies. system cannot find file specified.

i found several references error on web , site nothing helped.

i have add-in application uses wcf connect server. add-in built .net framework 3.5 vs 2008.

the error reproducible on 1 of test machines in 1 user account. install application , can reproduce 1 account on machine everywhere else working fine. furthermore reproducible 1 version of host application created add-in (i assume because uses differnet .net frameworks).

i have checked fuse logs , see 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 --- 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 reasons trying use v2.0.50727\mscorwks.dll loader load version=4.0.0.0 of system.dll. on build machine i'm referring 2.0.0.0 version of system.dll

any appreciated.

thanks, artem

i had same problem - users pull git , ran fine. pull , similar exception:

could not load file or assembly '..., version=..., culture=neutral, publickeytoken=...' or 1 of dependencies. system cannot find file specified.

in particular case ajaxmin, actual error looked details don't matter:

could not load file or assembly 'ajaxmin, version=4.95.4924.12383, culture=neutral, publickeytoken=21ef50ce11b5d80f' or 1 of dependencies. system cannot find file specified.

it turned out result of following actions on solution:

  1. nuget package restore turned on solution.

  2. a project added, , nuget package installed (ajaxmin in case).

  3. the project moved different folder in solution.

  4. the nuget package updated newer version.

and surely bug started showing users.

the reason solution-level packages/respositories.config kept old project reference, , had new, second entry moved project. in other words had before reorg:

  <repository path="..\old\packages.config" /> 

and after reorg:

  <repository path="..\old\packages.config" />   <repository path="..\new\packages.config" /> 

so first line refers project that, while on disk, is no longer part of solution.

with nuget package restore on, both packages.config files being read, each pointed own list of nuget packages , package versions. until nuget package updated newer version however, there weren't conflicts.

once nuget package updated, however, active projects had repositories listings updated. nuget package restore chose download 1 version of library - first 1 encountered in repositories.config, older one. compiler , ide proceeded though chose newer one. result run-time exception saying dll missing.

the answer delete lines file referenced projects aren't in solution.


Comments