从蚂蚁将参数传递给NSIS [英] Passing parameters to NSIS from Ant

查看:223
本文介绍了从蚂蚁将参数传递给NSIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个调用MakeNSIS并成功创建一个安装程序文件的现有Ant脚本。我希望输出路径中蚂蚁被改变,然后一起NSIS通过。目前,我已经打过电话NSIS是这样的:

I have an existing Ant script that calls MakeNSIS and successfully creates an installer file. I want the output path to be changed within Ant, and then passed along to NSIS. Currently, I have tried calling NSIS in this way:

    <exec executable="${nsis_exe.dir}/makensis.exe">
        <arg value="${installer.dir}/installer.nsi" />
        <arg value="/DTEST=myvalue"/>
        <arg value="/DBUILD_VERSION_LABEL=${build.version.label}"/>
    </exec>

但我一直没能找回在NSI文件此值。我不能使用解决方案,因为我想要使用的参数文件的命令,这需要一个符号,不是一个变量,才能正常工作。

But I have not been able to retrieve this value in the nsi file. I cannot use this solution because I want to use the parameter in the File command, which requires a symbol, not a variable, to work correctly.

我用我的NSI文件以下内容:

I'm using the following in my nsi file:

DetailPrint ${TEST}
DetailPrint ${DTEST}
DetailPrint ${BUILD_VERSION_LABEL}
File /r "C:\DTU\Build\${BUILD_VERSION_LABEL}\*" 

和我收到的错误是:

[exec] warning: unknown variable/constant "{TEST}" detected, ignoring (../Solution/third_party/NSIS_Build/dtu_installer.nsi:184)
[exec] DetailPrint: "${TEST}"
[exec] warning: unknown variable/constant "{DTEST}" detected, ignoring (../Solution/third_party/NSIS_Build/dtu_installer.nsi:185)
[exec] DetailPrint: "${DTEST}"
[exec] warning: unknown variable/constant "{BUILD_VERSION_LABEL}" detected, ignoring (../Solution/third_party/NSIS_Build/dtu_installer.nsi:186)
[exec] DetailPrint: "${BUILD_VERSION_LABEL}"
[exec] File: Returning to: "C:\DTU\Build\${BUILD_VERSION_LABEL}"
[exec] File: "C:\DTU\Build\${BUILD_VERSION_LABEL}\*" -> no files found.

任何想法,我可以使用或我在做什么错了?

Any ideas what I could use or what I'm doing wrong?

推荐答案

我是我的参数的顺序问题。我在我的Ant脚本中的以下内容:

The issue I had was the order of my arguments. I had the following in my ANT script:

<exec executable="${nsis_exe.dir}/makensis.exe">
        <arg value="${installer.dir}/installer.nsi" />
        <arg value="/DTEST=myvalue"/>
        <arg value="/DBUILD_VERSION_LABEL=${build.version.label}"/>
</exec>

但显然我不能看到NSI文件/ D参数这种方式。如果我改变它,因此NSI文件是最后一个参数,它的工作原理:

But apparently I cannot see the /D parameters in the nsi file this way. If I change it so the nsi file is the last parameter, it works:

<exec executable="${nsis_exe.dir}/makensis.exe">
        <arg value="/DTEST=myvalue"/>
        <arg value="/DBUILD_VERSION_LABEL=${build.version.label}"/>
        <arg value="${installer.dir}/installer.nsi" />
</exec>

然后我就可以访问该参数在NSI文件,因为我是:

Then I can access the parameters in the nsi file as I was:

DetailPrint ${TEST}
DetailPrint ${BUILD_VERSION_LABEL}
File /r "C:\DTU\Build\${BUILD_VERSION_LABEL}\*"

这篇关于从蚂蚁将参数传递给NSIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆