MSbuild不会扩展环境变量 [英] MSbuild doesn't expand environment variables

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

问题描述

我正在使用MSBuild从命令行构建解决方案文件.在其中,vcxproj文件的路径由环境变量FOO由%FOO%\ ProjName.vcxproj

I'm using MSBuild to build a solution file from the command line. In it, the path to the vcxproj file is specified by an environment variable FOO by %FOO%\ProjName.vcxproj

当我在IDE中打开sln时,便找到并加载了项目.当我从命令行(在同一台计算机上)使用msbuild时,出现以下错误:

When I open the sln in the IDE, I the project is found and loaded. When I use msbuild from the command line (on the same machine) I get an error of:

The Project File "C:\Blah\Blah\%FOO%\ProjName.vcxproj" was not found,

在同一命令提示符下

echo %FOO%  

为我提供正确扩展的路径.

Gives me the correctly expanded path.

推荐答案

来自评论;这是一个已知的错误,来自MS.我最终编写了一个批处理文件来复制sln文件,并扩展环境变量,进行构建并删除新的sln.工作正常.

From the comments; this is a known bug and a wontfix from MS. I ended up writing a batch file to copy the sln file and expand the environment variables, build that, and delete the new sln. Works fine.

这篇关于MSbuild不会扩展环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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