在Visual Studio中,MSBuild不会复制DLL

abe*_*nci 3 msbuild visual-studio-2010 tfs2010

在我们的Visual Studio 2010的项目中,我们参考-其他人之间-的SmartAssembly.Attributes.dll,它的正确复制到Bin/DebugBin/Release我们的本地开发机的文件夹中.在构建服务器上,这适用于所有其他引用,但不适用于"SmartAssembly.Attributes.dll".构建成功.

我该怎么检查?

谢谢.

Die*_*ego 6

打开.csproj文件(或.vbproj文件),然后查找程序集引用.然后确保提示路径在构建服务器中仍然有效.有时VS2010会添加一个绝对提示路径,而不是使用一个相对于.csproj文件本身的路径,因此驱动器号可能在另一台机器中无效.

例如,基准可能类似于下面的一个(我做了所有的XML下面只说明它不是有效的),并且绝对暗示路径可能是在构建服务器无效(如没有盘符d有):

<Reference
Include="SmartAssembly.Attributes, Version=8.0.0.0, 
       Culture=neutral, PublicKeyToken=b03f1f7f1ad5da3a,
       processorArchitecture=x86"> 
  <SpecificVersion>False</SpecificVersion>
  <Private>true<Private>

  <!-- The HintPath below should exist and be valid in your build server -->
  <HintPath>d:\temp\SmartAssembly.Attributes.dll<HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)

您可以更改HintPath以使其相对于.csproj文件,因此更通用.例如:

  <HintPath>..\libs\SmartAssembly.Attributes.dll<HintPath>
Run Code Online (Sandbox Code Playgroud)

另一个问题可能<Private>true<Private>是那里不存在.此属性映射到CopyLocalVisual Studio中的属性,因此如果您的属性中缺少.csproj该DLL,则不会将DLL复制到MSBuild bin\Debugbin\Release由MSBuild 复制.见http://bronumski.blogspot.com/2009/06/project-reference-fun-and-games.html