How to apply value to Compiler variable at runtime?

Got a problem you cannot solve? Try here.
chintanpatel7
Posts: 21
Joined: Thu Feb 16, 2012 11:02 pm

How to apply value to Compiler variable at runtime?

Postby chintanpatel7 » Tue Jan 22, 2013 6:23 am

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
Last edited by chintanpatel7 on Mon Jan 28, 2013 3:18 am, edited 1 time in total.

chintanpatel7
Posts: 21
Joined: Thu Feb 16, 2012 11:02 pm

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

Postby chintanpatel7 » Sun Jan 27, 2013 11:36 pm

Is there any update on this?

Waiting for your reply...

Thanks,
Chintan

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

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

Postby FrancescoT » Mon Jan 28, 2013 6:08 am

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.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 110 guests