D3v*_*r0n 17 .net msbuild teamcity build .net-4.0
我一直在研究MSBuild,因为我需要自动化我的开发商店的构建.我能够轻松编写一个.BAT文件,该文件调用VS命令提示符并将我的MSBuild命令传递给它.这很有效,而且有点漂亮.
这是我的.BAT构建文件的内容:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
cd C:\Sandbox\Solution
msbuild MyTopSecretApplication.sln /p:OutputPath=c:\TESTMSBUILDOUTPUT /p:Configuration=Release,Platform=x86
pause
Run Code Online (Sandbox Code Playgroud)
^这很好但我现在需要为TeamCity CI使用MSBuild任务.我曾尝试编写一些MSBuild脚本,但我不能让它们工作相同.我在.BAT文件中使用的命令的等效构建脚本是什么?有任何想法吗?
我尝试过这样的东西,但没有成功(我知道这是错的):
<?xml version="1.0"?>
<project name="Hello Build World" default="run" basedir=".">
<target name="build">
<mkdir dir="mybin" />
<echo>Made mybin directory!</echo>
<csc target="exe" output="c:\TESTMSBUILDOUTPUT">
<sources>
<include name="MyTopSecretApplication.sln"/>
</sources>
</csc>
<echo>MyTopSecretApplication.exe was built!</echo>
</target>
<target name="clean">
<delete dir="mybin" failonerror="false"/>
</target>
<target name="run" depends="build">
<exec program="mybin\MyTopSecretApplication.exe"/>
</target>
Run Code Online (Sandbox Code Playgroud)
我只需要一个MSBuild XML构建脚本,它将Release模式的单个解决方案编译到指定的输出目录.有帮助吗?
Bri*_*ker 28
使用MSBuild任务构建传递所需属性的解决方案.
<?xml version="1.0" encoding="utf-8"?>
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0"
DefaultTargets="Build">
<PropertyGroup>
<OutputDir>c:\TESTMSBUILDOUTPUT</OutputDir>
</PropertyGroup>
<ItemGroup>
<ProjectToBuild Include="MySecretApplication.sln">
<Properties>OutputPath=$(OutputDir);Configuration=Release</Properties>
</ProjectToBuild>
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(ProjectToBuild)"/>
</Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31284 次 |
| 最近记录: |