【发布时间】:2017-02-14 15:50:03
【问题描述】:
我正在使用 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>
错误:意外的标记“标点符号”。 表达式:${environment::get-variable('env.solution.path')} 任何帮助都会很棒。谢谢
【问题讨论】:
-
看起来它可能就像您使用的引号一样简单,除非这只是复制粘贴错误 - 您的
get-variable参数应该用简单的单引号括起来:${environment::get-variable('env.solution.path')} -
这只是复制粘贴错误:[15:59:54][NAnt output] 表达式:${environment::get-variable('env.solution.path')} [15:59 :54][NAnt 输出]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ [15:59:54][NAnt output] 环境变量“env.solution.path”不存在。
-
请注意,您现在遇到了另一个错误。
-
嗨,詹姆斯,我尝试了不同的引号,但没有成功。