InstallShield - relative file paths

33,185

Solution 1

You can use <path variables> (see documentation - resurrected from Wayback, Aug 2018) to point all your files relatively to them.
Also see this blog post.

Solution 2

With the free VS Limited Edition of InstallShield, setting custom paths doesn't look possible. So hacking the ISL file may be necessary having only a few predefined path options available.

Here are the predefined path variables I found in the 2013 Express docs: (Verify in case of typos)

    Predefined Path                              Variable Value                       InstallScript Path Variable
    --------------------------------------------------------------------------------------------------------------
    <ProgramFilesFolder>                         C:\Program Files\                    <PROGRAMFILES>
    <CommonFilesFolder>                          C:\Program Files\Common Files\       <COMMONFILES>
    <WindowsFolder>                              C:\Windows\                          <WINDIR>
    <SystemFolder>                               C:\Windows\System32\                 <WINSYSDIR>
    <ISProjectFolder>                            C:\InstallShield 2013 Projects\      
    <ISProjectDataFolder>                        <ISProjectFolder>\ProjectName        <ISPROJECTDIR>
    <ISProductFolder>                            C:\Program Files\InstallShield\2013  
    <ISRedistPlatformDependentFolder>            C:\Program Files\InstallShield\2013\
                                                    .\Redist\Language Independent\i386
    <ISRedistPlatformDependentExpressFolder>     C:\Program Files\InstallShield\2013\
                                                    .\Redist\Language Independent\
                                                    .\i386 Express

My VS solution includes both an Outlook AddIn and an InstallShield LE setup project. Although InstallShield was including the AddIn generated output and related assemblies, neither the manifest nor vsto files were included. So I needed to specify these separately. This worked for one workstation; however, another workstation sharing the solution had a different source directory structure giving unresolved sources.

The manifest and vsto files were added by InstallShield with absolute paths. A symlink common to all the workstations could have solved the issue, but I decided to hack the ISL files to see if it's possible to use relative paths realizing the ISL file might require maintenance hacking in the future.

In order to get the common parent directory (i.e., the solution directory in my case,) I specified the following two parent selectors (..\..) in the ISL for special artifacts listed in <table name="File">.

...<td>&lt;ISPROJECTDIR&gt;..\..\MyProject\bin\Release\...

where HTML entities are used for the surrounding less-than/greater-than symbols of the <ISPROJECTDIR> variable.

I ran a second test (which should have been the first) using the <ISPROJECTFOLDER> variable instead of <ISPROJECTDIR>. In this test, only one parent selector was necessary:

...<td>&lt;ISPROJECTFOLDER&gt;..\MyProject\bin\Release\...

So far things seem to be resolving correctly but your relativity may vary.

Solution 3

<ISProjectFolder> is the macro for the directory containing the Install Shield project.

(Much easier to have the answer on this page...)

Solution 4

  • fixed relative paths for file content to be copied by the Install Shield Limited Edition to the output directory ( Visual Studio 2012 ) Steps:
  • Expand your install project in the Solution Explorer so you see the 1,2,3,4,5,6 sections
  • Expand '2' and double click on 'Files' You will see a four panel page: with 'Source computer's files' and 'Destination computer's files'
  • delete your hard coded paths and files from the 'Destination computer's files'
  • Click in the top left panel, on the project that has your files as 'Content Files'
  • the top right panel will show 'Content Files from MyProject'
  • click and drag this to the bottom right panel (the 'Destination computer's files')

Go back into your project and make sure all your files you want copied have properties: Build Action=Content and Copy to output directory=Copy Always

Solution 5

When you add the file, you should try to have it be relative to the installshield project file. If you keep the .ism file in your source tree, then any executables you add should had a path relative to that file.

Share:
33,185
Cornel
Author by

Cornel

Updated on July 09, 2022

Comments

  • Cornel
    Cornel almost 2 years

    How can I add a file to an InstallShield component specifying a relative path to the InstallShield project in order to make it easy compiling the project on different machines?