.net - 如何将 2 个参数传递给 Nant 脚本?

标签 .net ant build-automation nant

我必须编写一个 Nant 脚本,该脚本将在命令行上接受 2 个参数。第一个只是一个选项,格式如下:-myOption。第二个需要用引号括起来:“一些带有空格的值”。

例如-myOption "这个值"

我是 Nant 的新手,所以到目前为止我没有成功,也不知道如何输出命令进行调试。

这是我到目前为止:

<target name="Build" depends="SetupConfig">
<exec workingdir="${refactory.basedir}" program="${exe.name.mfg.factory}" basedir="${refactory.basedir}" commandline="-myOption:">  
 <arg>${refactory.clientconfig}</arg>   
</exec>

我正在尝试使用“命令行”属性和 args 嵌套元素创建命令。 args 元素应该提供 qoutes。

有人能告诉我这应该怎么看吗?谢谢。

最佳答案

我需要承认,看着你的代码片段,我并不完全清楚,你想要实现什么。

无论如何,这就是您将两个参数传递给 NAnt 脚本的方式(您对问题的标题所声称的内容):

给定一个 NAnt 脚本 example.project.build具有以下内容:

<?xml version="1.0"?>
<project name="example.project" default="example.target" basedir=".">
  <target name="example.target">
    <echo message="${arg.option}" />
    <echo message="${arg.whitespace}" />
  </target>
</project>

...你会打电话
nant -buildfile:example.project.build -D:arg.option=foo -D:arg.whitespace="bar and bar"

... 执行脚本 example.project.build并传递参数 arg.optionarg.whitespace到它。

关于.net - 如何将 2 个参数传递给 Nant 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2273502/

相关文章:

.net - 我应该如何访问 ViewModel 的底层实体/模型

c# - 简单的 C# Xml 序列化

testing - 在 Teamcity 构建运行期间指定 ant 目标

java - Maven 2 的最佳企业存储库工具?

python - 从 python 启动 VS2008 构建

.net - 如何在网页上实现文件上传进度条?

.net - AutoMapper AssertConfiguration 在编译时?

java - 包是否需要放在 jar 中才能用于 ant 构建脚本

eclipse - 在 Eclipse 之外运行 P2 Ant 任务

visual-studio-2017 - 从命令行卸载 Visual Studio 2017 安装程序