dotnet / dotnet/msbuild

Accept command line parameters from environment variable

Open
#5,005 3 comments 3 reactions 0 assignees View on GitHub
needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Some tools have a handy (hidden?) feature that you can pass them command line parameters through the environment.

For example, the Microsoft C++ compiler accepts them through `_CL_` and the linker through `_LINK_`. This can be super handy for adding temporary flags when you don't (easily) control the invocation such as when it's inside a script, batch file, or makefile. For example in the case of the compiler you can use it to preprocess a file with the same defines as the real build, or to get timing information.

This would also be useful for MSBuild. Right now I'm looking at the build of dotnet/runtime. I want to temporarily add a verbose logger like `/flp6:v=diag`. Right now to do this I have to dig through a chain of batch files, shell scripts, powershell scripts, and/or cmake files to find the 10 or more places where MSBuild may be launched within these and paste in the flag. This also adds noise in my diff. Later, I have to revert it as well.

If I could just do `set _MSBUILD_=/flp6:v=diag` it would solve all these problems.

I offer a proposed implementation in case you believe this is worthwhile.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.