Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 509221d

Browse files
committed
Enhance WiX project files to better handle MSBuild15
MSBuild15 only evaluates all MSBuildExtensionPaths when the property is directly passed to MSBuild for evaluation. For more details see: dotnet/msbuild#1832 Addresses wixtoolset/issues#5525
1 parent 6f214a3 commit 509221d

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

src/Templates/v3/Projects/CustomActionCS/CustomAction.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<AssemblyName>$safeprojectname$</AssemblyName>
1313
<TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
15-
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
1615
</PropertyGroup>
1716
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1817
<DebugSymbols>true</DebugSymbols>
@@ -25,7 +24,7 @@
2524
</PropertyGroup>
2625
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
2726
<DebugType>pdbonly</DebugType>
28-
<Optimize>true</Optimize>
27+
<Optimize>true</Optimize>
2928
<OutputPath>bin\Release\</OutputPath>
3029
<DefineConstants>TRACE</DefineConstants>
3130
<ErrorReport>prompt</ErrorReport>
@@ -39,7 +38,7 @@
3938
$endif$
4039
$if$ ($targetframeworkversion$ >= 4.0)
4140
<Reference Include="Microsoft.CSharp" />
42-
$endif$
41+
$endif$
4342
<Reference Include="System.Xml"/>
4443
<Reference Include="Microsoft.Deployment.WindowsInstaller">
4544
<Private>True</Private>
@@ -51,8 +50,9 @@
5150
<Content Include="CustomAction.config" />
5251
</ItemGroup>
5352
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
54-
<Import Project="$(WixCATargetsPath)" Condition=" Exists('$(WixCATargetsPath)') " />
55-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixCATargetsPath)') ">
56-
<Error Text="The WiX Toolset build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
53+
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
54+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />
55+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixCATargetsImported)' != 'true' ">
56+
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
5757
</Target>
5858
</Project>

src/Templates/v3/Projects/CustomActionVB/CustomAction.vbproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<MyType>Windows</MyType>
15-
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
1615
</PropertyGroup>
1716
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1817
<DebugSymbols>true</DebugSymbols>
@@ -59,8 +58,9 @@ $endif$
5958
<Content Include="CustomAction.config" />
6059
</ItemGroup>
6160
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
62-
<Import Project="$(WixCATargetsPath)" Condition=" Exists('$(WixCATargetsPath)') " />
63-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixCATargetsPath)') ">
64-
<Error Text="The WiX Toolset build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
61+
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
62+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />
63+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixCATargetsImported)' != 'true' ">
64+
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
6565
</Target>
66-
</Project>
66+
</Project>

src/Templates/v3/Projects/WixBundleProject/BundleProject.wixproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
<PropertyGroup>
34
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -7,8 +8,6 @@
78
<SchemaVersion>2.0</SchemaVersion>
89
<OutputName>$safeprojectname$</OutputName>
910
<OutputType>Bundle</OutputType>
10-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix2010.targets</WixTargetsPath>
11-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix2010.targets</WixTargetsPath>
1211
</PropertyGroup>
1312
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1413
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -28,8 +27,9 @@
2827
<Name>WixBalExtension</Name>
2928
</WixExtension>
3029
</ItemGroup>
31-
<Import Project="$(WixTargetsPath)" Condition=" Exists('$(WixTargetsPath)') " />
32-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixTargetsPath)') ">
30+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
31+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
32+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
3333
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
3434
</Target>
3535
<!--

src/Templates/v3/Projects/WixLibrary/setuplibrary.wixproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
<PropertyGroup>
34
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -7,8 +8,6 @@
78
<SchemaVersion>2.0</SchemaVersion>
89
<OutputName>$safeprojectname$</OutputName>
910
<OutputType>Library</OutputType>
10-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
11-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
1211
</PropertyGroup>
1312
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1413
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -22,8 +21,9 @@
2221
<ItemGroup>
2322
<Compile Include="Library.wxs" />
2423
</ItemGroup>
25-
<Import Project="$(WixTargetsPath)" Condition=" Exists('$(WixTargetsPath)') " />
26-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixTargetsPath)') ">
24+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
25+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
26+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
2727
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
2828
</Target>
2929
<!--

src/Templates/v3/Projects/WixMergeModule/MergeModule.wixproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
<PropertyGroup>
34
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -7,8 +8,6 @@
78
<SchemaVersion>2.0</SchemaVersion>
89
<OutputName>$safeprojectname$</OutputName>
910
<OutputType>Module</OutputType>
10-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
11-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
1211
</PropertyGroup>
1312
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1413
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -22,8 +21,9 @@
2221
<ItemGroup>
2322
<Compile Include="MergeModule.wxs" />
2423
</ItemGroup>
25-
<Import Project="$(WixTargetsPath)" Condition=" Exists('$(WixTargetsPath)') " />
26-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixTargetsPath)') ">
24+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
25+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
26+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
2727
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
2828
</Target>
2929
<!--

src/Templates/v3/Projects/WixProject/SetupProject.wixproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
<PropertyGroup>
34
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -7,8 +8,6 @@
78
<SchemaVersion>2.0</SchemaVersion>
89
<OutputName>$safeprojectname$</OutputName>
910
<OutputType>Package</OutputType>
10-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
11-
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
1211
</PropertyGroup>
1312
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1413
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -22,8 +21,9 @@
2221
<ItemGroup>
2322
<Compile Include="Product.wxs" />
2423
</ItemGroup>
25-
<Import Project="$(WixTargetsPath)" Condition=" Exists('$(WixTargetsPath)') " />
26-
<Target Name="EnsureWixToolsetInstalled" Condition=" !Exists('$(WixTargetsPath)') ">
24+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
25+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
26+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
2727
<Error Text="The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
2828
</Target>
2929
<!--

0 commit comments

Comments
 (0)