Installshield - Merge Module - Dynamic destination directory based on user dialog input - installshield

I am trying to set the override the destination directory of the merge module as described here. I set the destination directory to [BIN]. BIN is public property. At compile time the value of [BIN] is C:\Program Files (x86)\CompanyName\ProductName.
Based on the user input in a custom dialog, this property is updated to C:\Program Files (x86)\CompanyName\UserInputName\ProductName.
All the DLL files from the merge module are copied into the compile-time value of [BIN] - C:\Program Files (x86)\CompanyName\ProductName. For some reason, the dynamic value is ignored in this case.
Can someone tell me what could be going wrong?
I am using Install Shield Version 2010 Professional Edition, Project Type is Basic MSI Project

Merge Modules add a GUID to every primary key to prevent merge collisions. So the BIN identifier actually turns into BIN.G_U_I_D when used in a Merge Module.
To resolve this issue, Merge Modules are designed to be "retargetable".

I have posted the same question on InstallShield forum, the conclusion there was it is not supported by InstallShield to change destination directory of an MSM file during run time.
A workaround suggested is to have a custom action 'Set Directory'.
Here are the steps:
In the Redistributable view, right click on the MSM file ->
Properties -> Destination -> set to [MSM_DEST_STATIC_DIR].
Create a custom action of type'Set Directory', with Directory Name -
MSM_DEST_STATIC_DIR, Directory Value - [MSD_DEST_DIR_DYNAMIC_VALUE]
After getting the user input from the dialog, first, update the MSD_DEST_DIR_DYNAMIC_VALUE, then execute the custom action created in step 2.
While doing this I also realized that it is not possible to update the IISROOTFOLDER based on the dynamic user input. I followed the same procedure with the custom action to update the IISROOTFOLDER.

Related

Class name is invalid or already implemented in the selected source file

I have a solution in VS2017 including 7 different C# or C++ projects. I add a new project to generate a dynamic link library (.dll) and then trying to create a new class in the newly created project using add option. But I get the following message:
"Class 'sampleProvider' is either invalid or already implemented in the selected source file."
Previously, I have defined a class with the same name in a project of the current solution, but then I have removed and deleted the project and all relevant references.
I checked the windows registry. There is no any entry, key or value in the windows registry with the same name. Also there is no any file in the windows file system with the same name.
But in my solution directory in a hidden folder named ".vs" in '...\.vs\MySolutionName\v14' there are two files named '.suo' and 'Browse.VC.db' which include few references to old class name. I know that '.suo' is a file includes 'Visual Studio Solution User Options' and 'Browse.VC.db' is IDE Database File. I am not pretty sure what happens if I delete these two files or all mentioned references from these two. Dose it possible to define my own class with my preferred name, afterwards?
Any help is appreciated in advance.

How can I use a dialog to define the program group name in Installshield 2015

I am currently trying to expand our installation program with an option for the user to specify the name of the program group where shortcuts are created under the start menu. (I am aware that this is a somewhat outdated concept)
I am using InstallShield 2015.
I created a localizable property named [PROGRAMGROUP_NAME]. This has automatically created an {ID_STRING46} which I've set to the desired default value. So far so good.
I managed to create a custom dialog with an edit control, which is linked to the above property.
Now comes the tricky part: Under Shortcuts, under "Programs Menu" I first want to add a folder with the program group name, under which to place several shortcuts.
If I enter [PROGRAMGROUP_NAME] that is literally what the name becomes. If I use {ID_STRING46}, it uses the default value, and not what I've entered in the dialog.
Incidentally, when I tried to rename ID_STRING46 to something more meaningful, other things started going wrong so I've left that as is.
What is going wrong here? How do I get the value of the property to be used for the folder name?
EDIT
I am trying to use a custom action now, but I have trouble defining it. My Dialog that sets the property is after CostFinalize, so I assume I have to use SetDirectory - but I have trouble defining it. I get an error stating "could not access network location "
EDIT
I've managed to progress a step. I have manually added a directory with key DIRECTORY_PROGRAM_GROUP (important that it's all caps to make it public) to the directory table. Then, I use a custom action to set that directory to the desired value [ProgramMenuFolder][PROGRAM_GROUP_NAME] after I've run my dialog, and I've modified the shortcut to be created in that folder.
Seems to work great, however, now the program group is no longer removed when uninstalling...
Shortcuts are installed to folders, and the name of the folders below ProgramMenuFolder become the program group as you describe it. So you will need to either build up the Directory table (either directly---note that the DefaultDir column is localizable, and there may already be a string you can update---or through the Files and Folders view) to do what you want, or use custom actions (set property, if before costing; set directory, if after costing) to adjust the location to which your shortcut is installed.
As for the problems renaming ID_STRING46, odds are you didn't update a reference after you changed the name of the string. The simplest way to track down where these are may be to examine differences in the built installer (perhaps using InstallShield's MSI Diff) and then update the relevant references using the direct editor if you can't find them in the normal views.

Installshield Installscript properties

We have Installshield 2009 for our product. I am trying to muddle my way through it to make some updates (obviously, I am not the original author).
Within, there is a fairly complex arrangement of components and files, plus, there is a script section for some custom work.
I need to accomplish the following, without creating a blank object in the repository.
One of the components needs to create a directory tree (two folders deep).
Within that tree (deepest folder), I need to create a blank file.
Questions:
Do I need to create two components, one for each directory level, or will the tree be created if I specify [INSTALLDIR]folder1\folder2?
I am thinking that the installscript would be the place to create the empty file, based on the CreateFile example in the help. I notice that, in the components page, that, once I typed the value for the Destination property, that a little "tag" of sorts appeared at the start {FOLDER2}. Can I used that tag as an argument to CreateFile and how would I reference it?
Regardless of the project type, I would probably suggest creating the folder structure in the Files and Folders view, and adding the empty file there. It's just simple and you'd be done with fewer chances of error.
As to the questions you asked, neither Basic MSI nor InstallScript projects require components for every folder level on the system. Note that if the folder isn't already there when it executes, the CreateFile approach is unlikely to create the folders for you.
In a Basic MSI project, {FOLDER2} indicates that FOLDER2 is the name of the directory entry, and after CostFinalize there will be a property of the same name that contains its run-time location. You can retrieve it in an InstallScript custom action with MsiGetProperty. In a pure InstallScript project the approach would be a little different, worst case it would be something like TARGETDIR ^ "folder1" ^ "folder2" (my InstallScript is rusty).

How do you find the user-selected install path in Inno Setup?

I need to get the path that the user chose to install my application into.
If I set CreateAppDir=yes and set a DefaultDirName=C:\MyApp\ the user can change it to some other directory. After they do this, I need to know which directory they chose on the next install wizard step. How can I get this value?
Use the {app} constant. The reference describes it as:
The application directory, which the user selects on the Select
Destination Location page of the wizard. For example: If you used
{app}\MYPROG.EXE on an entry and the user selected "C:\MYPROG" as the
application directory, Setup will translate it to
"C:\MYPROG\MYPROG.EXE".
Optionally you can use the WizardDirValue function. This one is described as:
Returns the current contents of the edit control on the Select
Destination Location page of the wizard.
Unlike ExpandConstant('{app}'), this function will not fail if called
after the wizard is shown but prior to the user selecting a directory.
Rather, it will return the default directory name.

How to set the install path of a merge module from a registry key?

I have created an installer (using InstallShield 2012 Spring) that consumes a merge module that I created and I want to install the files from both the main installer and the merge module to a path that is stored in the registry. In a separate installer the user is able to specify the install location and I save this path in the registry to be used by subsequent installers.
In the merge module my components have a desination of 'INSTALLDIR\Folder'. In the main installer I have changed the Destination property in the Redistributables pane from '(User merge module's default destination)' to 'INSTALLDIR'. This allows me to install the merge module's files to the same path that is in the main installer when the installer is built, but if I change the Destination during run time (through custom action or the DestinationFolder dialog) only the main installer's files are installed to the desired path.
I am using an system search to retrieve the path from the registry and store it in a property. Then I have a custom action that sets INSTALLDIR to the path that is read from the registry.
If I go to the direct editor of the merge module and edit the Directory table I can change INSTALLDIR.GUID to INSTALLDIR and I get my desired results however this causes the 'Components' and 'Files and Folders' panes to be unusable.
Is there a better way to do this?
I saw these answers and they got me started but I can't seem to get the Merge Module's destination to change during run time.
Installshield 12: Changing the destination of a merge module at run time
Make installshield merge module installation path configurable for user
I ran into a similar situation. If you remove the GUID from the INSTALLDIR values only in the Directory_Parent column, then the Files and Folders, etc, panels become unusable. You need to be sure that you remove the GUID from the INSTALLDIR cell in the Directory column as well. Then the merge module will 'inherit' the INSTALLDIR of the parent installer and the directories you've created in your merge module will inherit from that.

Resources