在CruiseControl.NET获取最新版本之前停止Windows服务

时间:2010-07-06 13:32:32

标签: cruisecontrol.net

我正在试图弄清楚如何在CruiseControl.NET项目最新之前运行一个停止Windows服务的bat文件,因为它将失败说文件正在使用中(由运行的Windows服务。)我无法弄清楚如何在最新的任务之前运行任务,因为源控制块不是任务,它直接位于项目节点下。

<project name="projectname" queue="queuename" queuePriority="1">
    <workingDirectory>C:\Build</workingDirectory>
    <category>companyname</category>
    <webURL>http://ip/ccnet/server/local/project/projectname/ViewProjectReport.aspx</webURL>
    <triggers>
      <intervalTrigger seconds="60" />
    </triggers>
    <modificationDelaySeconds>60</modificationDelaySeconds>
    &sc;
    <tasks>
      <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
        <workingDirectory>C:\Build\Web\H4</workingDirectory>
        <projectFile>solution.sln</projectFile>
        <buildArgs>/v:quiet /noconlog /p:Configuration=Debug</buildArgs>
        <targets>Build</targets>
        <timeout>900</timeout>
        <logger>C:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
      </msbuild>
      <exec>
        <executable>deleteTestResults.bat</executable>
        <baseDirectory>C:\Build\Test\TestCases\H4Test</baseDirectory>
        <buildArgs></buildArgs>
        <buildTimeoutSeconds>30</buildTimeoutSeconds>
      </exec>
      <exec>
        <executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
        <baseDirectory>C:\Build\Test\TestCases\</baseDirectory>
        <buildArgs>/testcontainer:testproject\bin\debug\testproject.dll /runconfig:localtestrun.Testrunconfig /resultsfile:H4Test\testResults.trx</buildArgs>
        <buildTimeoutSeconds>900</buildTimeoutSeconds>
      </exec>
    </tasks>
    <publishers>
      <merge>
        <files>
          <file>C:\Build\Test\TestCases\testproject\testResults.trx</file>
        </files>
      </merge>
      <xmllogger logDir="C:\Program Files\CruiseControl.NET\Logs\companyname\projectname\" />
    </publishers>
  </project>

非常感谢任何帮助,谢谢, 贾斯汀

1 个答案:

答案 0 :(得分:2)

你不能在msbuild任务之前添加一个新的exec: 即。

<tasks>     
    <exec>
        <executable>StopMyServices.bat</executable>
        <baseDirectory>C:\Build\Test\TestCases\H4Test</baseDirectory>
        <buildArgs></buildArgs>
        <buildTimeoutSeconds>30</buildTimeoutSeconds>
    </exec>
    <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
        <workingDirectory>C:\Build\Web\H4</workingDirectory>
        <projectFile>solution.sln</projectFile>
        <buildArgs>/v:quiet /noconlog /p:Configuration=Debug</buildArgs>
        <targets>Build</targets>
        <timeout>900</timeout>
        <logger>C:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
    </msbuild>
    <exec>
        <executable>deleteTestResults.bat</executable>
        <baseDirectory>C:\Build\Test\TestCases\H4Test</baseDirectory>
        <buildArgs></buildArgs>
        <buildTimeoutSeconds>30</buildTimeoutSeconds>
    </exec>
    <exec>
        <executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
        <baseDirectory>C:\Build\Test\TestCases\</baseDirectory>
        <buildArgs>/testcontainer:testproject\bin\debug\testproject.dll /runconfig:localtestrun.Testrunconfig /resultsfile:H4Test\testResults.trx</buildArgs>
        <buildTimeoutSeconds>900</buildTimeoutSeconds>
    </exec>
</tasks>