Control What Advanced Installer Puts In Program Files - windows

I create an Advanced Installer Template that has a Custom Exe attached to the process.
Advanced installer creates an msi with the custom exe embedded into it.
When I run the msi and look in Add/Remove Programs there are 2 entries the installer
itself and the custom exe.
I want only the installer itself listed there not the custom exe.
How can I accomplish this?
I map a key to delete and it only gives an option to delete values in the key? I want to delete the entire key

You can try to remove the Control Panel registry key for your custom exe product. Just search in regedit for a path like this: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Product
Then in "Registry" page of your setup project (in Advanced Installer tool), create the path of the above reg key, right click on it -> Properties -> Operations -> check Remove this key ... option with Remove on - component install.
This way when your current setup package installs it will delete the registries associated with your custom EXE product.

Related

Visual studio setup project: default installation location based on user choce

Is it possible to change the DefaultLocation proprty based on a user choice on a visual stuio 2013 setup project?
I have inserted a radio button dialog in User interface but I don't know how to use the selected button property to change the DefaultLocation propetry, if it is possible.
There already is a usr choice to specify the output directory. The user interface sequence has an InstallFolder dialog where you specify the Application Folder (as it's called in the File System view). That's the way the user browses to a location that is not the default of [ProgramFilesFolder][Manufacturer][ProductName] .
If you want to change the default location and base it on a search then this should work, assuming you have a registry entry defining the location:
Create a custom folder in the file system view, and give it a default location that's the same as the Application Folder setting, and an uppercase Property there called (for example) MYPATH. Put your files there, not Application Folder.
Add a registry search, in Search Target machine in launch conditions, and refer to the key and registry location, and with the Property MYPATH.
At install time the search will set the path to the value in the registry and install the files there.
The problem is that Visual Studio setup projects don't offer all the capabilities of Windows Installer, although other tools do. With other tools you could run code to set the location, just as an example.

visual studio 2010 setup project - uninstall custom action

During install, I'm passing some CustomActionData to CustomAction.
Is that data stored somehow? I need to use some of the data during uninstall in uninstall custom action.
I can't resend this data because user might not be using the msi file to uninstall but go to add / remove programs.
I need somehow in uninstall custom action to retrieve data that was already sent during install.
Here is the usual approach:
save the information you need in an installer property
use that property as a registry entry value
create a search (in Launch Conditions Editor) which reads this registry entry
the search property can be used during uninstall
Basically, you save the information during install and read it through a search during uninstall.

Add an option to either remove or keep installed files on uninstall?

I'm using the Visual Studio Setup Project to create my installer.
How can I give the user an option to either keep or remove files and/or a folder when uninstalling? The install includes a database and the may want to keep this on disk and associated content in case they re-install or upgrade.
you could add a custom uninstaller System.Configuration.Install.Installer that will ask for the choice and then removes the files depending on the result or even better add a wizard page with a radio button to ask for the decicion and pass the selected button value to your install helper as arguments. See InstallHelper samples how you can pass these option values to your own helper class.

Visual Studio 2010 update registry in setup application

I've recently created an application for my brother to use, it has several entries stored in the registry that it uses. I created a Setup Application in VS2010 so he can install the application to his PC with ease and set the entries to some default values for him, which he has changed. e.g.
I have a entry called "SummaryFolder" and the value of "Successfully Installed" - so when it was installed it would have the default value. He will have changed this by now to an actual folder on his PC.
Now I've just made a change to the program and added a couple more registry entries, modified the setup application and added in the new entries for installing. I've changed the build number of the setup app, so when he installs the app, it actually UPDATES his existing version. The problem I'm having is that the existing registry entries he has from the initial installation has been overwritten with the default "Successfully Installed" values, hence removing the folder he set.
So my question is: How can I specify for the setup program to only add the registry entries if they DON'T already exist ??? I want to have the installer to be as simple as possible for him.
Many thanks for any help.
You can try this approach:
select your setup project in Solution Explorer
click Launch Conditions editor button at the top of Solution Explorer
add a new registry search and configure it to search for your registry entry
set the search property to something meaningful, for example SUMMARY_FOLDER_REG (only uppercase letters so its a public property)
in the Registry Editor select your registry value
in its Properties pane set the Condition field to the negated search property:
NOT SUMMARY_FOLDER_REG
This way the registry entry is installed only if the search doesn't find anything.

Visual Studio Setup Project - conditionally install file

I have a VS 2008 Setup project. I only want to install an XML file if it does not already exist on the target system. The installer overwrite rules for non versioned files ensure that a file will never be overwritten if it has not been modified on the target system. But I want to never overwrite the file. There is a Condition property that can be set on a file in the Visual Studio installer properties for a file. What is the correct syntax for the Condition property to check for existence of file and only install if it is not there?
You will need to go to the Launch Conditions tab and search the target computer for the file you want to check for. The launch condition will let you specify the name of a property it will set to the path of the file if it exists, otherwise it will be empty. You can now use this property as the condition on your file.
I was able to use a launch condition to set a property, and use this for a conditional install of a file, so I will mark 'heavyd' as the correct answer. However, was not able to use the file search effectively, as was suggested (see comments on the answer). Instead, I used a Windows Installer Search (one of the three types of searches available in a VS 2008 Setup Project) with the MSI ComponentID, as follows (I found the technique here):
Product 1 is installed and has a file named MyFile.txt.
You use ORCA (from the Windows Installer SDK) to view the File table, and find the row that represents MyFile.txt.
You get the value of the Component_ column and then open the Component Table.
In the Component Table you find the row that has the Component_ value in the Component column, and get the ComponentID. Copy this value into clipboard. Close ORCA.
In your setup project, open the Launch Conditions Editor and add a Windows Installer Component Search. For the ComponentID property of the new search, paste the ComponentID.
Copy the Property property. It should be something like COMPONENTEXISTS1.
Open the File System Editor and select the Application Folder, then select the file you want to conditionally install.
Edit the Condition property to be COMPONENTEXISTS1 = FALSE.
Set the Transitive property to true if you want the condition to be evaluated each time the installer is run (not just the first time).
Now, MyFile.txt will only be installed if it is not already there.
There is one caveat with this technique: Doing a repair on the installation will cause the file to be deleted, even though the file is marked as Permanent! Not good. I worked around this by adding some custom actions (calling vbscript files) to backup and restore my file.
What a hassle to just achieve so simple a task: install a file once on initial install, then, never again overwrite it.
If anyone has a better solution, I am all ears.

Resources