使用 xcopy 命令的 Visual Studio BeforeBuild

发布于 2024-10-09 02:51:09 字数 371 浏览 0 评论 0原文

我正在使用以下 beforebuild 目标,这工作正常:

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy ..\mycomponent\mylateboundassembly\bin\debug\*.* bin /q /r /y">
  </Target>

但是,当文件夹 mycomponent (我的组件)中有一个我无法删除(遗留代码)的空格时,我无法让 xcopy 工作

任何人都知道在 beforebuild 中使用 xcopy 的方法路径有空格吗? 谢谢

I am using the following beforebuild target and this works fine:

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy ..\mycomponent\mylateboundassembly\bin\debug\*.* bin /q /r /y">
  </Target>

however when the folder mycomponent has a space in it (my component) which i cannot remove(legacy code), I cannot get xcopy to work

Anyone know a way use xcopy in beforebuild where paths have a space?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画骨成沙 2024-10-16 02:51:09

我通过执行以下操作使其工作:
将项目添加到属性组(测试)

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        .....
    <Test>"..\x space\ClassLibrary2"</Test>
  </PropertyGroup>

然后在 Exec 命令中使用属性组项目

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy $(Test)\bin\Debug\*.* bin /q /r /y">
    </Exec>
  </Target>

I got this to work by performing the following:
Add an item to the property group (test)

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        .....
    <Test>"..\x space\ClassLibrary2"</Test>
  </PropertyGroup>

Then in Exec command use the property group item

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy $(Test)\bin\Debug\*.* bin /q /r /y">
    </Exec>
  </Target>
荒人说梦 2024-10-16 02:51:09

在文件路径两边加引号。

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy \"..\mycomponent\mylateboundassembly\bin\debug\*.*\" bin /q /r /y">
</Target>

Put quotes around the file path.

<Target Name="BeforeBuild" Condition=" $(Configuration) == 'Debug' ">
    <Exec Command="xcopy \"..\mycomponent\mylateboundassembly\bin\debug\*.*\" bin /q /r /y">
</Target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文