gpt4 book ai didi

msbuild - xcopy 与 MsBuild

转载 作者:行者123 更新时间:2023-12-01 04:04:17 24 4
gpt4 key购买 nike

我有一个非常简单的构建脚本,如下所示:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Bundle">

<ItemGroup>
<BuildArtifacts Include="..\_buildartifacts" />
<Application Include="..\_application" />
</ItemGroup>

<Target Name="Clean">
<RemoveDir Directories="@(BuildArtifacts)" />
<RemoveDir Directories="@(Application)" />
</Target>

<Target Name="Init" DependsOnTargets="Clean">
<MakeDir Directories="@(BuildArtifacts)" />
<MakeDir Directories="@(Application)" />
</Target>

<Target Name="Bundle" DependsOnTargets="Compile">
<Exec Command="xcopy.exe %(BuildArtifacts.FullPath) %(Application.FullPath) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" WorkingDirectory="C:\Windows\" />
</Target>

问题是 Bundle 目标,只有 %(BuildArtifacts.FullPath)被提取, %(BuildArtifacts.FullPath)脚本执行时被忽略。

执行时命令如下所示:

xcopy.exe C:\@Code\blaj_buildartifacts /e /EXCLUDE:C:\@Code\blaj\files_to_ignore_when_bundling.txt" exited with code 4

如您所见,目标路径不存在,如果我对路径进行硬编码或仅对目标路径进行硬编码,则一切正常。关于我在这里做错了什么的任何建议?

更新
我设法解决了问题,我删除了最后一部分 WorkingDirectory="C:\Windows\"并将脚本更改为:
<Exec Command="xcopy.exe @(BuildArtifacts) @(Application) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" />

现在它正在工作:)

最佳答案

我设法解决了这个问题。我已经用解决方案更新了问题。

我删除了最后一部分 WorkingDirectory="C:\Windows\"并将脚本更改为:

 <Exec Command="xcopy.exe @(BuildArtifacts) @(Application) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" />

现在它正在工作:)

关于msbuild - xcopy 与 MsBuild,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10514858/

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