Could not load file or assembly

16

When I am trying to debug in Visual Studio 2008, I'm getting the following error. I have cleaned the ASP.NET temp folder and restarted VS. I also removed the supposedly breaking reference and added it back. But nothing seems to work. Has anyone faced similar situations and is there a solution?

Could not load file or assembly '"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

[FileLoadException: Could not load file or assembly '"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent) +0
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +114 System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly '"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8809426
System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
System.Web.Compilation.BuildManager.CompileCodeDirectories() +265 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +320

[HttpException (0x80004005): Could not load file or assembly '"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Could not load file or assembly '"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8890735
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

asp.net
visual-studio
asked on Stack Overflow Feb 14, 2010 by Asif Mohammed • edited Apr 5, 2011 by bluish

5 Answers

40

" * * * * * * * * 's conflicted copy with #### - ## - ## "

Seems like you are using dropbox to sync files, this "conflicted copy" files dropbox creates if 2 computers changes the same file offline.. and when they get online dropbox sync algorithms confuses which file is the right one so it keeps both files with renaming one to this name pattern.

In your case:

this happened inside your project's bin directory, just delete the file with "conflicted copy" part and keep the other one.. OR delete both if your project reference the dll from another location, and Rebuild the solution.

answered on Stack Overflow Mar 6, 2012 by alaasdk • edited Aug 7, 2017 by alaasdk
12

Assembly loading issues are something all .NET developers need to learn to fix. There are a number of possible reasons, to work out the problem there are two things you need. First understanding how .NET finds assesmblies. Second the Fusion Log Viewer (Fuslogvw.exe), which with the knowledge of the loading process will allow you to identify what is working and failing.

Usually the reason to getting a load exception is that the assembly you want is not in the GAC or probing path. It can also be due to the target assembly not being built for the neccessary platform (e.g. a 64bit process cannot load an assembly built for "x86" only).

answered on Stack Overflow Feb 14, 2010 by Richard
3

I was right. It was something that my version control software caused. When I got the latest version it somehow added an additional copy of all my assemblies with (asif mohammed's conflicted copy blah blah), after almost thinking about reinstalling in VS I just had to remove the sneaky dlls sitting in my file system.

Thanks for all the responses. Learned how to assembly loading works, so all is not lost.

answered on Stack Overflow Feb 15, 2010 by Asif Mohammed • edited Aug 19, 2013 by Kit
1

Completely agree with Richard...
Just one more hint: reading the exception trace I think that "GCS.Common (asif mohammed's conflicted copy 2010-01-29)" is a very strange name for an assembly, isn't it? ;-)
Did you rename some file, perhaps in the bin folder?

answered on Stack Overflow Feb 14, 2010 by Fabrizio C.
0

That does not look like a very good assembly name, but if in fact it does exist...

It seems that you are manually specifying this assembly somewhere, perhaps in web.config?

if so, try using the Assembly Qualified Name, an example would be found in your web.config for any assembly that microsoft places there. Do not worry about version/culture or key, just "type name, assembly name" will usually suffice.

e.g. instead of:

'"GCS.Common (asif mohammed's conflicted copy 2010-01-29)"

use

'"GCS.Common (asif mohammed's conflicted copy 2010-01-29), [insert assembly filename less extension here]"

p.s. my advice is to name assemblies using the same rules as identifiers in c#. your life will be easier in the long run.

answered on Stack Overflow Feb 14, 2010 by Sky Sanders

User contributions licensed under CC BY-SA 3.0