LOG_BUILD_COMMANDLINES, see below.
MSC_CMD_FLAGS
- Geoff Chappell's seminal studies about Microsoft Visual C++, they aged well. Some of the findings he gives are still valid, some command line switches have meanwhile been documented.
- Someone going by the moniker @adeyblue found out about
LOG_BUILD_COMMANDLINESten years before I did - The Chromium build appears to use plenty of flags, some of which are not documented
- Microsoft Visual C/C++, Visual Studio tips and tricks
- Boost-MSBuild
- MSVC hidden flags (unfortunately not much "meat")
- Versions of Visual C++ and the
_MSC_VERand_MSC_FULL_VERvalues for various versions documented (archived)- BSD-2-Clause-licensed project to read the values from binaries created with MSVC (can be suppressed via
/emittoolversioninfo:noto thelink.exe)
- BSD-2-Clause-licensed project to read the values from binaries created with MSVC (can be suppressed via
- The mysterious 'Rich' header (archived)
- Performance-related resources
- Deterministic builds:
Ever wondered what command lines get effectively executed "behind" those response files used by Visual Studio and MSBuild?
LOG_BUILD_COMMANDLINES has the answer. The environment variable should be set to a file path, which will be a plain text log file receiving all those build command lines. This works even for those command lines that actually end up being invoked using response files due to command line length limitations on Windows.
The following Directory.Build.props provides a simple example of how to use this method. It uses the SetEnv MSBuild target to ensure that the environment variable gets set prior to invocation of the tools that honor the presence of this variable.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="LogBuild">
<PropertyGroup>
<ThisProjectBuildLogFileName Condition="'$(MSBuildProjectName)' == ''">$(MSBuildThisFileDirectory)BuildCommandLines.log</ThisProjectBuildLogFileName>
<ThisProjectBuildLogFileName Condition="'$(MSBuildProjectName)' != ''">$(MSBuildThisFileDirectory)BuildCommandLines-$(MSBuildProjectName).log</ThisProjectBuildLogFileName>
</PropertyGroup>
<Target Name="LogBuild" BeforeTargets="SetUserMacroEnvironmentVariables;SetBuildDefaultEnvironmentVariables">
<Message Text="Setting LOG_BUILD_COMMANDLINES='$(ThisProjectBuildLogFileName)'" />
<SetEnv Name="LOG_BUILD_COMMANDLINES" Value="$(ThisProjectBuildLogFileName)" Prefix="false" />
</Target>
</Project>
GUID_MSVC_PROVIDER:{9C642431-C036-7958-4B0E-FE163528322B}