lixonn
lixonn

Reputation: 1063

Why a dll is copied from GAC to project\bin folder

Having the following situation:

The problem is that every time I make a build the dll, pdb and xml are copied to the bin folder and I get:

Could not load file or assembly 'Aaa.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

if I don't delete the dll before running the program.

I have never encountered a similar problem and I have no idea how diagnose it. Any suggestions?

Edit: I forgot to metion. This dll is not referenced in References of the project. (I don't see it in visual studio project explorer under: MySolution -> MyProject -> References

Edit (@chappo thanks for a new insight) Running MsBuild I see:

_CopyFilesMarkedCopyLocal:
  Copying file from "C:\MyCompany\MyProjects\Project1\App_Code\AjaxControlToolkit.dll" to "bin\AjaxControlToolkit.dll".
  Copying file from "C:\Program Files (x86)\Reference Assemblies\MyCompany\Aaa.dll" to "bin\Aaa.dll".
  Copying file from "C:\Program Files (x86)\Reference Assemblies\MyCompany\Aaa.pdb" to "bin\Aaa.pdb".
  Copying file from "C:\Program Files (x86)\Reference Assemblies\MyCompany\Aaa.xml" to "bin\Aaa.xml".

The dll is indeed marked as copy local the question now is where?

Upvotes: 1

Views: 2156

Answers (2)

mironiasty
mironiasty

Reputation: 36

I had similar issue once. As you have 64 bit system, check if 'Aaa.dll' is 32 bit dll. If it is, then you have to change Application Pool settings in IIS to Enable 32 bits application.

You can find detailed description here: https://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx

Upvotes: 1

Flash3
Flash3

Reputation: 58

Try to clean your solution file.

  • Go to Build tab
  • Click Clean Solution
  • And click Build Solution

I experienced like this one a long time ago. But in my case, one of my project could not locate the .dll of my another project. I searched for the answer and I only came up on using this method.

Try to look here also. Rebuild Visual Studio Library Project Reference

Upvotes: 0

Related Questions