msbuild,如何设置环境变量? [英] msbuild, how to set environment variables?

查看:1049
本文介绍了msbuild,如何设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用项目文件(例如.vcxproj)设置环境变量

I am trying to set environment variables using project file (ex. .vcxproj)

我看过属性函数,但似乎没有这样的函数.

I looked at property functions but it didn't seem to have such function.

我知道有一种方法可以检索环境变量,但是找不到如何设置它.

I know there is a way to retrieve environment variable but couldn't find how to set it.

我觉得应该有办法在项目文件中设置环境变量.

I feel like there should be way to set environment variables in project file.

推荐答案

以下几点:

1)如果仅在MSBuild上下文中使用变量,则可以仅使用标准的MSBuild变量,而不必尝试设置环境变量

1) If you are only using the variable in the context of MSBuild, then you can just use the standard MSBuild variables instead of trying to set an environment variable

2)如果确实需要设置环境变量,那不是一件开箱即用的事情.您需要编写一个自定义任务,然后在项目文件中利用它.这是MSDN线程的链接,概述了如何执行此操作.
http://social.msdn .microsoft.com/forums/zh-CN/msbuild/thread/0fb8d97d-513e-4d37-8528-52973f65a034

2) If do need to set an env var, well, it's not an out-of-box thing. You need to write a custom task and then leverage it in the project file. Here's a link to an MSDN thread that outlines how to do this.
http://social.msdn.microsoft.com/forums/en-US/msbuild/thread/0fb8d97d-513e-4d37-8528-52973f65a034

这篇关于msbuild,如何设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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