aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2020-11-03 23:56:19 +0100
committerMiguel Costa <miguel.costa@qt.io>2020-11-17 09:55:33 +0000
commitde92ff14fe4ac187485fd3f7f7642e1bd4842f82 (patch)
treeca906845f2b209204681ab84096e1634fc9c4fac /src
parent71bf3c0407da2b2c0562ef4e64007f575ce6899a (diff)
Rework text template processing
Modified text template code to allow integration with build targets (i.e. process text templates during build) and also allow processing from outside of the VS IDE (i.e. if building the VS Tools solution from the command line). Task-number: QTVSADDINBUG-735 Change-Id: I115575cfba7bf3899e6d01a256b640631402c4dc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/common.tt61
-rw-r--r--src/qtappwrapper/QtAppWrapper.csproj1
-rw-r--r--src/qtprojectlib/QtProjectLib.csproj1
-rw-r--r--src/qttemplates/console/Console.csproj1
-rw-r--r--src/qttemplates/designer/Designer.csproj1
-rw-r--r--src/qttemplates/dialogbuttonbottom/DialogButtonBottom.csproj1
-rw-r--r--src/qttemplates/dialogbuttonright/DialogButtonRight.csproj1
-rw-r--r--src/qttemplates/empty/Empty.csproj1
-rw-r--r--src/qttemplates/gui/Gui.csproj1
-rw-r--r--src/qttemplates/lib/Lib.csproj1
-rw-r--r--src/qttemplates/mainwindow/MainWindow.csproj1
-rw-r--r--src/qttemplates/qml/QMLFile.csproj1
-rw-r--r--src/qttemplates/qmldir/QMLDir.csproj1
-rw-r--r--src/qttemplates/quick/Quick.csproj1
-rw-r--r--src/qttemplates/resource/Resource.csproj1
-rw-r--r--src/qttemplates/server/Server.csproj1
-rw-r--r--src/qttemplates/widget/Widget.csproj1
-rw-r--r--src/qtvstools.regexpr/QtVsTools.RegExpr.csproj1
-rw-r--r--src/qtvstools/QtVsTools.csproj10
-rw-r--r--src/qtwizard/QtVsTools.Wizards.csproj1
-rw-r--r--src/tests/CoreFeatures/CoreFeatures.vcxproj1
-rw-r--r--src/tests/Test_QtVsTools.RegExpr/Test_QtVsTools.RegExpr.csproj1
-rw-r--r--src/transform.targets33
-rw-r--r--src/version.tt2
-rw-r--r--src/vsqml/vsqml.vcxproj1
25 files changed, 103 insertions, 24 deletions
diff --git a/src/common.tt b/src/common.tt
index d8edd875..f8ba7d71 100644
--- a/src/common.tt
+++ b/src/common.tt
@@ -39,29 +39,56 @@
** $QT_END_LICENSE$
**
****************************************************************************/
- var Dte = ((IServiceProvider)Host).GetService(typeof(DTE)) as DTE;
- string SolutionDir = Path.GetDirectoryName(Dte.Solution.FullName);
- string VS_VERSION = Dte.Version;
+ var Dte = ((IServiceProvider)Host)?.GetService(typeof(DTE)) as DTE;
+
+ string SolutionDir = Host?.ResolveParameterValue("-", "-", "SolutionDir");
+ if (string.IsNullOrEmpty(SolutionDir)) {
+ if (Dte != null)
+ SolutionDir = Path.GetDirectoryName(Dte.Solution.FullName);
+ else
+ throw new Exception("Unable to obtain 'SolutionDir' parameter.");
+ }
+
+ string VS_VERSION = Host?.ResolveParameterValue("-", "-", "VisualStudioVersion");
+ if (string.IsNullOrEmpty(VS_VERSION)) {
+ if (Dte != null)
+ VS_VERSION = Dte.Version;
+ else
+ throw new Exception("Unable to obtain 'VisualStudioVersion' parameter.");
+ }
+
string VS_NAME = VS_VERSION.StartsWith("16.") ? "2019" :
- VS_VERSION.StartsWith("15.") ? "2017" :
- VS_VERSION.StartsWith("14.") ? "2015" :
- VS_VERSION.StartsWith("12.") ? "2013" : "????";
- string VS_EDITION = Dte.Edition;
- string VC_TARGETS_PATH = Path.Combine(
- Environment.GetEnvironmentVariable("ProgramFiles(x86)"),
- VS_VERSION.StartsWith("16.") ?
- @"Microsoft Visual Studio\2019\" + VS_EDITION + @"\MSBuild\Microsoft\VC\v160" :
- VS_VERSION.StartsWith("15.") ?
- @"Microsoft Visual Studio\2017\" + VS_EDITION + @"\Common7\IDE\VC\VCTargets" :
- VS_VERSION.StartsWith("14.") ?
- @"MSBuild\Microsoft.Cpp\v4.0\V140" :
- VS_VERSION.StartsWith("12.") ?
- @"MSBuild\Microsoft.Cpp\v4.0\V120" : null);
+ VS_VERSION.StartsWith("15.") ? "2017" :
+ VS_VERSION.StartsWith("14.") ? "2015" :
+ VS_VERSION.StartsWith("12.") ? "2013" : "????";
+
+ string VC_TARGETS_PATH = Host?.ResolveParameterValue("-", "-", "VCTargetsPath");
+ if (string.IsNullOrEmpty(VC_TARGETS_PATH)) {
+ if (Dte != null && !string.IsNullOrEmpty(VS_VERSION)) {
+ string VS_EDITION = Dte.Edition;
+ VC_TARGETS_PATH = Path.Combine(
+ Environment.GetEnvironmentVariable("ProgramFiles(x86)"),
+ VS_VERSION.StartsWith("16.") ?
+ @"Microsoft Visual Studio\2019\" + VS_EDITION + @"\MSBuild\Microsoft\VC\v160" :
+ VS_VERSION.StartsWith("15.") ?
+ @"Microsoft Visual Studio\2017\" + VS_EDITION + @"\Common7\IDE\VC\VCTargets" :
+ VS_VERSION.StartsWith("14.") ?
+ @"MSBuild\Microsoft.Cpp\v4.0\V140" :
+ VS_VERSION.StartsWith("12.") ?
+ @"MSBuild\Microsoft.Cpp\v4.0\V120" : null);
+ } else {
+ throw new Exception("Unable to obtain 'VCTargetsPath' parameter.");
+ }
+ }
+
/***************************************************************************/
string WARNING_GENERATED_FILE = "This file was generated automatically.";
string XML_COMMENT_BEGIN = "<!--";
string XML_COMMENT_END = "-->";
+ XML_COMMENT_BEGIN = XML_COMMENT_BEGIN.ToString();
+ XML_COMMENT_END = XML_COMMENT_END.ToString();
+
var XmlLoad = new Func<string, XElement>(xmlText =>
{
XDocument xmlDoc = null;
diff --git a/src/qtappwrapper/QtAppWrapper.csproj b/src/qtappwrapper/QtAppWrapper.csproj
index d2e63d8d..cb9d59e9 100644
--- a/src/qtappwrapper/QtAppWrapper.csproj
+++ b/src/qtappwrapper/QtAppWrapper.csproj
@@ -64,6 +64,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
diff --git a/src/qtprojectlib/QtProjectLib.csproj b/src/qtprojectlib/QtProjectLib.csproj
index 8fcb787b..6f3c8c04 100644
--- a/src/qtprojectlib/QtProjectLib.csproj
+++ b/src/qtprojectlib/QtProjectLib.csproj
@@ -131,6 +131,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="..\config\$(VisualStudioVersion)\qtvstools.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/console/Console.csproj b/src/qttemplates/console/Console.csproj
index 3ba880d6..ce96ff81 100644
--- a/src/qttemplates/console/Console.csproj
+++ b/src/qttemplates/console/Console.csproj
@@ -90,6 +90,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/designer/Designer.csproj b/src/qttemplates/designer/Designer.csproj
index ea5e908e..d92413b3 100644
--- a/src/qttemplates/designer/Designer.csproj
+++ b/src/qttemplates/designer/Designer.csproj
@@ -97,6 +97,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/dialogbuttonbottom/DialogButtonBottom.csproj b/src/qttemplates/dialogbuttonbottom/DialogButtonBottom.csproj
index bfa70d23..41ee17fe 100644
--- a/src/qttemplates/dialogbuttonbottom/DialogButtonBottom.csproj
+++ b/src/qttemplates/dialogbuttonbottom/DialogButtonBottom.csproj
@@ -74,6 +74,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/dialogbuttonright/DialogButtonRight.csproj b/src/qttemplates/dialogbuttonright/DialogButtonRight.csproj
index 407d114c..9ec45455 100644
--- a/src/qttemplates/dialogbuttonright/DialogButtonRight.csproj
+++ b/src/qttemplates/dialogbuttonright/DialogButtonRight.csproj
@@ -73,6 +73,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/empty/Empty.csproj b/src/qttemplates/empty/Empty.csproj
index 06a3ea78..6bc075f7 100644
--- a/src/qttemplates/empty/Empty.csproj
+++ b/src/qttemplates/empty/Empty.csproj
@@ -88,6 +88,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/gui/Gui.csproj b/src/qttemplates/gui/Gui.csproj
index 323ecdaa..8aeaae90 100644
--- a/src/qttemplates/gui/Gui.csproj
+++ b/src/qttemplates/gui/Gui.csproj
@@ -94,6 +94,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/lib/Lib.csproj b/src/qttemplates/lib/Lib.csproj
index 3770bdb3..d0233fcb 100644
--- a/src/qttemplates/lib/Lib.csproj
+++ b/src/qttemplates/lib/Lib.csproj
@@ -95,6 +95,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/mainwindow/MainWindow.csproj b/src/qttemplates/mainwindow/MainWindow.csproj
index 9d159309..6ce86a14 100644
--- a/src/qttemplates/mainwindow/MainWindow.csproj
+++ b/src/qttemplates/mainwindow/MainWindow.csproj
@@ -74,6 +74,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/qml/QMLFile.csproj b/src/qttemplates/qml/QMLFile.csproj
index 6aa5f3f4..d93768e8 100644
--- a/src/qttemplates/qml/QMLFile.csproj
+++ b/src/qttemplates/qml/QMLFile.csproj
@@ -78,6 +78,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/qmldir/QMLDir.csproj b/src/qttemplates/qmldir/QMLDir.csproj
index 2885849f..e951f695 100644
--- a/src/qttemplates/qmldir/QMLDir.csproj
+++ b/src/qttemplates/qmldir/QMLDir.csproj
@@ -78,6 +78,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/quick/Quick.csproj b/src/qttemplates/quick/Quick.csproj
index 7be72b4d..a1e6c62e 100644
--- a/src/qttemplates/quick/Quick.csproj
+++ b/src/qttemplates/quick/Quick.csproj
@@ -94,5 +94,6 @@
<Content Include="main.qml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> \ No newline at end of file
diff --git a/src/qttemplates/resource/Resource.csproj b/src/qttemplates/resource/Resource.csproj
index 42750cea..f85ead05 100644
--- a/src/qttemplates/resource/Resource.csproj
+++ b/src/qttemplates/resource/Resource.csproj
@@ -78,6 +78,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/server/Server.csproj b/src/qttemplates/server/Server.csproj
index 0db95147..506a3187 100644
--- a/src/qttemplates/server/Server.csproj
+++ b/src/qttemplates/server/Server.csproj
@@ -97,6 +97,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qttemplates/widget/Widget.csproj b/src/qttemplates/widget/Widget.csproj
index 91cf7755..a8e9769a 100644
--- a/src/qttemplates/widget/Widget.csproj
+++ b/src/qttemplates/widget/Widget.csproj
@@ -73,6 +73,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/qtvstools.regexpr/QtVsTools.RegExpr.csproj b/src/qtvstools.regexpr/QtVsTools.RegExpr.csproj
index 3cd9412c..7a5a47e9 100644
--- a/src/qtvstools.regexpr/QtVsTools.RegExpr.csproj
+++ b/src/qtvstools.regexpr/QtVsTools.RegExpr.csproj
@@ -94,4 +94,5 @@
<None Include="README" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
</Project> \ No newline at end of file
diff --git a/src/qtvstools/QtVsTools.csproj b/src/qtvstools/QtVsTools.csproj
index 4cbdfe8e..74dd0959 100644
--- a/src/qtvstools/QtVsTools.csproj
+++ b/src/qtvstools/QtVsTools.csproj
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="$(VisualStudioVersion)" DefaultTargets="CheckT4Templates;Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props" Condition="'$(VisualStudioVersion)' == '14.0' AND Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" />
+<Project ToolsVersion="$(VisualStudioVersion)" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(SolutionDir)\version.targets" />
<PropertyGroup>
<VsixVersion Condition="'$(VsixVersion)' == ''">$(QtVSToolsVersion)</VsixVersion>
@@ -531,6 +531,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="..\config\$(VisualStudioVersion)\qtvstools.targets" />
<Import Project="..\config\qtvstools.afterbuild.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
@@ -836,7 +837,4 @@
<SubType>Designer</SubType>
</Content>
</ItemGroup>
- <Target Name="CheckT4Templates" BeforeTargets="Build" Inputs="%(T4Template.FullPath);%(T4Template.DependsOn)" Outputs="@(T4Template->'%(OutputFile)')">
- <Error Text="T4 template '%(T4Template.FullPath)' out-of-date; update by selecting &quot;Build&quot; &gt; &quot;Transform All T4 Templates&quot;" />
- </Target>
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/qtwizard/QtVsTools.Wizards.csproj b/src/qtwizard/QtVsTools.Wizards.csproj
index 000aacc6..d9076b44 100644
--- a/src/qtwizard/QtVsTools.Wizards.csproj
+++ b/src/qtwizard/QtVsTools.Wizards.csproj
@@ -189,6 +189,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Import Project="..\config\$(VisualStudioVersion)\qtvstools.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/tests/CoreFeatures/CoreFeatures.vcxproj b/src/tests/CoreFeatures/CoreFeatures.vcxproj
index 1783383f..9c433876 100644
--- a/src/tests/CoreFeatures/CoreFeatures.vcxproj
+++ b/src/tests/CoreFeatures/CoreFeatures.vcxproj
@@ -135,6 +135,7 @@
<None Include="..\macros\Test_ImportProFile.csmacro" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
diff --git a/src/tests/Test_QtVsTools.RegExpr/Test_QtVsTools.RegExpr.csproj b/src/tests/Test_QtVsTools.RegExpr/Test_QtVsTools.RegExpr.csproj
index 9f5eb785..52d8c8fe 100644
--- a/src/tests/Test_QtVsTools.RegExpr/Test_QtVsTools.RegExpr.csproj
+++ b/src/tests/Test_QtVsTools.RegExpr/Test_QtVsTools.RegExpr.csproj
@@ -97,6 +97,7 @@
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\transform.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
diff --git a/src/transform.targets b/src/transform.targets
new file mode 100644
index 00000000..d23423d0
--- /dev/null
+++ b/src/transform.targets
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Condition="'$(VisualStudioVersion)'=='16.0'"
+ Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v16.0\TextTemplating\Microsoft.TextTemplating.targets" />
+ <Import Condition="'$(VisualStudioVersion)'=='15.0'"
+ Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\TextTemplating\Microsoft.TextTemplating.targets" />
+ <Import Condition="'$(VisualStudioVersion)'=='14.0'"
+ Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\TextTemplating\Microsoft.TextTemplating.targets" />
+ <PropertyGroup>
+ <TransformOnBuild>true</TransformOnBuild>
+ <TransformOutOfDateOnly>true</TransformOutOfDateOnly>
+ </PropertyGroup>
+ <Target Name="PrepareTransform">
+ <ItemGroup>
+ <T4TransformInputs Include="@(T4Template)"/>
+ <T4ParameterValues Include="SolutionDir">
+ <Value>$(SolutionDir)</Value>
+ <Visible>false</Visible>
+ </T4ParameterValues>
+ <T4ParameterValues Include="VisualStudioVersion">
+ <Value>$(VisualStudioVersion)</Value>
+ <Visible>false</Visible>
+ </T4ParameterValues>
+ <T4ParameterValues Include="VCTargetsPath">
+ <Value>$(VCTargetsPath)</Value>
+ <Visible>false</Visible>
+ </T4ParameterValues>
+ </ItemGroup>
+ </Target>
+ <PropertyGroup>
+ <BeforeTransform>$(BeforeTransform);PrepareTransform</BeforeTransform>
+ </PropertyGroup>
+</Project>
diff --git a/src/version.tt b/src/version.tt
index f32dc039..e045383e 100644
--- a/src/version.tt
+++ b/src/version.tt
@@ -1,4 +1,4 @@
-<#@include file="$(SolutionDir)\common.tt" #>
+<#@include file="common.tt" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
diff --git a/src/vsqml/vsqml.vcxproj b/src/vsqml/vsqml.vcxproj
index 3b92425e..ce29d6ad 100644
--- a/src/vsqml/vsqml.vcxproj
+++ b/src/vsqml/vsqml.vcxproj
@@ -145,6 +145,7 @@
<None Include="README" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <Import Project="..\transform.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>