MSbuild does not expand environment variables

I am using MSBuild to create a solution file from the command line. In it, the path to the vcxproj file is set by the environment variable FOO at% FOO% \ ProjName.vcxproj

When I open sln in the IDE, I discover and load the project. When I use msbuild from the command line (on the same machine) I get the error:

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

      

On the same command line

echo %FOO%  

      

Gives me a properly expanded path.

+3


source to share


1 answer


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



+1


source







All Articles