开发者

CCNet - prebuild task cmd.exe?

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 wo开发者_Python百科rking 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?


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>    


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜