Inno Setup中的自定义命令行参数具有默认值,因此我可以通过构建配置 [英] Custom command line parameter in Inno Setup with default value so I can pass build configuration

查看:55
本文介绍了Inno Setup中的自定义命令行参数具有默认值,因此我可以通过构建配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Inno Setup .iss文件为.NET项目创建安装程序.
我想默认安装程序版本使用Debug版本输出路径,以便开发人员可以创建本地安装程序进行测试,但是我希望能够将参数传递给Inno编译器,以告诉它在执行操作时使用Release输出路径.正确的生产方式.

根据我的收集,我无法向 [Setup] 部分添加自定义变量,因为我尝试过

  [设置]Config = {param:config | Debug} 

此SO答案中所述,但我明白了

无法识别的[Setup]节指令"Config"

因此,在我看来,唯一的选择是在 #define 部分中添加一些内容.

我看到可以在命令行使用/Dparamname = value 定义参数.因此,我按照,则在命令行中传递/DConfig = Release 不会覆盖Debug值./p>

那么有什么好办法可以做我想要的事情,在命令行中如果没有传递任何东西,我可以使用默认值运行编译,并且在可用时使用命令行值?
还是有一种我更缺少的更简单的方法来做到这一点.

当前,我的命令行调用如下所示:
iscc path \ to \ my \ iss \ file/DConfig = Release

我正在使用Inno Setup 5.5.9.

使用 #ifndef :

  #ifndef配置#define配置调试"#万一 

I'm working with an Inno Setup .iss file to create an installer for a .NET project.
I want to default the installer build to use the Debug build output paths so devs can create local installer for testing, but I want to be able to pass a parameter to the Inno compiler to tell it to use the Release output paths instead when doing a proper production build.

From what I can gather I can't add a custom variable to the [Setup] section, because I tried

[Setup]  
Config = {param:config|Debug}

as described in this SO answer, but I get

Unrecognized [Setup] section directive "Config"

So it appears to me that the only option is to have something in the #define section.

I see that it's possible to define parameters at the command line with /Dparamname=value. So I tried the {param:Config|Debug} and {param:#Config|Debug} as suggested in this answer, but again I get compiler errors:

Unknown filename prefix "..\project\bin\{param:"

And if I #define Config "Debug" in the iss file then passing /DConfig=Release at the command line doesn't override the Debug value.

So is there any neat way to do what I want, where I can run the compile with a default value if nothing is passed into the command line, and use the command line value if it's available?
Or is there an altogether easier way to do this that I'm missing.

Currently my command line call looks like this:
iscc path\to\my\iss\file /DConfig=Release

I'm using Inno Setup 5.5.9.

解决方案

Use the #ifndef:

#ifndef Config
#define Config "Debug"
#endif

这篇关于Inno Setup中的自定义命令行参数具有默认值,因此我可以通过构建配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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