Reputation: 49
I want to run my windows dot net application as administrator after just after installing msi . Please help
Upvotes: 1
Views: 378
Reputation: 1864
If your MSI require Administrative privileges you can directly run your application as a new System.Diagnostics.Procesas by overriding the Installer.OnAfterInstall method. Than the application will run under the same context.
If you have to force administrative context you can do it by the same way Create an instance of the System.Diagnostics.Process class and set the Verb property to "runas".
System.Diagnostics.Process process.Verb = "runas";
If you need to know the installed location of your application take a look at this approach: Getting Application path during the installation
EDIT
A approach is available on CodeProject: Launching Your Application After Install
Upvotes: 1