vcproj / vsprops的可选环境变量 [英] Optional environment variables with vcproj/vsprops

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

问题描述

有没有办法在项目文件(有或没有vsprops)中创建一个环境变量取代,如果没有找到该变量,将替换为默认值?我没有找到任何方法来做到这一点,因为一切似乎都会覆盖环境变量。

Is there any way to make an environment variable substituion in a project file (with or without vsprops) that, if the variable is not found, is substituted instead with a default value? I haven't found any way to do this, because everything seems to override environment variables.

编辑:我需要这个来处理一个属性,而不是一个环境变量。具体来说,可以使用指定目标构建目录的环境变量从其他源调用devenv。如果该变量不存在(可能因为devenv只是被用作IDE),那么它应该使用默认值。

I need this to work for a property, not for an environment variable. Specifically, devenv may be invoked from another source with an environment variable specifying the target build directory. If that variable doesn't exist (perhaps because devenv is just being used as the IDE) then it should use a default.

我已经有了这个MSBuild的工作;我现在需要它为VCBuild工作。

I already have this working for MSBuild; I now need it working for VCBuild.

推荐答案

我知道它在技术上超出了我原来的问题的范围,但我已经走了通过编写一个附件来解决环境变量是否设置,如果不是,构造变量的默认值并存储它。这不是最优雅的解决方案,但它的作品。

I know it's technically outside the purview of my original question, but I've gone about solving this by writing an add-in that will detect if the environment variable is set and, if not, construct the variable's default value and store it. It's not the most elegant solution, but it works.

这篇关于vcproj / vsprops的可选环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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