Create a setup for windows form application Without Administrator password while install

霸气de小男生 提交于 2019-12-13 07:49:56

问题


I have developed a windows form application in visual studio. Now, I would like to install that windows application on my PC without administrator privilege. How can I create a setup. (I already installed Photo Pad image editor application on my PC without administrator privilege).


回答1:


Your best bet is to use ClickOnce. It doesn’t require admin rights to install typical apps. One of the reasons is because ClickOnce apps install for the current user and not for everyone on the local machine.

You can do so from the Publish tab of your project’s settings. The best part is no programming is required.




回答2:


It's difficult to do this with Visual Studio setup projects because they haven't been updated for years, especially regarding UAC compliance. This is the general outline, Authoring Packages without the UAC Dialog Box:

https://docs.microsoft.com/en-us/windows/desktop/msi/authoring-packages-without-the-uac-dialog-box

It generally comes down to this in the Visual Studio world:

  1. You cannot use the install to, write to, or change anything that is prohibited to limited users. In other words, if you're not elevated you cannot install files in the program files folders, create HKLM registry entries, install services and so on. You cannot bypass security rules just because you're doing an install. This applies not matter how the MSI is built.

  2. In the Visual Studio setup project, set InstallAllUsers to False (project property window) and don't allow the user to change it in the Installation Folder dialog property window (set InstallAllUsersVisible to false).

  3. After building the MSI file, open it with Orca (the MSI file editor) and View Summary Information, then set the UAC Compliant flag).

Visual Studio is not the best tool for this, but at least this will get you there, but note that it will a per user install that will not be visible to any other users of the machine.



来源:https://stackoverflow.com/questions/51646358/create-a-setup-for-windows-form-application-without-administrator-password-while

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!