MSBuild无法将程序集.dll文件复制到$(OutDir)

时间:2014-11-02 14:07:12

标签: c# visual-studio msbuild-task

在构建简单的C#项目(其中只定义了一个简单类) 没有功能方法)我收到下一条错误消息:

“C:\ Program Files(x86)\ MSBuild \ 12.0 \ bin \
Microsoft.Common.CurrentVersion.targets(3528,5):错误MSB3024:
无法复制文件“obj \ x86 \ Debug \ G4S_CVisitDescr.dll”
到目标文件“.......... \ Projects \ Server \ Debug \ G4S_CVisitDescr.dll”,
因为目的地是文件夹而不是文件 要将源文件复制到文件夹中,请考虑使用DestinationFolder
参数而不是DestinationFiles。“

此错误消息很奇怪,因为在相关的片段中 建议使用.targets文件目标参数复制任务 在消息DestinationFolder中!这个片段(其中行"<Copy"
错误消息中指出的编号为3528的文件放在下面:

<!-- Copy the build product (.dll or .exe). -->
<Copy
    SourceFiles="@(IntermediateAssembly)"
    DestinationFolder="$(OutDir)"
    SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
    OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
    Retries="$(CopyRetryCount)"
    RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
    UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
    Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' !=                 'true'">
    <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
    <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>

同样项目的另一个类似项目也很奇怪 构建文件和相同的项目属性没有任何错误。 “坏”
如果由于调用了建筑物,那么项目也可以毫无错误地建造 方法Solution2.SolutionBuild.BuildProject与之前的调用
Solution2.SolutionBuild.Clean方法或“OutputPath”属性
在手动调用下具有默认值“bin \ x86 \ Debug”(因为,
也许,在这种情况下不进行复制)。

所以,我还有两个问题:

1)我应该如何理解错误以及如何解决错误(如果可能的话)?

2)类似项目之间的哪些差异可能会导致错误?

任何想法都将不胜感激。

  Lebyko

0 个答案:

没有答案
相关问题