Marko Apfel - Afghanistan/Belgium/Germany

Management, Architecture, Programming, QA, Coach, GIS, EAI

  Home  |   Contact  |   Syndication    |   Login
  187 Posts | 2 Stories | 201 Comments | 4 Trackbacks


Twitter | LinkedIn | Xing

Article Categories




Enterprise Library


SQL Server


Since several days during compilation i had the error:

Cannot register assembly "Foo.dll".
Exception has been thrown by the target of an invocation.

In the output-window with diagnostic compile information the following statement was listed:

Foo -> Foo.dll
error MSB3217: Cannot register assembly "Foo.dll".
Exception has been thrown by the target of an invocation.
Done building project "Foo.csproj" -- FAILED.

Manually registration was no problem.

The solution was an orphan assembly in the GAC. This assembly was referenced by my project (by a roundabout) and referenced self other assemblies which are deleted. Normally a local copy should be used, but the compiler takes the version of the GAC (GAC-assemblies are preferred over local assemblies) and so the compiler runs in a problem.

Fretfully was the wrong hint "cannot register assembly" :-(

posted on Thursday, January 8, 2009 11:54 AM


# re: Compiler-Error: error MSB3217 3/4/2009 3:31 AM Aliase

I encountered similar problem when compiling a ArcGIS project. Did you encounter this with ArcGIS?

Can you give me more details on how to solve it?


# re: Compiler-Error: error MSB3217 3/4/2009 5:23 AM Marko Apfel
You are rigth .. this problem occurs by ArcGIS programming.

Try the following:
1.) if possible, remove version infos of references to ArcGIS-assemblies in your csproj-files
2.) look wether you reference in your csproj-files other assemblies (ArcGIS third party assemblies) and analyze possible versions of these assemblies in the GAC. use reflector to look inside these assemblies and compare the versions of assemblies which are listed
3.) delete possible conflicting assemblies in the GAC. try to clean the GAC, so that only ESRI ArcGIS assemblies listed in the GAC
4.) try to reference ArcGIS third party assemblies as references to assemblies in file system
5.) delete all temporary folders (bin, obj, ..) under all projects and delete a possible common output folder
6.) verify, that on other systems this problem dont occur

Good luck & greetings

# re: Compiler-Error: error MSB3217 7/10/2009 7:56 AM Scope
Thanks, this fixed my problem. I had some references to my DLLs in GAC, which should have been removed when app uninstalled but they didn't. Once i removed them errors went away. Whats interesting is that this error wasn't occurring for months, untill i created new solutions for some existing projects because we moved some stuff around.

Post A Comment