cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Greg_R
Level 4

Path Environment Variables - Recognition Trouble

Hi all,

I'm having trouble getting the path environment variables that I specified in the "Path Variables" tab to be recognized. I'm attempting to get two path environment variables working so that I can build my installer on a build machine that has different paths to the files than my machine. Eventually, the build machine is going to use Visual Build Pro to automate the build process. After searching the forums for similar trouble, I couldn't find anything that could help me.

So, the two path environment variables that I'm creating are PATH_TO_TOOL_FILES and PATH_TO_DISCFINALIZE_FILES. In the "Path Variables" tab, I've specified the Name, Defined Value, and subsequently the Current Value of the variables to all be PATH_TO_TOOL_FILES and PATH_TO_DISCFINALIZE_FILES respectively for each (no % decorations anywhere). I set the actual environment variables values using My Computer's Properties, going to the Advanced tab, and then opening the "Environment Variables" window. I've tried setting the variables as both user and system variables without success.

Also, I saw that another post mentioned that the project needed to be completely closed and reopened for the variables to take effect, so I've tried doing that. However, the environment variables are still not recognized.

If I switch the two path variables' type from Environment to Standard with the values that I've specified in the actual environment variables, the file paths are recognized.

Am I doing something wrong? Thank you in advance for your help.

Greg
Labels (1)
0 Kudos
(22) Replies
Chikura
Level 3

in general path variables are not recognized, if the "Define value" field is empty in the PATH VARIABLES view,,,,

Also, may be u can try following:
1) create env variables-> restart->then open ism file
2) the "Current Value" column for Environement path variable type will have its value as ". if u r changing it,,dont change that,,
3) Just go and verify the ISPathVariable table and try to find if something is wrong overthere???
0 Kudos
Greg_R
Level 4

Hi Chikura. Thank you for your assistance.

I tried restarting my computer and the environment variables are working now. So it seems like I have to restart my computer every single time I change the value of the environment variables now. This seems like a major barrier for me trying to setup the automatic build machine to run every day since the location of these paths will likely change every day.

Is there a way to just set path variables through the command-line instead? Or can I set the path variables externally (i.e., not in the IDE) any other way?

Thanks for all the help!

Greg
0 Kudos
RobertDickau
Flexera Alumni

With InstallShield 2008, I believe you can use the -l (lowercase L) switch to iscmdbld.exe to set a path variable on the command line for the sake of a particular build (it doesn't change the project file).
0 Kudos
Greg_R
Level 4

Hi Robert, thank you for the help.

Are you not able to do this with IsSABuild.exe? I was attempting to do the -l command line argument through Visual Build Pro (a glorified batch building tool) and it was giving me errors saying that it didn't recognize it as a valid argument. I need to use IsSABuild.exe on the build machine since I only have the one full license which I am using to run the IDE and modify my project.

Thanks for the help!

Greg
0 Kudos
RobertDickau
Flexera Alumni

Hi, Greg,

I don't have a copy of the standalone build at hand, but if you manually run IsSaBld.exe with no arguments, is -l in the usage message? My understanding is that the same arguments should be supported in IsCmdBld and IsSaBld (with IsSaBld having a few extras for merge module locations and so forth)...

Robert
0 Kudos
Greg_R
Level 4

Hi Robert,

Running IsSaBld.exe on its own does list -l as a switch.

So now I'm trying to use it, but without success. I've tried setting the path variables that I'm using (PATH_TO_DISCFINALIZE_FILES and PATH_TO_TOOL_FILES) in the IDE to be both Standard and Environment types to see if either worked. As Standard path variables, I set their defined value to be invalid (both of their values is the string "FAKE") just so I can test to see if the command line is actually overwriting their value. It doesn't seem to be doing it.

In the command-line, I am trying to run the following line (I'm putting the < and > symbols around the paths for reading ease):

"IsSaBld.exe" -p "Project.ism" -l PATH_TO_DISCFINALIZE_FILES="" -l PATH_TO_TOOL_FILES=""


When I do, it gives me the following error message:

ISDEV : error 136: Could not copy file 'FAKE\msvcp71.dll' to '\msvcp71.dll' "The system cannot find the path specified."


Am I using the command-line switch -l improperly? Also, I should mention that I tried this with IsCmdBld.exe with the same results. Thank you for the help again.

Greg
0 Kudos
Greg_R
Level 4

I'm sorry for pushing this issue, but I was hoping to try to get the ability to overwrite path variables in the command-line to work. Ideally, it would be really nice to get this to work so that I can have my build machine create the installer without me manually having to specify the path variables' values in the IDE.

I suppose for now, I could just copy the files that need to be put in the installer from the directory that is labeled by the current build number to a separate, build number independent location. This just means, I'm wasting more time and space copying files unnecessarily.

Has anyone had success with overwriting path variables' values from the command line? Thanks! 🙂

Greg
0 Kudos
RobertDickau
Flexera Alumni

Does a test with a simpler project work? For example, I created a project with one feature and one component, with the component linking to file Sample.exe from standard path variable , which is defined in the project as C:\Sources\Sample.

I then created a fake source folder C:\NewSource and added a copy of Sample.exe to it, and built the project with this command ("A" and "1" are my release name and project config name, of course)---

ISCmdBld -p "C:\InstallShield 2008 Projects\PathVarTest.ism" -r A -a 1
-L SAMPLE=C:\NewSource


---and it seemed to build correctly...
0 Kudos
Greg_R
Level 4

Hi Robert, I really appreciate your patience with me on this one.

I built a quick project to test this like you suggested. It has just one feature and one component.

I created a directory at C:\Test which contains a dummy executable called "Test.exe". In my ism project file, I added this file to the Files and Folders portion in the Application Data. As a result, it is now in my single default component. When I added this file, a path variable was automatically created called PATH_TO_TEST_FILES and it's current value is C:\Test.

Then I created a folder inside of C:\Test called "Deep" (i.e., C:\Test\Deep) and I copied the Test.exe file from C:\Test and put it in C:\Test\Deep. At this point, I compiled the project from the command line like the following:

issabld -p "C:\InstallShield 2008 Projects\PathVarTest.ism" -L PATH_TO_TEST_FILES=C:\Test\Deep


At first it didn't give any warnings. But then I realized, that in order to test to make certain it was working, I should delete the Test.exe from C:\Test. This way, I could make sure that it was using my new path at C:\Test\Deep. Sure enough, when I attempted to compile the project from the command line again with the Test.exe no longer located in C:\Test, it gave me the following warning:

ISDEV : warning -5000: Component 'DefaultComponent' contains a link to a nonexistent file - 'C:\Test\Test.exe'

This leads me to believe that it is still trying to reference C:\Test\Test.exe, when it should be referencing C:\Test\Deep\Test.exe since I am overwriting the path variable's value.

I saw that in another thread here, someone mentioned that you had to put single quotes around the new value of the variable that you are overwriting. I attempted this, but it gave me the same warning.

Am I doing something else wrong? I notice in your command line execution, you're specifying a config file. Is that something that I have to include to get this to work?

Thanks for the help, Robert.

Greg
0 Kudos
RobertDickau
Flexera Alumni

Hmmm... I repeated the test with the original source location (the value of the path variable in the project file) missing, and it still seemed to work.

Which type of project are you using? My test builds a Basic MSI project, and the -a switch to ISCmdBld.exe corresponds to a product configuration, which I named/defined in the Release Wizard...
0 Kudos
Greg_R
Level 4

I'm working with an InstallScript project. Does that command-line not work for InstallScript projects? If so, this is really embarrassing for me. Also, if this is the case, is there any other way to specify a path variable at runtime?

Thanks for the help, Robert.

Greg

Edit: Clarified who it was embarrassing for to make sure I didn't give the wrong meaning.
0 Kudos
RobertDickau
Flexera Alumni

A similar test using an environment variable-based path variable seems to work; I created an InstallScript project with a component containing a link to \sample.exe, where the SAMPLE path variable had initial value C:\Sources\Sample. Changed the SAMPLE path variable to an environment variable-based one, set the Defined Value column to SAMPLE_ENV_VAR. Closed the project.

In Windows, I created an environment variable (a user variable, thought it shouldn't matter) called SAMPLE_ENV_VAR with value C:\NewSourceLocation; and moved the original source file.

Finally, opened a new command prompt window and ran:

ISCmdBld -p "C:\InstallShield 2008 Projects\PathVarTest2.ism" -r A

and the project appeared to have built correctly...

Tried moving the source again, and running the two lines:

set SAMPLE_ENV_VAR=C:\AnotherSourceLocation

ISCmdBld -p "PathVarTest2.ism" -r A


and that seemed to work, too.
0 Kudos
Greg_R
Level 4

Hi Robert.

Summary:
It appears that I have to restart my computer in order to get the Path Environment Variable to take effect, which isn't ideal for my build machine situation.

Detail:
I created a project essentially just like yours with reference to a Sample.exe at C:\Sample\Sample.exe. Also, I created another location for it at C:\SourceLocation\Sample.exe to test.

I made the path to the Sample.exe file an environment variable in the project ism file. Then, I set the value of a new environment variable with the same name that I specified as the defined value in the IDE. I tried compiling the project from the command line but got the following warning:

ISDEV : warning -5000: Component 'DefaultComponent' contains a link to a nonexistent file - '\Sample.exe'

I should mention that the installer always "appears" to build fine even with this warning. I just have to scroll up the command window to see the output and this warning comes up.

So, I tried restarting my computer and running the project again from the command line and it works fine with no warnings whatsoever. Thinking that maybe there's a one-time restart fee associated with creating a new environment variable, I tried setting the environment variable's value back to the original C:/Sample location and deleting C:\SourceLocation\Sample.exe, but I got the warning below which indicates that it is still referring to the old value of the environment variable:

ISDEV : warning -5000: Component 'DefaultComponent' contains a link to a nonexistent file - 'C:\SourceLocation\Sample.exe'

Is there a different way of setting environment variables than going through System Properties -> Advanced Tab -> Environment Variables button? Or is there some sort of setting that I can set to make it so I don't have to restart my computer to have an environment variable's value change?

Also, just to verify, does the -L switch not work for InstallScript projects?

Thank you again.

Greg
0 Kudos
esiemiat
Level 9

Can you just set the environment variable in the CMD window or with a VB app before invoking the build engine. In windows any child processes will inherit the environment of the parent.

For example, we set a bunch of environment variables via batch files during our build process and the InstallShield build engine inherits these because it is invoked by that batch file. On the development machine I set these same environment variables with a VB6 app and then shell out to the IDE which also inherits these values.
0 Kudos
RobertDickau
Flexera Alumni

Hmmmm, I see the same warning you do when using -L with an InstallScript project. (As an aside, for what it's worth, you can abort the build when a warning occurs by adding -w -x to the ISCmdBld command.)

I am surprised about needing a reboot when changing an environment variable, though. What Windows version are you using? Does adding a "set" command (instead of using system properties) before calling ISCmdBld make any difference?
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Unfortunately, the -L option will not currently work with InstallScript projects (it also does not work correctly for root level files in a dynamic link in MSI projects). This issue was submitted under work order number IOC-000060948 and should be resolved in a future release.

As a workaround, the best option would be to use environment or registry path variables.
0 Kudos
Greg_R
Level 4

Hey folks, I've got it working now. I really appreciate all of the help from everyone, especially Robert for hanging in there with me.

I have the installer setup to use environment variables just fine now. I'm setting them now through my automatic builder (a Visual Build Pro script) and it seems to be working now like a charm.

Thanks again! 😄

Greg
0 Kudos
HenryC
Level 2

Greg R wrote:

I tried restarting my computer and the environment variables are working now. So it seems like I have to restart my computer every single time I change the value of the environment variables now. This seems like a major barrier for me trying to setup the automatic build machine to run every day since the location of these paths will likely change every day.


Did you try closing InstallShield application (not just the project)? That worked for me:
1. Created environment path variables by setting the "Name" and "Defined Value" fields.
2. Create actual environment variables on my computer (used same string for environment variable, variable name and defined value)
(At this point current value is *** Not Defined***)
3. Saved project, closed InstallShield and re-opened.
4. Current value appears as set in the environment variable.

Seems a re-boot is not necessary.
0 Kudos
esiemiat
Level 9

You do not have to use the system level environment variables. You can open a CMD window, set the environment variables in there, and then launch InstallShield from the command line in that window.

If done in this way, the InstallShield IDE will inherit the environment from that window. This can also be done using a batch script that sets the variables and then luanches InstallShield. I went as far as to create a small VB app that remembers the environments that I set and launches the appropriate version of InstallShield for me.

This method has several perks. For starters is it much easier than changing the environment under the "My Computer" properties. IT also allows you to work on several projets simultaneously with different environment variables for each.
0 Kudos
slomicka
Level 5

Was this issue ever fixed? I am having the exact same issue with -l and iscmdbld. I'd rather use the command line but can switch to env. if that works.
0 Kudos