I'm creating an installer for my application (Setup Project in Visual Studio 2010). I wish it to add some registry entries, but only if it's in debug mode. Can I achieve this?
There is a property Condition if you add a registry entry, but none of theese works:
%DEBUG=1
DEBUG=1
Please help,
thanks a lot!
There is no property to tell you the MSI is built by the Debug or Release build. From what you I know you also cannot have a registry value added just in one of the builds from the VS editor.
A solution would be to create a post-build event in VS that inserts rows in the Registry table from the MSI build on debug.
To see what rows to insert in the table just build the MSI with the values in it, open it with Orca and see what it adds in the package. It should add entries in Registry, Component, and FeatureComponent tables. However, you could simply the scripts to have only entries in Registry table created by assigning the new values to an existent component from the package.
Related
I have a Windows setup and deployment project with which several non-essential files are created. When those files are deleted by the user, the program re-creates them when it's run the next time.
How can I prevent this behavior?
There's no support for this in Visual Studio setups, but the documented way to do this is to have a null Component Id for the files that will be deleted:
https://msdn.microsoft.com/en-us/library/aa368007(v=vs.85).aspx
and see the ComponentId description. So you'd need to edit the MSI file with Orca or a similar tool and set the Ids to null for the files. This can be automated with a post-build script with some MSI SQL and a VBScript or program.
Attempts to make this go away by trying to disable the repair generally fail because not all repairs can be prevented (such as right-click the MSI and repair, or perhaps Programs&Features) and an upgrade (RemovePreviousVersions) may well result in them being re-installed so that Windows can see if they need to be updated or not (which it cannot do if they are absent).
I created an MSI setup via Visual Studio 2008 for my application, and added a registry key to windows\run for automatic startup, but also implemented a function in my application to disable automatic startup. However, when the application is restarted, the key is automatically repaired.
How to prevent MSI from repairing the key??
Thank you!
The registry key is repaired because it was installed by your package and Windows Installer knows that it should be present. Some possible solutions are:
Move the entry in a separate component which doesn't have a Component ID. This way the component is not registered with Windows Installer.
Use a custom action to create the registry entry during install.
I am creating an MSI from inside visual studio 2008.
This is what I am doing:
(With the project I am creating this for open in Visual Studio) right click Add new project
Setup and Deployment > Setup Project
Give it a name
Right click Application Folder > Add > Project Output: Primary Output
Question: does this contain all I need to run the project?
I want to create the .msi to put a shortcut to it on the Users desktop, so
Create shortcut to Primary output from Project
Move this to the users desktop folder
Question: how do I get this to keep the icon from the project!! conveniently doing this seems to have lost the app icon and picked some random generic one instead.
Thanks,
edit 0: Oh and also, can I set so when running the .msi the user cannot change where it is installed to?
Nobody knows how to do this?
It should unless you are referencing mixed mode assemblies in which case you may have to manually add files to the installer as the dependency resolution is very poor in this case.
You need to set the icon manually in the properties of the setup project.
To Remove the option to select the installation folder try opening the user interface view of the project and deleting the 'Installation Folder' screen.
I'm creating a setup pacakage in Visual Studio 2008 to register a COM component and one of the actions is to add a few keys to the registry.
The odd thing about it is when I run the installer it creates the key hierarchy correctly but the last key in the hierarchy it creates has the wrong GUID... whereas its right in the installer... has anyone run into this or have any suggestions on what is going wrong?
Thanks
I had the same (or a similar?) problem, my solution is here: How to register COM from VS Setup project?
Basically I just created the registry keys manually and added them to the setup project as a .reg file :)
I have a Visual Studio Setup project which has a Application Folder DefaultLocation set to[ProgramFilesFolder][Manufacturer]\[ProductName]. I would like to change this to include the software's version number, like [ProgramFilesFolder][Manufacturer]\[ProductName][Version], but Visual Studio doesn't seem to support it.
Is there an alternative to manually changing the Application Folder's DefaultLocation every time I create a new release?
You can use [ProductVersion] in the same way as [ProductName] and set product's version in the project's properties window.
The way I would do it is create a post-build event, that runs a Javascript program that modifies the MSI. It should be a pretty simple thing.
There's a sample script that modifies an MSI in the answers to the question
How to run an EXE after MSI installation?
That script doesn't do what you want but using Orca and that script, you should be able to figure out how to create your own, that modifies the MSI to insert the version number automatically.
It should be a single db update.
You have [ProgramFilesFolder][Manufacturer]\[ProductName][Version]
Try [ProgramFilesFolder][Manufacturer]\[ProductName]\[ProductVersion]
In particular, note the slash after [ProductName]