是否可以通过visual studio中的环境变量引用另一个应用程序?

时间:2022-09-27 23:12:20

Here is the scenario.

这是场景。

I have application A, which is a add-on tool of application B (a third party product). I need to install a file in a directory of application B during the install of app A (Using Visual Studio 2005). I know the default directory location of app B, but the user could change that location during the install of app B. App B also sets an Environment variable of its location.

我有应用程序A,它是应用程序B(第三方产品)的附加工具。我需要在安装应用程序A(使用Visual Studio 2005)期间在应用程序B的目录中安装文件。我知道应用B的默认目录位置,但用户可以在安装应用B期间更改该位置。应用B还设置其位置的环境变量。

Is there any way I can use the System Environment variable that shows me the location of App B in my Visual Studio 2005 Setup project for App A to install that file correctly?

有没有什么办法可以使用System Environment变量向我展示应用程序A在我的Visual Studio 2005安装项目中的位置,以便App A正确安装该文件?

1 个解决方案

#1


Yes you can as long as the environment variable is a system environment variable. If it is a user environment variable, the user deploying the app A and B should be the same for you to access that during the deployment of app B. You may use System.Environment class in C# to access the environment variables.

是的,只要环境变量是系统环境变量就可以。如果它是用户环境变量,则在部署应用程序B期间,部署应用程序A和B的用户应该是相同的。您可以使用C#中的System.Environment类来访问环境变量。

#1


Yes you can as long as the environment variable is a system environment variable. If it is a user environment variable, the user deploying the app A and B should be the same for you to access that during the deployment of app B. You may use System.Environment class in C# to access the environment variables.

是的,只要环境变量是系统环境变量就可以。如果它是用户环境变量,则在部署应用程序B期间,部署应用程序A和B的用户应该是相同的。您可以使用C#中的System.Environment类来访问环境变量。