Run two executable after Installation is complete - visual-studio-2010

I am making an Installer using VS Setup project(using VS 2010). Everything is fine except that when I am trying to run two executable file in "Committed" event of the installer they are running before Finish/Close button of Installer is clicked.
I want these executable files to run after I have clicked Close/Finish button of the installer. i.e. whole installation is completed.
Is there any way to accomplish this??
Thanks in advance

This is the normal behavior. Commit actions run as part of InstallExecuteSequence, so before the finish dialog is displayed.
If you want to execute an action when pressing Finish, you need to use control events:
modify your MSI so the custom actions are not used by InstallUISequence or InstallExecuteSequence tables
for the Finish button create a published DoAction control event for each custom action
This is not supported by Visual Studio. So you can either try modifying your generated MSI with Orca or use another setup authoring tool which supports it.

Related

Visual Studio: How to detect any changes on project properties and trigger event from extension when user click apply

I'm trying to write VS extension for VC++ projects, I want to detect any changes on project properties (Additional include directories, additional using directories etc.) when user change and click apply on project properties page.
I don't want to trigger event until user clicks apply. If user click, I want to fire an event from My extension. Thanks for your help.
I tried to capture Command Events from EnvDTE but I did not find Command code for Apply button. In the case of clicking apply, VsStd97CmdId will be 684 or 1990. Those are not specific for apply command.
Other thing that I tried was, detecting changes on project file, but Changes are not saved vcxproj file until save or save-all

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.

How to automatically regenerate DB partial project files?

I am using advanced version of Visual Studio 2010 and using database projects. There's a feature of exporting database schema as partial project (which creates *.files output file), but it is triggered manually by the developer (you need to right-click on the project and select Export as partial project). I would like to automatize this process, meaning that the output file is created each time I modify the database, I build it OR I close the solution.
I tried creating a macro, which executes a DTE command Project.VSDBExportAsPartialProject, but sometimes it fails with an exception AND it shows a Save as dialog box, which I would like to avoid. Maybe the idea is to add it to the post-build event, but I don't know how to execute DTE commands from there.
To sum up, all I need is to automatically refresh the *.files output file located in fixed path without any user interactions.
Is it possible?

Windows Service not showing up when installed with Setup project

I have a simple windows Service developed in VS.net 2008 and VB.net. When I install the service using Installutil.exe from the command prompt it is working like a charm.
When I try to add a setup project and set the output and build and install it though it says successfully installed, it is not showing up in the services.
The event log shows that it is successfully installed. I just did check the registry, it did place the assemblies in HKEY_CURRENT_USER\Software\Microsoft\installer\assemblies.
But I don't understand why it is not showing up in the services listing. I refreshed and restarted.
Any thoughts??
Thanks
Found solution
You have to add a custom action in your MSI project.
So in custom actions, add the output of your service to the Install section. This will then run the required installation code for your service. i.e. the same as what the installutil.exe does
Thanks for all the help
I had the same problem and didn't pay attention to the portion BEFORE creating the Setup project.
http://msdn.microsoft.com/en-us/library/zt39148a(v=VS.100).aspx
To create the installers for your service
In Solution Explorer, right-click Service1.vb or Service1.cs and select View Designer.
Click the background of the designer to select the service itself, instead of any of its contents.
With the designer in focus, right-click, and then click Add Installer.
By default, a component class that contains two installers is added to your project. The component is named ProjectInstaller, and the installers it contains are the installer for your service and the installer for the service's associated process.
In Design view for ProjectInstaller, click ServiceInstaller1 or serviceInstaller1.
In the Properties window, make sure the ServiceName property is set to MyNewService.
Set the StartType property to Automatic.
In the designer, click ServiceProcessInstaller1 (for a Visual Basic project), or serviceProcessInstaller1 (for a Visual C# project). Set the Account property to LocalSystem. This will cause the service to be installed and to run on a local service account.
A couple of ideas:
Are you installing under the same Windows account that you are attempting to run it under? Do you have the Setup Project's "InstallAllUsers" property set to True?
Are you sure that you have the ProductName and Title properties in the Setup Project set correctly? Maybe the service is showing up in the list under a different name, i.e., "SetupProject1" or something.
Similarily, in your service's ProjectInstaller class, in design view, look at the properties of the ServiceInstaller and make sure the ServiceName and DisplayName properties are set to what you want.

Resources