CCNet - 预构建任务 cmd.exe?

发布于 2024-09-30 11:50:38 字数 880 浏览 3 评论 0原文

在进行全新构建之前,我在 ccnet.config 文件中使用命令行预构建任务来删除工作目录的内容。

      <prebuild>
          <exec>
            <executable>%SYSTEM32%\cmd.exe</executable>
            <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
          </exec>
      </prebuild>    

问题是我收到错误:

System.IO.IOException:无法执行文件 [C:\CruiseControl\Working\cmd.exe]。

它似乎正在工作文件夹中寻找 cmd.exe。 所以我尝试添加 cmd.exe 的路径,如下所示:

     <prebuild>
          <exec>
            <executable>%SYSTEM32%\cmd.exe</executable>
            <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
          </exec>
      </prebuild>

任何帮助都会很棒吗?

Im using a command line prebuild task in the ccnet.config file to delete the contents of thw working directory before i do a clean build.

      <prebuild>
          <exec>
            <executable>%SYSTEM32%\cmd.exe</executable>
            <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
          </exec>
      </prebuild>    

The problem is I get an error:

System.IO.IOException: Unable to execute file [C:\CruiseControl\Working\cmd.exe].

it seems to be looking for cmd.exe in the working folder.
So I tried adding the path to cmd.exe instead as follows:

     <prebuild>
          <exec>
            <executable>%SYSTEM32%\cmd.exe</executable>
            <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
          </exec>
      </prebuild>

Any help would be great?

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

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

发布评论

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

评论(3

<逆流佳人身旁 2024-10-07 11:50:38

我找到了最初问题的答案:

我只需将 cleanCopy true 放入源代码控制块中即可。

      <sourcecontrol type="svn">                                            
        <trunkUrl>TRUNK-URL</trunkUrl>                
        <executable>SVN.EXE</executable>           
        <username>TEST</username>                                         
        <password>TEST</password> 
        <cleanCopy>true</cleanCopy>         
      </sourcecontrol>    

I have found the answer to my original question:

I simply had to put the cleanCopy true inside the sourcecontrol block.

      <sourcecontrol type="svn">                                            
        <trunkUrl>TRUNK-URL</trunkUrl>                
        <executable>SVN.EXE</executable>           
        <username>TEST</username>                                         
        <password>TEST</password> 
        <cleanCopy>true</cleanCopy>         
      </sourcecontrol>    
冷夜 2024-10-07 11:50:38

cmd.exe 所在的路径位于您的 %PATH% 环境变量中。不需要显式设置(在执行提示符下输入cmd即可验证):

<prebuild>
  <exec>
    <executable>cmd.exe</executable>
    <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
  </exec>
</prebuild>

至于目录使用问题。我认为您希望删除 C:\CruiseControl\Working 的子目录而不是整个working。也可能是 svn 或其他进程正在处理它。 运行会发生什么?

if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working"

如果直接在cmd中

The path where is located cmd.exe is in your %PATH% Environment variable. You don't need to explicitely set it (you can verify it by typing cmd in the execute prompt) :

<prebuild>
  <exec>
    <executable>cmd.exe</executable>
    <buildArgs>/c "if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working""</buildArgs>
  </exec>
</prebuild>

As for the directory use problem. I think you wish to delete a subdirectory of C:\CruiseControl\Working instead of the whole Working. It could also be that svn or another process is working on it. What happens if you run

if exist "C:\CruiseControl\Working" rd /s /q "C:\CruiseControl\Working"

directly in cmd?

巴黎夜雨 2024-10-07 11:50:38

我在块中的 cmd.exe 遇到同样的问题。我在 Source Gear Vault 的多源控制块中将 cleanCopy 设置为 true。除了将我的单行命令放入 .cmd 文件中之外,这里或其他任何地方都没有解决这个问题,但我宁愿不必为我需要从命令提示符运行的每一小行创建一个 .cmd。

I have the same problem with cmd.exe in a block. I have cleanCopy set to true in a multi source control block with Source Gear Vault. Nothing here or anywhere else has solved this problem other than putting my single line command into a .cmd file, but I would rather not have to create a .cmd for every little line I need to run from the command prompt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文