简体   繁体   English

Dll不要复制到bin文件夹

[英]Dll not copying to bin folder

I'm having an issue with Devart DLLs not getting copied to the bin folder of my web app. 我有一个Devart DLL没有被复制到我的web应用程序的bin文件夹的问题。 I have my web app project that references projectA. 我有一个引用projectA的web应用程序项目。 ProjectA references projectB. ProjectA引用projectB。 The Devart Dlls are used in projectB and are not being copied into the web app projects bin folder during a build. Devart Dlls在projectB中使用,并且在构建期间不会被复制到Web应用程序项目bin文件夹中。 ProjectB also references EL Unity dlls and they are being copied correctly. ProjectB还引用了EL Unity dll,它们正在被正确复制。 All of the Dlls in question are physically located in a folder in projectB and that is where the reference point. 所讨论的所有Dll都物理上位于projectB中的文件夹中,这是参考点的位置。 (I don't have the references pointing to the GAC) (我没有指向GAC的引用)

The dlls that copy correctly are Microsoft.Practices.Unity, Microsoft.Practices.Unity.Configuration and Microsoft.Practices.ServiceLocation. 正确复制的dll是Microsoft.Practices.Unity,Microsoft.Practices.Unity.Configuration和Microsoft.Practices.ServiceLocation。

The dlls that are not being copied correctly are Devart.Data, Devart.Data.Oracle and Devart.Data.Oracle.Design. 未正确复制的dll是Devart.Data,Devart.Data.Oracle和Devart.Data.Oracle.Design。

Here's the references for each dll... 这是每个dll的参考资料......

<Reference Include="Devart.Data, Version=5.0.124.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Devart.Data.dll</HintPath>
  <SpecificVersion>False</SpecificVersion>
  <Private>True</Private>
</Reference>
<Reference Include="Devart.Data.Oracle, Version=5.70.170.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Devart.Data.Oracle.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Devart.Data.Oracle.Design, Version=5.70.170.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Devart.Data.Oracle.Design.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Microsoft.Practices.ServiceLocation.dll</HintPath>
  <SpecificVersion>False</SpecificVersion>
  <Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Microsoft.Practices.Unity.dll</HintPath>
  <SpecificVersion>False</SpecificVersion>
  <Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\Dtn.PetroDex.Dal\ThirdPartyDlls\Microsoft.Practices.Unity.Configuration.dll</HintPath>
  <SpecificVersion>False</SpecificVersion>
  <Private>True</Private>
</Reference>

Anyone else having this issue? 还有谁有相同的问题吗? Am I doing this wrong? 我做错了吗? Thanks 谢谢

EDIT I opened a file monitor and watched where visual studio was loading the reference and for Unity it was getting the dlls from the location I specified. 编辑我打开了一个文件监视器,观察了visual studio加载引用的位置,对于Unity来说,它是从我指定的位置获取dll。 But, for the Devart dlls it's looking in the GAC! 但是,对于Devart dll来说,它正在寻找GAC! Could the Devart dlls be causing this somehow? Devart dlls能以某种方式造成这种情况吗?

I had a similar problem with external references. 我对外部引用有类似的问题。 The thing is that the unused libraries are not copied. 问题是未复制未使用的库。 Do you use the Devart libraries from your projectB? 您是否使用projectB中的Devart库? Any instance, inheritance, anything, ...?? 任何实例,继承,任何东西,......? Please try this: Instansiate some mock class from the three libraries in your projectB and recompile. 请尝试这样做:从projectB中的三个库中实现一些模拟类并重新编译。 It has worked for me. 它对我有用。 I would like get to the formal explanation. 我想得到正式的解释。

  1. right click on the referenced dlls and check if copy local is true. 右键单击引用的dll并检查copy local是否为true。
  2. you can also try readding your references once, this had resolved a similar problem for me when i had converted a VS2005 project to VS2008 project. 您也可以尝试读取您的引用一次,当我将VS2005项目转换为VS2008项目时,这解决了类似的问题。

The problem appears too when you have dlls that are dependencies of others. 当你的dll是其他人的依赖时,问题也会出现。 For example Microsoft.ApplicationServer.Caching.AzureClientHelper.dll is used internally by Microsoft.ApplicationServer.Caching.Client. 例如,Microsoft.ApplicationServer.Caching.AzureClientHelper.dll由Microsoft.ApplicationServer.Caching.Client在内部使用。 Even though I have copyLocal = True the helper assembly is not copied because it is not referenced anywhere directly in my code. 即使我有copyLocal = True,也不会复制帮助程序集,因为它不会直接在我的代码中的任何地方引用。 To avoid this problem you can make a private type variable like this : 要避免此问题,您可以创建一个私有类型变量:

Type dependsOnThisTypeOfAssembly = typeof(TypeFromDependentAssembly); 类型dependsOnThisTypeOfAssembly = typeof(TypeFromDependentAssembly);

This will make a reference to the type and the assembly will be copied locally while in the build process. 这将引用类型,并且在构建过程中将在本地复制程序集。

Set as Copy local doesnt work for me. 设置为复制本地不适合我。 The only thing that resolves (is unusable) is to reference some type contained in assembly. 唯一解决的问题(无法使用)是引用程序集中包含的某些类型。

If these DLLs are in a sub-directory for project B, make sure the "Copy Local" property for each reference is set to true. 如果这些DLL位于项目B的子目录中,请确保每个引用的“复制本地”属性设置为true。

Also, if the DLL files are included as files in your project, check the visual studio properties for the files themselves. 此外,如果DLL文件作为文件包含在项目中,请检查visual studio属性以查找文件本身。 The "Build Action" should be set to "None" and the "Copy to Output Directory" should be set to "Do not copy". “Build Action”应设置为“None”,“Copy to Output Directory”应设置为“Do not copy”。 EDIT: Simply having them as references with copy local = true will take care of the copying. 编辑:只需将它们作为副本local = true的引用将负责复制。

If these settings are different for the different DLLS, that could explain why some are being copied into the bin folder and others are not. 如果这些设置对于不同的DLLS是不同的,那么这可以解释为什么有些被复制到bin文件夹而有些则没有。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM