在Visual Studio 2017安装程序中修改用户和系统变量 [英] Modify user and system variables in Visual Studio 2017 installer

查看:132
本文介绍了在Visual Studio 2017安装程序中修改用户和系统变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将程序的安装文件夹作为值附加到用户变量和系统变量的路径变量中.

I want to append the installation folder of my program as value to the path variable of user and system variables.

我听从了michaelmoo的指示. https://stackoverflow.com/a/21390793/9678802

I followed michaelmoo's instruction. https://stackoverflow.com/a/21390793/9678802

问题是路径变量的现有值将被删除.

The problem is that the existing value of path variable will be removed.

推荐答案

离题 :添加到路径中会涉及一些安全风险,有些性能问题,并可能导致应用程序干扰-可能还有其他一些问题.通常最好避免这种情况.如果部署专家可以帮助解决,这是"已知风险".

Digression: Adding to the Path involves some security risks, some performance issues, and can cause application interference - and probably a few other things. It is best avoided in general. It is a "known risk" avoided by deployment professionals - if they can help it.

The concept of AppPaths is a (partial) alternative to updating the Path environment variable. It allows your application to be started from the Start => Run dialog, but it does not work from the command line.

似乎无法在命令提示符下使用.

警告 :哦,答案确实很糟糕(向显然试图帮助他人的作者表示歉意).但是,不应以任何形式遵循该程序!实在是太危险了,以至于我看到人们把门花出去的钱少得多. Wiping out a whole developer teams' environment path with a package deployment will cause drama - that you can be sure of .在这种情况下,警告确实需要那么强烈.我已经看到了它的发生,甚至是由经验丰富的专业人员制作的程序包.

Warning: Ouch, that answer is very bad indeed (with apologies to the author who clearly tried to help others). That procedure should not be followed in any shape or form though! It is so dangerous that I have seen people sent out the door for far less. Wiping out a whole developer teams' environment path with a package deployment will cause drama - that you can be sure of. The warning really needs to be that strong in this case. I have seen it happen, and even by packages made by experienced professionals.

内置支持 :就我而言,来自上面线程"的正确答案就是这个. Windows Installer内置了对添加环境变量的支持,该环境变量可以解决所有合并更新问题-甚至还具有回滚支持-这意味着如果软件包安装失败,您的环境变量将恢复到其原始状态. This built-in feature is a "must use" functionality .

Built-In Support: As far as I am concerned, the correct answer from the above "thread" is this one. Windows Installer has built-in support for adding environment variable that takes care of all merging and update issues - and it even has rollback support - meaning your environment variable will be restored to its original state should the package installation fail. This built-in feature is a "must use" functionality.

部署工具 :因此必须使用内置功能,但是当该工具不支持该功能时又该如何使用呢?最好的选择是获取实际部署工具" ,尤其是因为

Deployment Tool: So the built-in feature has to be used, but how when the tool does not support it? The best option is to get a "real deployment tool", especially since there are several further problems with the Visual Studio Installer Projects (Note: this is not pitching products, it is telling people about serious pitfalls that will cause real problems in almost all cases - what product you choose is up to you - obviously - but the VS Installer Project just isn't a complete solution).

WiX :使用WiX更新Path变量非常简单.以及环境元素的文档.

Orca :尽管可以对已编译的MSI进行后处理",并在

Orca: Though it is possible to "post-process" your compiled MSI and create the required entry in the Environment table, I would recommend that you use a proper tool instead that has been tested and designed to help you succeed in general. A comma wrong or a star wrong in the Environment table and you get completely wrong behavior.

这篇关于在Visual Studio 2017安装程序中修改用户和系统变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆