简体   繁体   English

为什么将dll从GAC复制到project \\ bin文件夹

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

Having the following situation: 具有以下情况:

  • Windows 7 64bit Windows 7 64位
  • Visual Studio 2010 Visual Studio 2010
  • A solution containing a project in asp.net 2.0 一个在asp.net 2.0中包含一个项目的解决方案
  • In the folder: C:\\Program Files (x86)\\Reference Assemblies\\CompanyName\\ I have files: 在文件夹中:C:\\ Program Files(x86)\\ Reference Assemblies \\ CompanyName \\我有以下文件:
    • Aaa.dll Aaa.dll
    • Aaa.pdb Aaa.pdb
    • Aaa.xml (xmldoc) The dll is not referenced in any of my projects in my solution (actually there's only one project in my solution Aaa.xml(xmldoc)我的解决方案中的任何项目均未引用该dll(实际上,我的解决方案中只有一个项目

The problem is that every time I make a build the dll, pdb and xml are copied to the bin folder and I get: 问题是,每次我进行构建时,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.

if I don't delete the dll before running the program. 如果我在运行程序之前不删除dll。

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. 此DLL 是不是在项目的参考 引用 (I don't see it in visual studio project explorer under: MySolution -> MyProject -> References (我在Visual Studio项目浏览器中没有看到它:MySolution-> MyProject-> References

Edit (@chappo thanks for a new insight) Running MsBuild I see: 编辑 (@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".

The dll is indeed marked as copy local the question now is where? 该dll确实被标记为本地副本,现在的问题在哪里?

I had similar issue once. 我曾经有过类似的问题。 As you have 64 bit system, check if 'Aaa.dll' is 32 bit dll. 如果您使用的是64位系统,请检查“ Aaa.dll”是否为32位dll。 If it is, then you have to change Application Pool settings in IIS to Enable 32 bits application. 如果是这样,则必须在IIS中更改“应用程序池”设置以启用32位应用程序。

You can find detailed description here: https://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx 您可以在这里找到详细的描述: https : //help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx

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. 但就我而言,我的一个项目无法找到另一个项目的.dll。 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 重建Visual Studio库项目参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从GAC添加或复制Crystal Report dll引用到Bin文件夹 - Add or Copy Crystal Report dll references from GAC to Bin Folder 无法加载文件或程序集 - 类库中的 dll 未复制到 asp.net 项目 bin 文件夹 - Could not load file or assembly - dll from class library is not copied over to asp.net project bin folder 在发布过程中从bin文件夹复制动态复制的DLL - Copying dynamically copied DLL's from bin folder during publish 为什么即使编译时没有引用任何库,也会将dll文件复制到项目的Bin / Debug文件夹中? - why are there dll files copied to my project's Bin/Debug folder upon compilation despite not referencing any of those libraries? 为什么 contentFiles 文件夹中的文件没有被复制到 bin 文件夹中? - Why are the files from the contentFiles folder not getting copied over to the bin folder? 类库中的引用不会复制到正在运行的项目bin文件夹中 - References from class library are not copied to running project bin folder 将EXE文件添加到项目中,以便将其像DLL一样复制到Bin / Debug文件夹中? - Add an EXE file to a project, so that it will be copied to the Bin/Debug folder just like a DLL? 如何从dll项目内的bin文件夹中获取文件夹位置? - How to get a folder location from the bin folder inside a dll project? System.Web.Razor.dll未复制到bin文件夹 - System.Web.Razor.dll not copied to bin folder 为什么将此.dll复制到输出文件夹? - Why is this .dll being copied to the output folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM