Remove ToolsVersion from generated VS projects for VS >= 2013
Before VS 2013 ToolsVersion contained a .NET version number (e.g. "4.0"). Since VS 2013 ToolsVersion is the same as the Visual Studio version number (e.g. "12.0"), which is also the default. We always wrote "4.0" (except in one special case which used "14.0"). This doesn't bother Visual Studio itself, but other tools like PVS-Studio. Remove the ToolsVersion attribute from generated VS projects for VS 2013 and newer. Task-number: QTBUG-57694 Change-Id: I7a3bc4534c492e9540f6b968bee8a969980df63f Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
5fc2337d74
commit
88a02c4d63
@ -406,7 +406,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
|
||||
xml << decl("1.0", "utf-8")
|
||||
<< tag("Project")
|
||||
<< attrTag("DefaultTargets","Build")
|
||||
<< attrTag("ToolsVersion", "4.0")
|
||||
<< attrTagToolsVersion(tool.Configuration)
|
||||
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
|
||||
<< tag("ItemGroup")
|
||||
<< attrTag("Label", "ProjectConfigurations");
|
||||
@ -550,7 +550,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
|
||||
|
||||
xmlFilter << decl("1.0", "utf-8")
|
||||
<< tag("Project")
|
||||
<< attrTag("ToolsVersion", "4.0")
|
||||
<< attrTagToolsVersion(tool.Configuration)
|
||||
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
||||
|
||||
xmlFilter << tag("ItemGroup");
|
||||
@ -603,13 +603,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
|
||||
|
||||
xml.setIndentString(" ");
|
||||
|
||||
const QString toolsVersion = (tool.SdkVersion == QLatin1String("10.0")) ? QStringLiteral("14.0")
|
||||
: QStringLiteral("4.0");
|
||||
|
||||
xml << decl("1.0", "utf-8")
|
||||
<< tag("Project")
|
||||
<< attrTag("DefaultTargets","Build")
|
||||
<< attrTag("ToolsVersion", toolsVersion)
|
||||
<< attrTagToolsVersion(tool.SingleProjects.first().Configuration)
|
||||
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
|
||||
<< tag("ItemGroup")
|
||||
<< attrTag("Label", "ProjectConfigurations");
|
||||
@ -796,7 +793,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
|
||||
|
||||
xmlFilter << decl("1.0", "utf-8")
|
||||
<< tag("Project")
|
||||
<< attrTag("ToolsVersion", "4.0")
|
||||
<< attrTagToolsVersion(tool.SingleProjects.first().Configuration)
|
||||
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
||||
|
||||
xmlFilter << tag("ItemGroup");
|
||||
@ -2056,4 +2053,11 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config)
|
||||
return QStringLiteral("'$(Configuration)|$(Platform)'=='") + config.Name + QLatin1Char('\'');
|
||||
}
|
||||
|
||||
XmlOutput::xml_output VCXProjectWriter::attrTagToolsVersion(const VCConfiguration &config)
|
||||
{
|
||||
if (config.CompilerVersion >= NET2013)
|
||||
return noxml();
|
||||
return attrTag("ToolsVersion", "4.0");
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -185,6 +185,7 @@ private:
|
||||
bool fileAdded, bool hasCustomBuildStep);
|
||||
static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName);
|
||||
static QString generateCondition(const VCConfiguration &config);
|
||||
static XmlOutput::xml_output attrTagToolsVersion(const VCConfiguration &config);
|
||||
|
||||
friend class XTreeNode;
|
||||
friend class XFlatNode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user