I have a simple C# application that allows users to specify that it should be (or should not be) started with Windows; it does so by setting (or deleting) a registry key (namely, ...\Software\Microsoft\CurrentVersion\Run\MyApplicationHere).
I am using a VS setup project to create the installer for this program. I don't want the installer to create this key; it should only be created when the user selects the option from within the program.
Here is the issue: I would like the uninstaller to delete this key if it exists, preferably without resorting to any sort of hackery; if there is a simple "built-in" solution I would love to hear it. Thanks!
just right Click on Setup then Select View -> Registry, you can add a
registry key to the list. The key has properties (right click ->
Properties) AlwaysCreate,DeleteAtUninstall and Transitive keep
AlwaysCreate to false, and DeleteAtUninstall to true and Transitive to
true as well
adn its Done..
The Registry table is designed for this:
http://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx
See especially under the description of "Name":
If the Value column is Null, then the strings shown in the following table in the Name column have special significance.
- The key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled.
Try creating a custom uninstall action to remove the key. Not very "built in", but it's only a couple of lines of code.
Related
Hello i was seaching around for some time on how i remove from the IIS the validation key and the decryption key. as in the UI i cant see how i remove it.
Because it is only possible to choose from two options,
Let ASP.NET runtime automatically generate the key(s) at runtime. (aka, leave the check box checked)
Pre-generate the key(s) and hard code them. (aka, leave the check box unchecked)
and the management UI clearly presents both options to you and expects you to only flip the check boxes. There is no possibility to "remove" anything from there.
Unfortunately, I have the problem with setting condition for Registry value in Visual Studio Installer project.
The main goal is to suppress updating value for application registry key for application updating.Installer should not do anything for the value if it is already in application registry key.
In value properties, I see two significant:
Condition
Transitive, set as True
It seems that for condition the most suitable is:
NOT [HKLM\Software\Company\PasswordReset]{callSignInstance}
Where key is [HKLM\Software\Company\PasswordReset] and name of the value is callSignInstance.
But in this case value just disappears from registry key. What is correct condition should be for this case?
Best regards,
Oleh
I am trying to install three application by creating custom dialog .Within Custom dialog there are checkbox and Onclicking checkbox and thereafter doing next I want my application to do file transfer ,install the prerequiste based on which checkbox is checked .I want this to happen for all the three application.Please suggest how to do it and how can we give the condition to do so.
Assuming you're talking about a custom dialog for a Basic MSI, I would suggest the following:
Ensure each application in question is part of a separate feature. If you go with the original dialog set, this would potentially let the user select them by feature name, or you could hide them. These features should have meaningful names, along the lines of App1, App2, App3.
Ensure your three check boxes are associated with different properties, such as INSTALL_APP_1, INSTALL_APP_2, INSTALL_APP_3. I show public properties here out of habit, but since they will be used in the same sequence (on the same dialog box, even), it's okay to use private properties. And use suffixes more meaningful than 1, 2, 3.
Adding multiple control events to the Next or Install button on the dialog box you described. For each feature you want to control this way:
Add an AddLocal control event, with an argument of the feature name (e.g. App1), conditioned to execute when the check box is checked (i.e. with a condition like INSTALL_APP_1
Add a Remove control event, with an argument of the feature name (e.g. App1), conditioned to execute when the check box is not checked (i.e. with a condition like NOT INSTALL_APP_1.
If you are going to show this dialog box during maintenance, you should also initialize the values of the check box properties (INSTALL_APP_1, etc.) so that merely going past this dialog box doesn't change their installation state. You can use feature-state condition syntax (!App1, etc.) to do so in SetProperty custom actions scheduled just before showing the maintenance dialog (e.g. set property INSTALL_APP_1 to the value 1 with condition !App1=3).
If these features are shown in a feature selection control, be sure to update the properties accordingly. Do so on the Next button of that dialog using a combination of the feature state and feature action syntaxes. The property should be 1 if the feature is currently installed and not being removed, or is being installed; it should be set to empty ({}) otherwise.
This is a lot of steps, but together they help ensure the features will act as a user expects. If he does nothing to change their state, they should persist as previously set. If visible in both the feature selection control and via check boxes, they should act in sync.
As far as prerequisites, if you mean the InstallShield concept of prerequisites, this you can associate prerequisites with the features for those apps. If you just mean other components inside your MSI, those work perfectly well with the features defined in step 1 as well.
Basically, I created a Visual Studio Installer project. I added a primary output to my project, which was great because it loaded in the dependencies and files automatically for me. The problem I'm facing is that I want to be able to mark my config file as a hidden file, but can't seem to figure out how.
When I go to View>File System it lists:
MyExternalAssembly.dll
Primary output from MyProject (Active)
So, is there a way to actually mark my config file as hidden during installation if I add a primary output project instead of the individual files?
I'm not sure if you really want to make it hidden. If you're worried about users looking at it, a more than average user will know how to un-hide things and pilfer around. So, that being said, if you want to keep users from seeing what's in the config you will need to encrypt the config. A good example of that can be found here:
http://www.davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx
If you still want to hide the config, then you could try hiding it once the application is run for the first time.
Using: ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun with a click once application you can tell if this is the first time an application is run.
You could then use File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); to actually hide the app.config.
Which would result in:
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}
i created a web setup project in vs 2008 and added some custom actions.
While installing i get the default forms (apppool, appname, website), some pre-defined custom forms and some selfmade custom forms.
Now while installation i add some data in the registry.
I have only one problem: TARGETSITE property.
This property is filled by default form (Context.Parameters["TargetSite"] is something like "/LM/W3SVC/1" for defaultWebSite) and its value properly added to the registry.
Everthing is fine until i use the repair function...
Whilst repairing, the first few default forms will be skipped by installation, therefore the TARGETSITE property will be empty (Context.Parameters["Targetsite"] is "").
Sadly i can not interfere with that to get the needed value from registry where i added it for exactly that reason.
Because the registry values will be updated before custom code is triggered in the "override Install" method.
Even onBeforeInstall is fired after the registry has been updated.
If a rollback is done, while repairing, the registry key will be reset to the correct value before, so i have to believe, that somehow i can access this value from within my custom action code.
Someone has any suggestion on how to get this important value?
P.S.:
i tried to set the condition within the registrykey, so that it would only be updated when the TARGETSITE value is not empty, but i´m afraid this will be ignored big time...
TARGETSITE != "" in the registry keys condition-field has absolutely no efect whatsoever...
I solved the problem by working around the installers registry key.
I manually create a subKey under the installers registryEntry, where I store my Context.Parameters["TARGETSITE"] value.
So the repair feature will not overwrite the keyValue because it´s a custom key.
Now I have my value either in the context or in the registry.
FunFacts:
When I create the customKey within the Installers own key, I take advantage of the standart meachnism, which delets the installers registry key and with that my customKey will also vanish.
Maybe this might help if someone else faces this problem sometime...