使用CruiseControl.NET和MSBuild发布网站

时间:2013-03-19 22:14:16

标签: c# .net msbuild cruisecontrol.net publish

我正在尝试设置CruiseControl.NET以自动从SVN(VisualSVN_Server)下载新版本并将其发布到测试版目录。

这是关于MSBuild的CruiseControl.NET配置文件:

<msbuild>
    <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
    <workingDirectory>C:\CI\WORKING</workingDirectory>
    <projectFile>WashMyCarHomepage\WashMyCarHomepage.csproj</projectFile>
    <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag /p:WebProjectOutputDir=C:\inetpub\wwwroot.beta</buildArgs>
    <targets>Build;Test</targets>
    <timeout>900</timeout>
    <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
  </msbuild>

CruiseControl.NET成功运行MSBuild,但MSBuild失败并显示:

standard-error stream closed -- null received in event
standard-output stream closed -- null received in event
process exited event received

我还试图从控制台手动运行MSBuild以尝试它是否单独工作。但我无法获得正确的输出(可在网上发布)。我试过了:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild.exe C:\CI\WORKING\WashMyCarHomepage\WashMyCarHomepage.csproj /property:OutDir=C:/CI/TEST;Configuration=Release /t:Publish

但该项目被“跳过不可发布的项目”所忽略。

我有一个以下解决方案的结构:

WashMyCarHomepage\WashMyCarHomepage.sln
WashMyCarHomepage\Repository\Repository.csproj
WashMyCarHomepage\WashMyCarHomepage\WashMyCarHomepage.csproj

如何解决此问题?

1 个答案:

答案 0 :(得分:2)

经过长期的斗争,我确实找到了解决方案。 我提供了整个CruiseControl.NET配置文件。

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
  <project name="Aucis">
    <workingDirectory>C:\CI\WORKING</workingDirectory>
    <artifactDirectory>C:\CI\BUILD</artifactDirectory>
    <triggers>
      <intervalTrigger name="CI Trigger" seconds="120" buildCondition="IfModificationExists"/>
    </triggers>
    <tasks Name="Clean">
      <msbuild>
        <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>C:\CI\WORKING</workingDirectory>
        <projectFile>WashMyCarHomepage\WashMyCarHomepage.csproj</projectFile>
        <buildArgs>/p:OutputPath=bin /P:Configuration=Deploy-Dev /P:DeployOnBuild=True /P:DeployTarget=MSDeployPublish /P:MsDeployServiceUrl=localhost /P:AllowUntrustedCertificate=True /P:MSDeployPublishMethod=WMSvc /P:CreatePackageOnPublish=True /P:UserName=WindowsUsername/P:Password=WindowsPassword</buildArgs>
        <timeout>900</timeout>
        <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
      </msbuild>
    </tasks>
    <sourcecontrol type="svn">
      <executable>C:\Program Files (x86)\VisualSVN Server\bin\svn.exe</executable>
      <trunkUrl>https://localhost:8443/svn/project/trunk</trunkUrl>
      <username>svn_username</username>
      <password>svn_password</password>
      <autoGetSource>true</autoGetSource>
      <cleanCopy>true</cleanCopy>
      <revisionNumbers>true</revisionNumbers>
      <tagBaseUrl>https://localhost:8443/svn/project/tags</tagBaseUrl>
    </sourcecontrol>
  </project>
</cruisecontrol>

请注意,“Deploy-Dev”是在VisualStudio中设置的配置。