简体   繁体   中英

Cannot get environment variable in Inno Setup preprocessor, when executed in Docker

Locally environment variable is printed well:

bash-3.2$ echo $APP_VERSION
2.0.3

But when I try to get this environment variable in my Inno Setup file, it behaves like this environment variable doesn't exist:

Error in Z:\work\inno\app-win-x64.iss: The [Setup] section must include an AppVersion or AppVerName directive.
Compile aborted.

This is how I use it:

#define MyAppVersion GetEnv('APP_VERSION')
// ....
[Setup]
AppVersion={#MyAppVersion}
// ....

Environment:

  • Inno Setup 6.0.5
  • OS: MacOS Catalina 10.15.6
  • Running with the command below in bash .
docker run --rm -i -v "$PWD:/work" amake/innosetup inno/app-win-x64.iss

Ok, guys, I have found the cause of this problem. The problem is that I work on Mac and to compile Inno Setup I use the following command:

docker run --rm -i -v "$PWD:/work" amake/innosetup inno/app-win-x64.iss

But I forgot to pass environment variable to the container. So, all what I need is to pass APP_VERSION to docker run command. This works for me:

docker run --env APP_VERSION=$APP_VERSION --rm -i -v "$PWD:/work" amake/innosetup inno/app-win-x64.iss

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM