简体   繁体   English

自定义应用程序更新程序

[英]Custom Application updater

I have created a code, which compares XML files on the client side (in PC) with the XML file located on the FTP server; 我创建了一个代码,该代码将客户端(在PC中)的XML文件与FTP服务器上的XML文件进行比较; where once it detects that client is running older version of the program, it will download the latest build (so that user has always up to date program). 一旦它检测到客户端正在运行较旧版本的程序,它将下载最新版本(以便用户始终具有最新程序)。

Here is the trick. 这是窍门。 Due to the fact, that I am overwriting files at run-time, I had to create an external console application which is being called from the main app if user wants to update. 由于这一事实,我在运行时会覆盖文件,因此我必须创建一个外部控制台应用程序,如果用户要更新,则可以从主应用程序中调用该应用程序。 This way, first console application is executed and afterwards main app is closed, so that no files are locked by the system (application's .exe file would otherwise be locked and we could not replace it with the new one). 这样,第一个控制台应用程序将被执行,然后主应用程序将被关闭,因此系统不会锁定任何文件(否则该应用程序的.exe文件将被锁定,而我们无法将其替换为新的.exe文件)。

This process runs perfectly, if it is being installed somewhere else other than under the system folder (by that I mean eg C:\\Program Files\\ drive). 如果将其安装在系统文件夹之外的其他位置(例如, C:\\Program Files\\ drive),则该过程将完美运行。 If user has decided to install main application there, then suddenly my app crashes as it does not have admin privileges. 如果用户决定在那里安装主应用程序,那么我的应用程序突然崩溃,因为它没有管理员权限。

I am using Install Shield LE when disbursing this app, and users that are using this program are not administrators (which means that I go to every computer and type admin password when I/users install this program). 发放此应用程序时,我正在使用Install Shield LE,并且正在使用该程序的用户不是管理员(这意味着我/每位用户安装此程序时,我会进入每台计算机并输入管理员密码)。

Is there a way, how to execute my updated console application with admin rights, or how to define via Install Shield that once this app has been executed, I always want it to be executed as admin? 有没有办法通过管理员权限执行更新的控制台应用程序,或者如何通过Install Shield定义一旦该应用程序执行后,我总是希望将其作为管理员执行?

Hope that my explanation has not been confusing. 希望我的解释不会引起混淆。 I am more than happy to share additional details if necessary, as I need to figure out how to solve this thing. 如有必要,我非常乐意分享其他详细信息,因为我需要弄清楚如何解决此问题。

You'll need to add the following line to your app manifest: 您需要将以下行添加到您的应用清单中:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

Documentation on the msdn is here . 有关msdn的文档在这里

I imagine you don't have an AD configuration as Emmanuel suggest, because in this case you would push the updates without any problems and would not have to design an automatic updater. 我想您没有Emmanuel建议的AD配置,因为在这种情况下,您可以毫无问题地推送更新,也不必设计自动更新器。

I don't know if InstallShield has something like this, but Advanced Installer has the support to install a dedicated updater that runs as a service , thus it has all the permissions required to install an application under Program Files. 我不知道InstallShield是否具有这样的功能,但是Advanced Installer支持安装作为服务运行的专用更新程序 ,因此它具有在Program Files下安装应用程序所需的所有权限。

Of course this means you need to replace your updater with the one from Advanced Installer and also that the initial installation of the application on the end user machines will still require admin credentials. 当然,这意味着您需要使用Advanced Installer中的更新程序替换更新程序,并且最终用户计算机上应用程序的初始安装仍将需要管理员凭据。 (future installs can install silently, without the user's intervention) (未来的安装可以静默安装,而无需用户干预)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM