@joebigelow / wix-1 / commits / 80326388

Remove support for importing WixToolset.Sdk via PackageReference

The WixToolset.Sdk is an MSBuild project SDK. It should be imported using the Sdk.props. Allowing it to be imported via PackageReference is unnecessary and creates double import problems. Prevent such imports to point WiX users that don't understand the new MSBuild functionality in the right direction. Fixes 7148

Rob Mensching committed Jan 11, 2023 at 20:21 UTC 80326388ce249e92874ed97193c4be4fec25d790
16 files changed +27 -173
src/wix/WixToolset.Sdk/Sdk/Sdk.props
+1
@@ -3,6 +3,7 @@
3
4 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <PropertyGroup>
6 + <WixSdkPropsImported>true</WixSdkPropsImported>
7 <WixPropsPath Condition=" '$(WixPropsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.props'))</WixPropsPath>
8 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.targets'))</WixTargetsPath>
9 </PropertyGroup>
src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj
-1
@@ -11,7 +11,6 @@
11 </PropertyGroup>
12
13 <ItemGroup>
14 - <Content Include="build\$(MSBuildThisFileName).props" CopyToOutputDirectory="PreserveNewest" />
14 <Content Include="build\$(MSBuildThisFileName).targets" CopyToOutputDirectory="PreserveNewest" />
15 <Content Include="tools\WixToolset.Signing.props" CopyToOutputDirectory="PreserveNewest" />
16 <Content Include="tools\WixToolset.Signing.targets" CopyToOutputDirectory="PreserveNewest" />
src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props deleted
-11
@@ -1,11 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3 -
4 -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 - <PropertyGroup>
6 - <WixPropsPath Condition=" '$(WixPropsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.props'))</WixPropsPath>
7 - <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.targets'))</WixTargetsPath>
8 - </PropertyGroup>
9 -
10 - <Import Project="$(WixPropsPath)" Condition=" '$(WixPropsPath)' != '' and Exists('$(WixPropsPath)')" />
11 -</Project>
src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets
+5 -2
@@ -1,6 +1,9 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4 -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 - <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' and Exists('$(WixTargetsPath)')" />
4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="_CannotPackageReferenceWixToolsetSdk" >
5 + <Target Name="_CannotPackageReferenceWixToolsetSdk"
6 + Condition=" '$(WixSdkPropsImported)' == 'true' ">
7 + <Error Text="The WixToolset.Sdk is an MSBuild project SDK and cannot be referenced using a PackageReference. See the MSBuild documentation how to use SDKs https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk" />
8 + </Target>
9 </Project>
src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs
+7 -7
@@ -12,7 +12,7 @@ namespace WixToolsetTest.Sdk
12 public class MsbuildFixture
13 {
14 public static readonly string WixMsbuildPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildFixture).Assembly.CodeBase).LocalPath), "..", "..", "..", "publish", "WixToolset.Sdk");
15 - public static readonly string WixPropsPath = Path.Combine(WixMsbuildPath, "build", "WixToolset.Sdk.props");
15 + public static readonly string WixPropsPath = Path.Combine(WixMsbuildPath, "Sdk", "Sdk.props");
16
17 [Theory]
18 [InlineData(BuildSystem.DotNetCoreSdk)]
@@ -63,7 +63,7 @@ namespace WixToolsetTest.Sdk
63 [InlineData(BuildSystem.MSBuild64)]
64 public void CanBuildUncompressedBundle(BuildSystem buildSystem)
65 {
66 - var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage");
66 + var sourceFolder = TestData.Get("TestData", "SimpleMsiPackage");
67
68 using (var fs = new TestDataFolderFileSystem())
69 {
@@ -106,7 +106,7 @@ namespace WixToolsetTest.Sdk
106 [InlineData(BuildSystem.MSBuild64)]
107 public void CanBuildSimpleMergeModule(BuildSystem buildSystem)
108 {
109 - var sourceFolder = TestData.Get(@"TestData\MergeModule\SimpleMergeModule");
109 + var sourceFolder = TestData.Get("TestData", "MergeModule", "SimpleMergeModule");
110
111 using (var fs = new TestDataFolderFileSystem())
112 {
@@ -199,7 +199,7 @@ namespace WixToolsetTest.Sdk
199 [InlineData(BuildSystem.MSBuild64)]
200 public void CanBuildSimpleMsiPackageWithMergeModule(BuildSystem buildSystem)
201 {
202 - var sourceFolder = TestData.Get(@"TestData\MergeModule");
202 + var sourceFolder = TestData.Get(@"TestData", "MergeModule");
203
204 using (var fs = new TestDataFolderFileSystem())
205 {
@@ -390,7 +390,7 @@ namespace WixToolsetTest.Sdk
390 [InlineData(BuildSystem.MSBuild64)]
391 public void CanBuildMsiPackageWithIceSuppressions(BuildSystem buildSystem)
392 {
393 - var sourceFolder = TestData.Get(@"TestData\MsiPackageWithIceError\MsiPackage");
393 + var sourceFolder = TestData.Get("TestData", "MsiPackageWithIceError", "MsiPackage");
394
395 using (var fs = new TestDataFolderFileSystem())
396 {
@@ -414,7 +414,7 @@ namespace WixToolsetTest.Sdk
414 [InlineData(BuildSystem.MSBuild64)]
415 public void CanBuildSimpleMsiPackageWithWarningSuppressions(BuildSystem buildSystem)
416 {
417 - var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
417 + var sourceFolder = TestData.Get("TestData", "SimpleMsiPackage", "MsiPackage");
418
419 using (var fs = new TestDataFolderFileSystem())
420 {
@@ -738,7 +738,7 @@ namespace WixToolsetTest.Sdk
738
739 private void AssertWixpdb(BuildSystem buildSystem, string debugType, string[] expectedOutputFiles)
740 {
741 - var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
741 + var sourceFolder = TestData.Get("TestData", "SimpleMsiPackage", "MsiPackage");
742
743 using (var fs = new TestDataFolderFileSystem())
744 {
src/wix/test/WixToolsetTest.Sdk/TestData/MergeModule/MergeMsiPackage/MergeMsiPackage.wixproj
+3 -32
@@ -1,44 +1,15 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
8 </PropertyGroup>
9
9 - <PropertyGroup>
10 - <ProjectGuid>{B00939D5-7952-4ADF-BEB1-507D227B2FE2}</ProjectGuid>
11 - </PropertyGroup>
12 -
13 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
14 - <PlatformName>$(Platform)</PlatformName>
15 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
16 - <DefineConstants>Debug</DefineConstants>
17 - </PropertyGroup>
18 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
19 - <PlatformName>$(Platform)</PlatformName>
20 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
21 - </PropertyGroup>
22 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
23 - <PlatformName>$(Platform)</PlatformName>
24 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
25 - <DefineConstants>Debug</DefineConstants>
26 - </PropertyGroup>
27 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
28 - <PlatformName>$(Platform)</PlatformName>
29 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 - </PropertyGroup>
31 -
32 - <ItemGroup>
33 - <Compile Include="Package.wxs" />
34 - </ItemGroup>
35 -
10 <ItemGroup>
37 - <ProjectReference Include="..\SimpleMergeModule\SimpleMergeModule.wixproj">
38 - <Name>SimpleMergeModule</Name>
39 - <Project>{9F84998B-7F45-4CB3-8795-915801DBBB74}</Project>
40 - </ProjectReference>
11 + <ProjectReference Include="..\SimpleMergeModule\SimpleMergeModule.wixproj" />
12 </ItemGroup>
13
14 <Import Project="$(WixTargetsPath)" />
44 -</Project>
\ No newline at end of file
15 +</Project>
src/wix/test/WixToolsetTest.Sdk/TestData/MergeModule/SimpleMergeModule/SimpleMergeModule.wixproj
+2 -5
@@ -1,6 +1,7 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -30,13 +31,9 @@
31 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
32 </PropertyGroup>
33
33 - <ItemGroup>
34 - <Compile Include="MergeModule.wxs" />
35 - </ItemGroup>
36 -
34 <ItemGroup>
35 <BindInputPaths Include="data" />
36 </ItemGroup>
37
38 <Import Project="$(WixTargetsPath)" />
42 -</Project>
\ No newline at end of file
39 +</Project>
src/wix/test/WixToolsetTest.Sdk/TestData/MsiPackageWithBindVariables/MsiPackageWithBindVariables.wixproj
+1 -2
@@ -1,12 +1,11 @@
1 <Project>
2 <Import Project="$(WixMSBuildProps)" />
3 +
4 <PropertyGroup>
5 <WixVariables>DataFolderVar=data</WixVariables>
6 </PropertyGroup>
7
8 <ItemGroup>
8 - <Compile Include="Package.wxs" />
9 -
9 <BindVariable Include="VersionVar=1.2.3" />
10 </ItemGroup>
11
src/wix/test/WixToolsetTest.Sdk/TestData/MsiPackageWithIceError/MsiPackage/MsiPackage.wixproj
+1 -14
@@ -6,10 +6,6 @@
6 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
7 </PropertyGroup>
8
9 - <PropertyGroup>
10 - <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid>
11 - </PropertyGroup>
12 -
9 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
10 <PlatformName>$(Platform)</PlatformName>
11 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
@@ -30,16 +26,7 @@
26 </PropertyGroup>
27
28 <ItemGroup>
33 - <Compile Include="Package.wxs" />
34 - <Compile Include="PackageComponents.wxs" />
35 - </ItemGroup>
36 -
37 - <ItemGroup>
38 - <EmbeddedResource Include="Package.en-us.wxl" />
39 - </ItemGroup>
40 -
41 - <ItemGroup>
42 - <BindInputPaths Include="data" />
29 + <BindPath Include="data" />
30 </ItemGroup>
31
32 <Import Project="$(WixTargetsPath)" />
src/wix/test/WixToolsetTest.Sdk/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj
-11
@@ -5,17 +5,6 @@
5 <Cultures>en-US,en;de-DE</Cultures>
6 </PropertyGroup>
7
8 - <ItemGroup>
9 - <Compile Include="Package.wxs" />
10 - <Compile Include="PackageComponents.wxs" />
11 - </ItemGroup>
12 -
13 - <ItemGroup>
14 - <EmbeddedResource Include="Package.en-us.wxl" />
15 - <EmbeddedResource Include="Package.en.wxl" />
16 - <EmbeddedResource Include="Package.de-de.wxl" />
17 - </ItemGroup>
18 -
8 <ItemGroup>
9 <BindInputPaths Include="data" />
10 </ItemGroup>
src/wix/test/WixToolsetTest.Sdk/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
-9
@@ -29,15 +29,6 @@
29 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 </PropertyGroup>
31
32 - <ItemGroup>
33 - <Compile Include="Package.wxs" />
34 - <Compile Include="PackageComponents.wxs" />
35 - </ItemGroup>
36 -
37 - <ItemGroup>
38 - <EmbeddedResource Include="Package.en-us.wxl" />
39 - </ItemGroup>
40 -
32 <ItemGroup>
33 <BindInputPaths Include="data" />
34 </ItemGroup>
src/wix/test/WixToolsetTest.Sdk/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj
+2 -20
@@ -1,33 +1,15 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
8 </PropertyGroup>
9
10 <PropertyGroup>
10 - <ProjectGuid>6670d5c9-bbec-4828-ab60-4a1c0ffeb97d</ProjectGuid>
11 <OutputType>Bundle</OutputType>
12 - </PropertyGroup>
13 -
14 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
15 - <PlatformName>$(Platform)</PlatformName>
16 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
17 - <DefineConstants>Debug</DefineConstants>
18 - </PropertyGroup>
19 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
20 - <PlatformName>$(Platform)</PlatformName>
21 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
22 - </PropertyGroup>
23 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
24 - <PlatformName>$(Platform)</PlatformName>
25 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
26 - <DefineConstants>Debug</DefineConstants>
27 - </PropertyGroup>
28 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
29 - <PlatformName>$(Platform)</PlatformName>
30 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
12 + <EnableDefaultItems>false</EnableDefaultItems>
13 </PropertyGroup>
14
15 <ItemGroup>
src/wix/test/WixToolsetTest.Sdk/TestData/SimpleMsiPackage/UncompressedBundle/UncompressedBundle.wixproj
+1 -24
@@ -1,39 +1,16 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
8 </PropertyGroup>
9
10 <PropertyGroup>
10 - <ProjectGuid>6670d5c9-bbec-4828-ab60-4a1c0ffeb97d</ProjectGuid>
11 <OutputType>Bundle</OutputType>
12 </PropertyGroup>
13
14 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
15 - <PlatformName>$(Platform)</PlatformName>
16 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
17 - <DefineConstants>Debug</DefineConstants>
18 - </PropertyGroup>
19 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
20 - <PlatformName>$(Platform)</PlatformName>
21 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
22 - </PropertyGroup>
23 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
24 - <PlatformName>$(Platform)</PlatformName>
25 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
26 - <DefineConstants>Debug</DefineConstants>
27 - </PropertyGroup>
28 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
29 - <PlatformName>$(Platform)</PlatformName>
30 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
31 - </PropertyGroup>
32 -
33 - <ItemGroup>
34 - <Compile Include="Bundle.wxs" />
35 - </ItemGroup>
36 -
14 <ItemGroup>
15 <BindInputPaths Include="..\MsiPackage\data" />
16 </ItemGroup>
src/wix/test/WixToolsetTest.Sdk/TestData/SingleCultureWithFallbackMsiPackage/SingleCultureWithFallbackMsiPackage.wixproj
+2
@@ -1,7 +1,9 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 + <EnableDefaultItems>false</EnableDefaultItems>
7 <Cultures>de-DE,en-us</Cultures>
8 </PropertyGroup>
9
src/wix/test/WixToolsetTest.Sdk/TestData/Wixlib/PackageIncludesWixlib/PackageIncludesWixlib.wixproj
+2 -31
@@ -1,43 +1,14 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <Import Project="$(WixMSBuildProps)" />
4 +
5 <PropertyGroup>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
8 </PropertyGroup>
9
9 - <PropertyGroup>
10 - <ProjectGuid>{B00939D5-7952-4ADF-BEB1-507D227B2FE2}</ProjectGuid>
11 - </PropertyGroup>
12 -
13 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
14 - <PlatformName>$(Platform)</PlatformName>
15 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
16 - <DefineConstants>Debug</DefineConstants>
17 - </PropertyGroup>
18 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
19 - <PlatformName>$(Platform)</PlatformName>
20 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
21 - </PropertyGroup>
22 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
23 - <PlatformName>$(Platform)</PlatformName>
24 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
25 - <DefineConstants>Debug</DefineConstants>
26 - </PropertyGroup>
27 - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
28 - <PlatformName>$(Platform)</PlatformName>
29 - <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 - </PropertyGroup>
31 -
32 - <ItemGroup>
33 - <Compile Include="Package.wxs" />
34 - </ItemGroup>
35 -
10 <ItemGroup>
37 - <ProjectReference Include="..\SimpleWixlib\SimpleWixlib.wixproj">
38 - <Name>SimpleWixlib</Name>
39 - <Project>{9F84998B-7F45-4CB3-8795-915801DBBB74}</Project>
40 - </ProjectReference>
11 + <ProjectReference Include="..\SimpleWixlib\SimpleWixlib.wixproj" />
12 </ItemGroup>
13
14 <Import Project="$(WixTargetsPath)" />
src/wix/test/WixToolsetTest.Sdk/TestData/Wixlib/SimpleWixlib/SimpleWixlib.wixproj
-4
@@ -8,10 +8,6 @@
8 <WixVariables>SubfolderVar=subfolder</WixVariables>
9 </PropertyGroup>
10
11 - <ItemGroup>
12 - <Compile Include="Library.wxs" />
13 - </ItemGroup>
14 -
11 <ItemGroup>
12 <BindPath Include="data" />
13 </ItemGroup>