“Unable to install or run the application. The application requires that the assembly be installed in the Global Assembly Cache (GAC) first.”
I recevied this error while compiling my first C# production application. I had to do the following in Visual Studio for the project:
- In Solution Explorer, expand the References node and click the assembly listed in the error. Ensure Copy Local in the Properties grid is set to ‘True’.
- In the properties of the project, Publish | Application Files Tab, ensure the Publish Status for the assembly listed in the error is set to ‘Include’
Tags: Assembly Error, C#, Copy Local, GAC, Microsoft, Microsoft Report Viewer, Visual Studio 2008 SP1
You can comment below, or link to this permanent URL from your own site.
February 9, 2009 at 7:45 pm
You are the man. I had the same problem with VB 2008 Express and made the Office Core assembly true. I also changed two of the publishing choices from automatic to include, not sure of if I needed to but ran the install again and worked. Now I can send a
Beta to my client and he can look at the program.
Thank you.
May 25, 2011 at 12:14 pm
Thanks. Clearest fix found. Everything else was just confused.
August 10, 2011 at 5:34 pm
Interesting. I have all these settings as described, but still get an error message. I added a new, in-house-developed assembly to my click-once application, which up until now, has installed just fine for years. Any ideas???
August 12, 2011 at 10:28 am
Ok, our case was slightly different from those described already. But, others may encounter it and wonder what’s going on, so here’s what happened to us (abbreviated):
1. Application A references class library assemblies B and C.
2. Assembly B references several classes in assembly C.
3. Assembly C was updated with several new classes and the version number was incremented from 1.0.0.4 to 1.0.0.5
4. Rebuild of A went fine but during the publish step, two dependency entries for assembly C were written to application A’s manifest. The were:
- dependencyType=”install” for version 1.0.0.5
- dependencyType=”preRequisite” for version 1.0.0.4
This last dependency caused the GAC error because version 1.0.0.4 was never written to the GAC in the first place, yet the manifest is saying that it should be in the GAC because of the preRequisite dependency type.
The cause for all this was simply this: assembly B, although not modified in anyway, needed to be rebuilt to update the version number of assembly C it referenced.
Hope this helps others.
Cheers.
March 21, 2013 at 2:52 pm
AMAZING!!! This solved for me!!
July 19, 2012 at 11:01 am
Thank you very much. After several days of struggle your solution did work for me!!