为什么将dll从GAC复制到project \ bin文件夹
有以下情况:
- Windows 7 64位
- Visual Studio 2010
- 一个包含asp.net 2.0项目的解决方案
- 在文件夹中:C:\ Program Files(x86)\ Reference Assemblies \ CompanyName \我有文件:
- Aaa.dll
- Aaa.pdb
- Aaa.xml(xmldoc)我的解决方案中的任何项目都没有引用dll(实际上我的解决方案中只有一个项目)
问题是,每次我进行构建时,dll,pdb和xml都会被复制到bin文件夹中,我得到:
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.
如果我在运行程序之前没有删除dll。
我从来没有遇到类似的问题,我不知道如何诊断它。 有什么建议?
编辑:我忘记了。 此dll 未在项目的参考中引用 。 (我在Visual Studio项目资源管理器中没有看到它:MySolution – > MyProject – > References
编辑 (@chappo感谢您的新见解)运行MsBuild我看到:
_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".
dll确实标记为复制本地问题现在在哪里?
我有过类似的问题一次。 由于您有64位系统,请检查’Aaa.dll’是否为32位dll。 如果是,则必须将IIS中的应用程序池设置更改为启用32位应用程序。
您可以在此处找到详细说明: https : //help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx
尝试清理解决方案文件。
- 转到“ 构建”选项卡
- 单击清洁解决方案
- 然后单击Build Solution
很久以前我经历过这样的经历。 但在我的情况下,我的一个项目无法找到我的另一个项目的.dll。 我搜索了答案,我才开始使用这种方法。
试着看看这里。 重建Visual Studio库项目参考