Microsoft.CppBuild.targets with over 100 warnings – Chris Martin

So I’ve decided to take on a favorite task, loved by developers the world over.  Upgrading projects to the latest version of the IDE. One of them had to make the trek from Visual Studio .NET (yes you just read that correctly) all the way up to Visual Studio 2010.  Everything was moving a long quite nicely.  Just down to identifying a ton of warnings now being thrown when I build the project.  To my amazement it really seemed Microsoft.CppBuild.targets had a fit.  There were so many warnings related to this document that Visual Studio had to stop reporting them (as the final warning for that document stated). So 101 warnings in a framework file tucked away in C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0.  Clearly something we, as developers, don’t have control over. Something really odd is going on here.  My suspicion is the project migration failed in some glorious way.  Reviewed the upgrade logs and nothing of note there.  So onto google!

Google didn’t give me much in the way of answers.  Ran into two tickets with Microsoft regarding the errors I’m seeing.  Both of which didn’t have any answers, and both of which were closed as non-reproducible.

Did some more poking around and by luck came across this question over on stackoverflow.

So it seems someone else if having build issues with Visual Studio 2008.  So I figure i’ll give compiling at the command line a shot.  So I open the Visual Studio 2010 command prompt as administrator. You can probably do this without administrator rights, I just opened it as administrator out of habit.  I navigated to my project and executed:

msbuild win32.sln /nologo /p:Configuration=Release /t:rebuild /val

Watched the display messages fly by.  Everything builds find.  Re-opened the project in Visual Studio 2010, and all my warnings are gone. Even some that I originally intended to keep around. So in addition to apparently repairing my problem, it also added the _CRT_SECURE_NO_WARNINGS preprocessor definition.  So all my warnings about using “older and less secure” functions do not show up.  I do want to keep those so I can address them, so I removed the flag and I’m back to where I wanted to be.

Not sure how or why that did the trick. Documentation on the /val flag doesn’t shed any light on why, and the rest of the flags are pretty standard when using msbuild.

So, have you run into this problem?  Did using the above command line on your solution do the trick as well? Insights or thoughts? Feel free to drop them in the comments below.

1 thought on “Microsoft.CppBuild.targets with over 100 warnings – Chris Martin

  1. I ran into this issue with an old VS6 project that was migrated to VS2013. The above command line fixed the issue, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.