gpt4 book ai didi

c# - 来自 .csproj 文件的 MSBuild 任务

转载 作者:行者123 更新时间:2023-11-30 17:21:29 24 4
gpt4 key购买 nike

我正在尝试向我的 csproj 添加一个 Post Build MSBuild 事件来执行此操作我正在尝试从 .csproj 文件中的 Afterbuild 目标内部调用 MSBuild 任务

  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
Other similar extension points exist, see Microsoft.Common.targets.-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
<Message Text="Copying Files" />
<MSBuild Projects="post.build"
Targets="Copy"
ContinueOnError="false" />
</Target>

这就是 post.build 文件。

 <Project DefaultTargets="Copy"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Copy">
<Message Text="Copying Files inside COPY" />
<CallTarget Targets="CopyToProfile"/> </Target>
</project>

似乎 csproj 无法调用 MSbuild 任务,任何人都可以建议这里可能出了什么问题。我得到错误

error MSB4057: The target "Copy" does not exist in the project.

最佳答案

所以我最终得到的工作是。

我按照 Martin 的建议做了并且

<Import Project="post.build"/>

但是,MSBuild 任务仍未按计划运行。所以我最终使用了

<CallTarget Targets="copy"/>

跨文件调用。这听起来像是 VS2008 中的限制,在 VS2010 中已修复。

关于c# - 来自 .csproj 文件的 MSBuild 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3394276/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com