我正在使用TeamCity使用Nant脚本构建.Net解决方案,如果我对解决方案路径进行编码,一切正常。我想使用TeamCity(env。)中的环境变量作为解决方案路径 - > env.solution.path ----- C:\ a \ testteamcity \ Demo \ deptest.sln在Nant脚本test.build中文件:
<?xml version="1.0"?>
<project name ="first Nant file" default="compile-solution" >
<property name="bin.folder.svn" value="C:\a\testteamcity\Demo\bin123"/>
<property name="bin.folder.sln" value="C:\cicheckout\webapp\bin"/>
<target name="compile-solution">
<exec program="C:\Program Files (x86)\MSBuild\12.0\Bin\Msbuild.exe" verbose="true" >
<arg line="${environment::get-variable('env.solution.path')}" />
<arg value="/p:Configuration=Release" />
</exec>
<copy todir="${bin.folder.sln}" overwrite="true" failonerror="true">
<fileset basedir="${bin.folder.svn}">
</fileset>
</copy>
</target>
</project>
错误:意外的令牌&#39;标点&#39;。 表达式:$ {environment :: get-variable('env.solution.path')} 任何帮助都会很棒。谢谢
答案 0 :(得分:0)
创建system.solution.path - &gt;在Teamcity和Nant脚本中的系统属性(system。)下的C:\ a \ testteamcity \ demo \ deptest.sln - &gt;
<?xml version="1.0"?>
<project name ="Build-Solution" default="build-solution" >
<property name="solution.path" value="${system.solution.path}" dynamic="true" unless="${property::exists('solution.path')}"/>
<!-- Build solution -->
<target name="build-solution">
<exec program="C:\Program Files (x86)\MSBuild\12.0\Bin\Msbuild.exe" verbose="true" >
<arg line="${solution.path}" />
<arg value="/p:Configuration=Release" />
</exec>
</target>
</project>