I became extremely annoyed by thousands of these messages while running MSBuild:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy' SomeFile.cpp(###): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
I looked for the online help, which doesn’t really exist for this specific warning. I did find the Security Features in the CRT article, but that was useless. Because I’m working on a shared project, I didn’t want to manually add this #define to every project. The workaround is to add it to the *.user.props file.
Add the ItemDefinitionGroup node below to C:\Users\Jschubert\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props:
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <ResourceCompile> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> </Project>
And there you have thousands of annoying warnings disappear.
Because MSBuild always includes %(PreprocessorDefinitions) when chaining PreprocessorDefinitions, you can add any number of defines here to exist globally on your machine only.