简体   繁体   中英

Pass Custom Build Step variables to batch script in Visual Studio

Is there a way to make sure that all of the environment variables from MSBuild are propagated to the batch scripts that I am calling from my custom build steps? It would be really nice to use variables like %CONFIGURATION% and %TARGETPATH% in the batch files...

Not OOTB - you'll see lots of cases where chaining of build steps selectively whitelists batches of eg 50 parameters.

The problem is that 'properties' ion MSBuild includes variables, input environment variables and much more, which would quickly overflow the OS limits (and sensible maximums) on environment size.

You could whack a pile of SET s together with a WriteLinesToFile and/or invoke a batch file tha has such SET statements.

Another approach, if you're using 4.0 is to use the PowerShell task to create a cusotm script inline and execute it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM