InstallShield - relative file paths

2019-03-12 08:59发布

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?

6条回答
▲ chillily
2楼-- · 2019-03-12 09:23

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-03-12 09:23
  • 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

查看更多
老娘就宠你
4楼-- · 2019-03-12 09:30

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.

查看更多
狗以群分
5楼-- · 2019-03-12 09:35

Here is my solution if your "source files"'s disk partion were not same as <ISProjectFolder>:

  1. Open the installshield script file (*.isl) with notepad;
  2. know the predefined variable "<VSSolutionFoler>", it's the folder of your install solution folder
  3. Replace the absolute path of file(s) into the relative path to "solution foler". i.e. & lt;VSSolutionFolder& gt;..\..\exe\release\myapp.exe
查看更多
成全新的幸福
6楼-- · 2019-03-12 09:35

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.

查看更多
一纸荒年 Trace。
7楼-- · 2019-03-12 09:43

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

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

查看更多
登录 后发表回答