我在命令行和CruiseControl.NET上使用的MSBUILD存在一些问题,因为结果不同,我不明白为什么会这样。
调用MSBUILD在我的本地机器上的命令行上,项目构建完成,输出目录包含一堆DLL和PDB文件以及一个名为_PublishedWebsites的子目录,其中包含我的解决方案中的两个Web应用程序(ASP.NET MVC)应用程序和WCF Web服务)。
到目前为止一切顺利。
在CI服务器上,未创建此文件夹。
这两个用于两者的msbuild项目文件是相同的,所以我看不出可能有什么区别。经过几个小时的谷歌搜索,我现在完全失去了。
我假设我的本地计算机上的环境中有一些东西设置了CI服务器上不存在的默认位置。
是否有任何特定选项我必须设置某个地方明确告诉MSBUILD创建一个包含已发布的Web应用程序的文件夹?
更新 CCNET.config(部分)
<cruisecontrol>
<!-- Other projects here -->
<project name="My-Project Nightly Build">
<workingDirectory>C:\CruiseControl\My-Project-Nightly</workingDirectory>
<artifactDirectory>C:\CruiseControlArtifacts\My-Project-Nightly</artifactDirectory>
<sourcecontrol type="multi">
<sourceControls>
<vsts>
<executable>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe</executable>
<project>$/Brand Web/</project>
<autoGetSource>true</autoGetSource>
<applyLabel>true</applyLabel>
<cleanCopy>true</cleanCopy>
<deleteWorkspace>true</deleteWorkspace>
<server>http://company-tfs:8080/tfs/Projects</server>
<workingDirectory>C:\CruiseControl\My-Project-Nightly\Brand Web\</workingDirectory>
<workspace>Brand-Nightly</workspace>
</vsts>
<vsts>
<executable>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe</executable>
<project>$/Brand/Main</project>
<autoGetSource>true</autoGetSource>
<applyLabel>true</applyLabel>
<cleanCopy>false</cleanCopy>
<server>http://company-tfs:8080/tfs/Projects</server>
<workingDirectory>C:\CruiseControl\My-Project-Nightly\Brand\Main</workingDirectory>
<workspace>Brand-Nightly</workspace>
</vsts>
<vsts>
<executable>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe</executable>
<project>$/Generic</project>
<autoGetSource>true</autoGetSource>
<applyLabel>true</applyLabel>
<cleanCopy>false</cleanCopy>
<server>http://company-tfs:8080/tfs/Projects</server>
<workingDirectory>C:\CruiseControl\My-Project-Nightly\Generic</workingDirectory>
<workspace>Brand-Nightly</workspace>
</vsts>
<vsts>
<project>$/ComponentA</project>
<executable>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe</executable>
<autoGetSource>true</autoGetSource>
<applyLabel>true</applyLabel>
<cleanCopy>false</cleanCopy>
<server>http://company-tfs:8080/tfs/Projects</server>
<workingDirectory>C:\CruiseControl\My-Project-Nightly\ComponentA</workingDirectory>
<workspace>Brand-Nightly</workspace>
</vsts>
<vsts>
<project>$/Third Party Libraries</project>
<executable>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe</executable>
<autoGetSource>true</autoGetSource>
<applyLabel>true</applyLabel>
<cleanCopy>false</cleanCopy>
<server>http://company-tfs:8080/tfs/Projects</server>
<workingDirectory>C:\CruiseControl\My-Project-Nightly\Third Party Libraries</workingDirectory>
<workspace>Brand-Nightly</workspace>
</vsts>
</sourceControls>
</sourcecontrol>
<labeller type="defaultlabeller">
<prefix>Brand-</prefix>
</labeller>
<triggers>
<scheduleTrigger time="02:15" buildCondition="ForceBuild" name="BrandNightlyBuild">
</scheduleTrigger>
</triggers>
<tasks>
<msbuild>
<executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<projectFile>C:\CruiseControl\My-Project-Nightly\Brand Web\Main\Build\Nightly.build</projectFile>
<buildArgs>/p:Configuration=Debug /p:Platform=x86 /p:TargetFramework=4.0 /p:OutputPath=C:\CruiseControl\My-Project-Nightly\output\</buildArgs>
<timeout >360000</timeout>
</msbuild>
</tasks>
</project>
</cruisecontrol>
答案 0 :(得分:1)
我们这样做了。我们创建了两个配置文件。
第一个配置文件
<msbuild>
<executable>
C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
</executable>
<workingDirectory>
Project dorecotry
</workingDirectory>
<projectFile>
Path to second config file
</projectFile>
<timeout>600</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
第二个配置文件将发布代码。
第二个配置文件
<Project
xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
name = "AspNetPreCompile"
DefaultTargets = "PrecompileWeb">
<Target Name = "PrecompileWeb">
<AspNetCompiler
VirtualPath = "DeployTemp"
PhysicalPath = "Path of project file"
TargetPath = "Path of published code"
Force = "true"
Debug = "true"
Updateable = "true"/>
</Target>
</Project>
请查看blog