I need help with an installer. I have my installer project installing my program (Obviously) and my boss wants me to make it auto run after the setup is finished. I cannot find any way to do this. Is it possible to do so?
相关问题
- How does the setup bootstrapper detect if prerequi
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- Wix: How can I set, at runtime, the text to be dis
- 'System.Threading.ThreadAbortException' in
In a VS 2015 setup project (the installer extension) there are custom actions. You select the setup project in Solution Explorer then do View->Editor->Custom actions, and you want an install custom action. By default custom actions will stop the install until they have finished, so basically you need a custom action that does a shell run of the program (so that it runs asynchronously, a fire and forget).
This should help with custom actions in general:
https://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup-projects-and-custom-actions/
However this will almost certainly not work correctly because, as Damien says, in an Everyone install the custom action and its offspring will run elevated AND with the system account, and the program will not behave as if it were fired off by the interactive user. The best you can do is edit the MSI file with a tool such as Orca, find your custom action in the CustomAction table, and turn off the msidbCustomActionTypeNoImpersonate bit so the custom action runs impersonated as the installing user. That's in the Type column.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa368069(v=vs.85).aspx
All this is generally a bad idea because Visual Studio setups don't have access to the full range of Windows Installer features and don't let you move custom actions around so they run with the installing user's credentials automatically. The underlying issue is that programs initiated from an msiexec.exe process running with the system account (and perhaps elevated) don't behave the same as if they were initiated by the interactive user with a shortcut, and it's difficult to emulate that shortcut behavior from the installer's context.
Yes, it's very easy to start your installer automatic and to run your app at the end of the instalation.
To start the setup you need to set an autorun on one cd/dvd. You only need to add an autorun.inf text file using the ini format. Below is an example assuming you have an setup.exe with your icon.
You can change the icon section to any icon, for example "icon=my_cool_icon.ico". If your exe file have 3 icons, you can pick the 2th with "setup.exe,1" and the last with "setup.exe,2" since the counting is zero based index.
More information on wikipedia
To start the app in the end of the installer you need to
You need to see if you want your app to run with elevated or normal user permissions. One good article is msdn launch as user from UAC
Please check the stack questions launch app, microsoft installer or run exe after msi installation (Visual Studio 2008)