Visual Studio属性页环境变量 [英] Visual Studio Property Pages Environment Variables

查看:352
本文介绍了Visual Studio属性页环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您右键单击解决方案资源管理器中的项目,然后转到常规 - >调试,则有一个环境部分,您可以使用语法NAME = VALUE设置环境变量。我的问题是,如果我尝试创建一个新的环境变量似乎没有真正的工作或设置。有谁有任何经验吗?我只想设置一个环境变量,所以我可以在这样的自定义构建步骤中使用它:

If you right click on a project in solution explorer and go to General -> Debugging there is an Environment section where you should be able to set environment variables using the syntax NAME=VALUE. My problem is that if I try to create a new environment variable there it doesn't seem to actually work or get set. Does anyone have any experience with this? I just want to set an environment variable so I can use it in custom build steps like this:

环境变量

LANGUAGE_VAR=en_us

自定义构建步骤

copy $(InputPath) $(outDir)\%LANGUAGE_VAR%\$(InputFileName)

类似的东西
这个MSDN页面很有用,但我无法让它工作:
http://msdn.microsoft.com/en-us/library/ms173406.aspx#1

推荐答案

其实我发现对我来说非常有帮助,我要去Property Manager - >选择所有项目继承的属性页面 - >双击打开属性页面编辑器 - >点击User Macros - > Add一个宏,并将其定义为NAME和VALUE。

Actually what I found that was very helpful to me was going to Property Manager -> Select the property pages that all my projects inherit -> Double click to open the property pages editor -> Click User Macros -> Add a macro and define it's NAME and VALUE.

现在,在自定义构建步骤中,我可以参考该宏。

Now in my custom build steps I can refer to that macro.

所以如果我的宏是LANGUAGE = en_us,我可以运行一个构建并构建我想要的所有en_us的东西。如果我回到属性管理器并将LANGUAGE的值更改为es_es,那么我可以运行一个构建,我的构建步骤将获得es_es而不是en_us。我希望这不是太混乱。 PM如果你有这个问题,不知道我在说什么。

So if my macro was LANGUAGE=en_us I can run a build and build out all the en_us stuff I want. If I go back to Property Manager and change the value of LANGUAGE to es_es then I can run a build and my build steps will get es_es instead of en_us. I hope that isn't too confusing. PM me if you have this problem and don't know what I'm talking about.

这篇关于Visual Studio属性页环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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