我们如何创建不需要管理员权限的安装程序?
使用 Visual Studio 创建安装程序/MSI 时,是否可以为不需要管理员权限即可安装的简单应用程序进行安装? 如果在 Windows XP 下不能,那么在 Vista 下也可以吗?
例如,一个简单的图像处理应用程序,允许您将照片粘贴到背景上。 我相信安装到 Program Files 文件夹需要管理员权限? 我们可以安装在 \AppData 文件夹中吗?
目标是创建一个应用程序,该应用程序将为非本地计算机上管理员组成员的用户安装,并且不会在 Vista 上显示 UAC 提示符。
我认为此方法的一个限制是,如果它安装在当前用户的应用程序数据文件夹下,其他用户将无法运行它。
更新:
您可以将一次点击安装打包到普通的 setup.exe 类型安装程序中吗? 您可能会问为什么我们需要这个 - 原因是我们有一个安装程序,可以执行先决条件检查并安装所需的任何内容(例如 .NET),然后下载并执行 MSI。 我们也希望显示一个正常的安装程序启动屏幕,即使这是唯一显示的内容。 我们不介意该应用程序是否只能由一个用户(安装该应用程序的用户)看到。
When creating a setup/MSI with Visual Studio is it possible to make a setup for a simple application that doesn't require administrator permissions to install? If its not possible under Windows XP is it possible under Vista?
For example a simple image manipulation application that allows you to paste photos on top of backgrounds. I believe installing to the Program Files folder requires administrator permissions? Can we install in the \AppData folder instead?
The objective is to create an application which will install for users who are not members of the administrators group on the local machine and will not show the UAC prompt on Vista.
I believe a limitation this method would be that if it installs under the app data folder for the current user other users couldn't run it.
Update:
Can you package a click once install in a normal setup.exe type installer? You may ask why we want this - the reason is we have an installer that does a prereq check and installs anything required (such as .NET) and we then downloads and executes the MSI. We would like to display a normal installer start screen too even if that's the only thing displayed. We don't mind if the app can only be seen by one user (the user it's installed for).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果启用了 UAC,则无法写入程序文件。 安装到 \AppData 确实只会为一个用户安装该程序。
但是,您必须注意,任何需要更改注册表的配置更改可能(我必须仔细检查)管理员权限。 我突然想到对桌面背景的修改最终存储在 HKEY_CURRENT_USER 中。
IF UAC is enabled, you couldn't write to Program Files. Installing to \AppData will indeed only install the program for one user.
However, you must note that any configuration changes that require changes to the registry probably(I'd have to double check on that) administrator privilege. Off the top of my head modifications to the desktop background are ultimately stored in HKEY_CURRENT_USER.
Vista 对此类事情的限制更多,因此如果您在 XP 上无法做到这一点,那么您可以打赌 Vista 也不会让您这样做。
您是对的,使用 Windows 安装程序安装到程序文件文件夹需要管理权限。 事实上,对该文件夹的所有写入访问权限都需要管理员权限,这就是为什么您不应再将数据存储在与可执行文件相同的文件夹中。
幸运的是,如果您使用 .Net,则可以使用 ClickOnce 部署而不是 msi,这应该允许您安装到每个用户配置文件中的文件夹,而无需管理员权限。
Vista is more restrictive about this kind of thing, so if you can't do it for XP you can bet Vista won't let you either.
You are right that installing to the program files folder using windows installer requires administrative permissions. In fact, all write access to that folder requires admin permsissions, which is why you should no longer store your data in the same folder as your executable.
Fortunately, if you're using .Net you can use ClickOnce deployment instead of an msi, which should allow you to install to a folder in each user's profile without requiring admin permissions.
据我所知,执行此操作的唯一方法是在 .NET 2.0+ 中构建 ClickOnce 应用程序。
如果应用程序的用户安装了正确的先决条件,则可以“启动”应用程序。
查看:
The only way that I know of to do this is to build a ClickOnce application in .NET 2.0+
If the user of your application has the correct pre-requsits installed then the application can just be "launched".
Check out:
ClickOnce 很好地解决了这个问题。 如果您转到“项目属性”> 发布,您可以为此进行设置。 特别是,“安装模式和设置”值得一看:
您实际上不必使用 ClickOnce Web 部署内容。 如果您执行“构建”> 发布,然后压缩publish\文件夹的内容,您可以有效地将其作为安装程序分发。 为了使其更加顺利,请从自动运行 setup.exe 文件的文件夹中创建自解压存档。
即使您以这种方式安装,如果您选择使用它,在线更新仍然适用于该应用程序。 您所要做的就是将 ClickOnce 文件放到网上,并将 URL 放入项目的发布属性页面中。
ClickOnce is a good solution to this problem. If you go to Project Properties > Publish, you can setup settings for this. In particular, "Install Mode and Settings" is good to look at:
You don't actually have to use the ClickOnce web deployment stuff. If you do a Build > Publish, and then zip up the contents of the publish\ folder, you can effectively distribute that as an installer. To make it even smoother, create a self-extracting archive from the folder that automatically runs the setup.exe file.
Even if you install this way, if you opt to use it, the online update will still work for the application. All you have to do is put the ClickOnce files online, and put the URL in the project's Publish properties page.