Skip to content

Disable Visual Studio project upgrade prompt on VS2013 and above

Erik Christensen requested to merge ERock5000/cmake:master into master

When opening projects in Visual Studio that specify an older toolset version, a prompt is displayed the first time asking the user if he would like to upgrade the projects. This is an annoyance when deliberately generating projects with a certain toolset using CMake, where upgrading would be undesirable in any case -- you'd want to do that through CMake itself.

Visual Studio 2013 and above look at a global property called VCProjectUpgraderObjectName and if it is set to "NoUpgrade", the prompt will be disabled.

https://blogs.msdn.microsoft.com/dsvc/2015/12/13/migration-from-vs2012-to-vs2015-ide-only-throws-compiler-upgrade-warning/ https://connect.microsoft.com/VisualStudio/feedback/details/871523/vs-2013-keeps-upgrade-information-in-the-solution-user-options-v12-suo-file

This change automatically adds this property to all targets when using VS2013 and above as the generator. The property has no effect on earlier generators, so I opted to leave it out -- it doesn't appear to be harmful though. VS2012 will still display a prompt (it's unclear if there's a mechanism to disable it) and VS2010 won't in any case when loading a .vcxproj.

While this property can be set on a per target basis within a CMake project using the VS_GLOBAL_name property, it can't be applied to any of the auto-generated targets, so the prompt can't be eliminated that way. In any case, it seems like disabling the prompt should be the default behavior. If there's a use case for supporting the project upgrade prompt as it is now, a more sophisticated approach may be necessary.

Merge request reports