Page 1 of 1

How to apply value to Compiler variable at runtime?

Posted: Tue Jan 22, 2013 6:23 am
by chintanpatel7
Hello Installaware team,

I need to remove all hard coded source paths from my installaware setup code as per requirement.
Now as we cannot use msicode variables in source path of files I tried to use compiler variables:
For that I have created compiler variable which is used as command line argument at the time of build and used it as per following;

Code: Select all

Install Files #SOURCEPATH#\Bin\* to $BINPATH$, include subfolders


Now what I want to do is if one does not give value to this variable at the time of building, system should apply default path to this variable.
For this I have tried following code:

Code: Select all

[compiler if Variable SOURCEPATH Equals ]
Set Variable #SOURCEPATH# to $PROGRAMFILES$MyProject
[compiler end]


But Installaware gives me error in this code.

[Q.1] How can I assign value to compiler variable at run-time?

[Q.2] Also please let me know how can we apply Environment variable value to Compiler variable?

Thanks,
Chintan

Re: How to apply value to Compiler variable at runtime?

Posted: Sun Jan 27, 2013 11:36 pm
by chintanpatel7
Is there any update on this?

Waiting for your reply...

Thanks,
Chintan

Re: How to apply value to Compiler variable at runtime?

Posted: Mon Jan 28, 2013 6:08 am
by FrancescoT
Dear Chintan,

you can't initilaize a Compiler variable using an InstallAware script variable, because script variable are only resolved at runtime.

As reported with InstallAware documentation for "Install Files" command;
Provide the full or relative path to the files to install. Relative paths will be resolved relative to the project folder. These files must exist on your development system and therefore no runtime script variables are allowed in this field. Only a string literal may be used here, but wildcards, compiler variables, and environment variables are supported as part of the string literal. This field will be resolved at compile time to the actual files found on your system by the compiler. Check the Include subfolders if wildcards used checkbox to perform a recursive operation.


To assign a value to a compiler variable, you can enter its value from IA project settings IDE (SHIFT+CTRL+F11) or passing the value as command line option, if you use the "miabuild.exe" tool.

Alternatively, you can pass an environment variable directly with the "Install Files" command "Source Files" parameter, using the form; "%VARNAME%"

Hope this helps you.