diff options
| author | Bob Arnson <bob@firegiant.com> | 2025-02-14 22:29:39 -0500 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2025-03-03 14:25:07 -0500 |
| commit | ca6e44d496b0c589fdaabad69a00643f539c47cd (patch) | |
| tree | edf84727cecfc03092a2851b465d97622c5048eb /src/ext/NetFx | |
| parent | ba7fd5837ea149b2e319cc577fad27ce1162a064 (diff) | |
| download | wix-ca6e44d496b0c589fdaabad69a00643f539c47cd.tar.gz wix-ca6e44d496b0c589fdaabad69a00643f539c47cd.tar.bz2 wix-ca6e44d496b0c589fdaabad69a00643f539c47cd.zip | |
Convert ext\ to MSTest and traversal projects.
- Move ext\ unit tests to MSTest.
- MSBuildify ext projects with MSTest execution.
- Fork test support projects for MSTest:
- WixInternal.TestSupport
- WixInternal.Core.TestPackage
Diffstat (limited to 'src/ext/NetFx')
| -rw-r--r-- | src/ext/NetFx/netfx.cmd | 48 | ||||
| -rw-r--r-- | src/ext/NetFx/netfx_t.proj | 26 | ||||
| -rw-r--r-- | src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs | 67 | ||||
| -rw-r--r-- | src/ext/NetFx/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj | 7 |
4 files changed, 51 insertions, 97 deletions
diff --git a/src/ext/NetFx/netfx.cmd b/src/ext/NetFx/netfx.cmd deleted file mode 100644 index d81959cc..00000000 --- a/src/ext/NetFx/netfx.cmd +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | @setlocal | ||
| 2 | @pushd %~dp0 | ||
| 3 | |||
| 4 | @set _C=Debug | ||
| 5 | @set _L=%~dp0..\..\..\build\logs | ||
| 6 | |||
| 7 | :parse_args | ||
| 8 | @if /i "%1"=="release" set _C=Release | ||
| 9 | @if /i "%1"=="inc" set _INC=1 | ||
| 10 | @if /i "%1"=="clean" set _CLEAN=1 | ||
| 11 | @if not "%1"=="" shift & goto parse_args | ||
| 12 | |||
| 13 | @set _B=%~dp0..\..\..\build\NetFx.wixext\%_C% | ||
| 14 | |||
| 15 | :: Clean | ||
| 16 | |||
| 17 | @if "%_INC%"=="" call :clean | ||
| 18 | @if NOT "%_CLEAN%"=="" goto :end | ||
| 19 | |||
| 20 | @echo NetFx.wixext build %_C% | ||
| 21 | |||
| 22 | :: Restore | ||
| 23 | nuget restore netcoresearch\packages.config || exit /b | ||
| 24 | |||
| 25 | :: Build | ||
| 26 | msbuild -Restore -p:Configuration=%_C% -tl -nologo -warnaserror -bl:%_L%\ext_netfx_build.binlog || exit /b | ||
| 27 | |||
| 28 | :: Test | ||
| 29 | dotnet test ^ | ||
| 30 | %_B%\net6.0\WixToolsetTest.NetFx.dll ^ | ||
| 31 | --nologo -l "trx;LogFileName=%_L%\TestResults\netfx.wixext.trx" || exit /b | ||
| 32 | |||
| 33 | :: Pack | ||
| 34 | msbuild -t:Pack -p:Configuration=%_C% -tl -nologo -warnaserror -p:NoBuild=true wixext\WixToolset.Netfx.wixext.csproj || exit /b | ||
| 35 | |||
| 36 | @goto :end | ||
| 37 | |||
| 38 | :clean | ||
| 39 | @rd /s/q "..\..\build\NetFx.wixext" 2> nul | ||
| 40 | @del "..\..\build\artifacts\WixToolset.NetFx.wixext.*.nupkg" 2> nul | ||
| 41 | @del "%_L%\ext_netfx_build.binlog" 2> nul | ||
| 42 | @del "%_L%\TestResults\netfx.wixext.trx" 2> nul | ||
| 43 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.netfx.wixext" 2> nul | ||
| 44 | @exit /b | ||
| 45 | |||
| 46 | :end | ||
| 47 | @popd | ||
| 48 | @endlocal | ||
diff --git a/src/ext/NetFx/netfx_t.proj b/src/ext/NetFx/netfx_t.proj new file mode 100644 index 00000000..3301dc8a --- /dev/null +++ b/src/ext/NetFx/netfx_t.proj | |||
| @@ -0,0 +1,26 @@ | |||
| 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 Sdk="Microsoft.Build.Traversal"> | ||
| 5 | <ItemGroup> | ||
| 6 | <ProjectReference Include="wixlib\netfx.wixproj" /> | ||
| 7 | <ProjectReference Include="test\WixToolsetTest.Netfx\WixToolsetTest.Netfx.csproj" /> | ||
| 8 | <ProjectReference Include="wixext\WixToolset.Netfx.wixext.csproj" Targets="Pack" Properties="NoBuild=true" /> | ||
| 9 | </ItemGroup> | ||
| 10 | |||
| 11 | <Target Name="WixClean" BeforeTargets="Restore" Condition="'$(SuppressWixClean)' != 'true'"> | ||
| 12 | <!-- | ||
| 13 | This should work but at first glance, the .vcxproj doesn't get detected as a "package.config-style project." | ||
| 14 | Worth finding out if we could trigger it artificially. It would let us stop needing nuget.exe. | ||
| 15 | |||
| 16 | <ProjectReference Include="netcoresearch\netcoresearch.vcxproj" Targets="Restore" Properties="RestorePackagesConfig=true" /> | ||
| 17 | --> | ||
| 18 | <Exec Command="nuget restore netcoresearch\packages.config" /> | ||
| 19 | |||
| 20 | <RemoveDir Directories="$(RootBuildFolder)NetFx.wixext" /> | ||
| 21 | <RemoveDir Directories="$(USERPROFILE)\.nuget\packages\wixtoolset.netfx.wixext" Condition="'$(NUGET_PACKAGES)' == ''" /> | ||
| 22 | <RemoveDir Directories="$(NUGET_PACKAGES)\wixtoolset.netfx.wixext" Condition="'$(NUGET_PACKAGES)' != ''" /> | ||
| 23 | |||
| 24 | <Delete Files="$(ArtifactsFolder)WixToolset.NetFx.wixext.*.nupkg" /> | ||
| 25 | </Target> | ||
| 26 | </Project> | ||
diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs index a78a5617..37f715bf 100644 --- a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs | |||
| @@ -4,14 +4,15 @@ namespace WixToolsetTest.Netfx | |||
| 4 | { | 4 | { |
| 5 | using System.IO; | 5 | using System.IO; |
| 6 | using System.Linq; | 6 | using System.Linq; |
| 7 | using WixInternal.TestSupport; | 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 8 | using WixInternal.Core.TestPackage; | 8 | using WixInternal.MSTestSupport; |
| 9 | using WixInternal.Core.MSTestPackage; | ||
| 9 | using WixToolset.Netfx; | 10 | using WixToolset.Netfx; |
| 10 | using Xunit; | ||
| 11 | 11 | ||
| 12 | [TestClass] | ||
| 12 | public class NetfxExtensionFixture | 13 | public class NetfxExtensionFixture |
| 13 | { | 14 | { |
| 14 | [Fact] | 15 | [TestMethod] |
| 15 | public void CanBuildUsingLatestDotNetCorePackages() | 16 | public void CanBuildUsingLatestDotNetCorePackages() |
| 16 | { | 17 | { |
| 17 | using (var fs = new DisposableFileSystem()) | 18 | using (var fs = new DisposableFileSystem()) |
| @@ -21,30 +22,24 @@ namespace WixToolsetTest.Netfx | |||
| 21 | var bundleSourceFolder = TestData.Get(@"TestData\UsingDotNetCorePackages"); | 22 | var bundleSourceFolder = TestData.Get(@"TestData\UsingDotNetCorePackages"); |
| 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 23 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 23 | 24 | ||
| 24 | var extensionResult = WixRunner.Execute(new[] | ||
| 25 | { | ||
| 26 | "extension", "add", | ||
| 27 | "WixToolset.BootstrapperApplications.wixext" | ||
| 28 | }); | ||
| 29 | |||
| 30 | var compileResult = WixRunner.Execute(new[] | 25 | var compileResult = WixRunner.Execute(new[] |
| 31 | { | 26 | { |
| 32 | "build", | 27 | "build", |
| 33 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), | 28 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), |
| 34 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x86.wxs"), | 29 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x86.wxs"), |
| 35 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"), | 30 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"), |
| 36 | "-ext", "WixToolset.BootstrapperApplications.wixext", | 31 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll").Replace("NetFx.wixext", "Bal.wixext"), |
| 37 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), | 32 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), |
| 38 | "-intermediateFolder", intermediateFolder, | 33 | "-intermediateFolder", intermediateFolder, |
| 39 | "-o", bundleFile, | 34 | "-o", bundleFile, |
| 40 | }); | 35 | }); |
| 41 | compileResult.AssertSuccess(); | 36 | compileResult.AssertSuccess(); |
| 42 | 37 | ||
| 43 | Assert.True(File.Exists(bundleFile)); | 38 | Assert.IsTrue(File.Exists(bundleFile)); |
| 44 | } | 39 | } |
| 45 | } | 40 | } |
| 46 | 41 | ||
| 47 | [Fact] | 42 | [TestMethod] |
| 48 | public void CanBuildUsingLatestDotNetCorePackages_X64() | 43 | public void CanBuildUsingLatestDotNetCorePackages_X64() |
| 49 | { | 44 | { |
| 50 | using (var fs = new DisposableFileSystem()) | 45 | using (var fs = new DisposableFileSystem()) |
| @@ -54,29 +49,23 @@ namespace WixToolsetTest.Netfx | |||
| 54 | var bundleSourceFolder = TestData.Get(@"TestData\UsingDotNetCorePackages"); | 49 | var bundleSourceFolder = TestData.Get(@"TestData\UsingDotNetCorePackages"); |
| 55 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 50 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 56 | 51 | ||
| 57 | var extensionResult = WixRunner.Execute(new[] | ||
| 58 | { | ||
| 59 | "extension", "add", | ||
| 60 | "WixToolset.BootstrapperApplications.wixext" | ||
| 61 | }); | ||
| 62 | |||
| 63 | var compileResult = WixRunner.Execute(new[] | 52 | var compileResult = WixRunner.Execute(new[] |
| 64 | { | 53 | { |
| 65 | "build", | 54 | "build", |
| 66 | Path.Combine(bundleSourceFolder, "BundleLatest_x64.wxs"), | 55 | Path.Combine(bundleSourceFolder, "BundleLatest_x64.wxs"), |
| 67 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"), | 56 | Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"), |
| 68 | "-ext", "WixToolset.BootstrapperApplications.wixext", | 57 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll").Replace("NetFx.wixext", "Bal.wixext"), |
| 69 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), | 58 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), |
| 70 | "-intermediateFolder", intermediateFolder, | 59 | "-intermediateFolder", intermediateFolder, |
| 71 | "-o", bundleFile, | 60 | "-o", bundleFile, |
| 72 | }); | 61 | }); |
| 73 | compileResult.AssertSuccess(); | 62 | compileResult.AssertSuccess(); |
| 74 | 63 | ||
| 75 | Assert.True(File.Exists(bundleFile)); | 64 | Assert.IsTrue(File.Exists(bundleFile)); |
| 76 | } | 65 | } |
| 77 | } | 66 | } |
| 78 | 67 | ||
| 79 | [Fact] | 68 | [TestMethod] |
| 80 | public void CanBuildUsingNetFx481Packages() | 69 | public void CanBuildUsingNetFx481Packages() |
| 81 | { | 70 | { |
| 82 | using (var fs = new DisposableFileSystem()) | 71 | using (var fs = new DisposableFileSystem()) |
| @@ -86,17 +75,11 @@ namespace WixToolsetTest.Netfx | |||
| 86 | var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxPackages"); | 75 | var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxPackages"); |
| 87 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 76 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 88 | 77 | ||
| 89 | var extensionResult = WixRunner.Execute(new[] | ||
| 90 | { | ||
| 91 | "extension", "add", | ||
| 92 | "WixToolset.BootstrapperApplications.wixext" | ||
| 93 | }); | ||
| 94 | |||
| 95 | var compileResult = WixRunner.Execute(new[] | 78 | var compileResult = WixRunner.Execute(new[] |
| 96 | { | 79 | { |
| 97 | "build", | 80 | "build", |
| 98 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), | 81 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), |
| 99 | "-ext", "WixToolset.BootstrapperApplications.wixext", | 82 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll").Replace("NetFx.wixext", "Bal.wixext"), |
| 100 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), | 83 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), |
| 101 | "-intermediateFolder", intermediateFolder, | 84 | "-intermediateFolder", intermediateFolder, |
| 102 | "-o", bundleFile, | 85 | "-o", bundleFile, |
| @@ -104,11 +87,11 @@ namespace WixToolsetTest.Netfx | |||
| 104 | }); | 87 | }); |
| 105 | compileResult.AssertSuccess(); | 88 | compileResult.AssertSuccess(); |
| 106 | 89 | ||
| 107 | Assert.True(File.Exists(bundleFile)); | 90 | Assert.IsTrue(File.Exists(bundleFile)); |
| 108 | } | 91 | } |
| 109 | } | 92 | } |
| 110 | 93 | ||
| 111 | [Fact] | 94 | [TestMethod] |
| 112 | public void CanBuildUsingNetFxSearches() | 95 | public void CanBuildUsingNetFxSearches() |
| 113 | { | 96 | { |
| 114 | using (var fs = new DisposableFileSystem()) | 97 | using (var fs = new DisposableFileSystem()) |
| @@ -118,20 +101,12 @@ namespace WixToolsetTest.Netfx | |||
| 118 | var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxSearches"); | 101 | var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxSearches"); |
| 119 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 102 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 120 | 103 | ||
| 121 | var extensionResult = WixRunner.Execute(warningsAsErrors: true, new[] | ||
| 122 | { | ||
| 123 | "extension", "add", | ||
| 124 | "WixToolset.BootstrapperApplications.wixext", | ||
| 125 | "extension", "add", | ||
| 126 | "WixToolset.Util.wixext", | ||
| 127 | }); | ||
| 128 | |||
| 129 | var compileResult = WixRunner.Execute(new[] | 104 | var compileResult = WixRunner.Execute(new[] |
| 130 | { | 105 | { |
| 131 | "build", | 106 | "build", |
| 132 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), | 107 | Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), |
| 133 | "-ext", "WixToolset.BootstrapperApplications.wixext", | 108 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll").Replace("NetFx.wixext", "Bal.wixext"), |
| 134 | "-ext", "WixToolset.Util.wixext", | 109 | "-ext", TestData.Get(@"WixToolset.Util.wixext.dll").Replace("NetFx.wixext", "Util.wixext"), |
| 135 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), | 110 | "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), |
| 136 | "-intermediateFolder", intermediateFolder, | 111 | "-intermediateFolder", intermediateFolder, |
| 137 | "-o", bundleFile, | 112 | "-o", bundleFile, |
| @@ -139,11 +114,11 @@ namespace WixToolsetTest.Netfx | |||
| 139 | }); | 114 | }); |
| 140 | compileResult.AssertSuccess(); | 115 | compileResult.AssertSuccess(); |
| 141 | 116 | ||
| 142 | Assert.True(File.Exists(bundleFile)); | 117 | Assert.IsTrue(File.Exists(bundleFile)); |
| 143 | } | 118 | } |
| 144 | } | 119 | } |
| 145 | 120 | ||
| 146 | [Fact] | 121 | [TestMethod] |
| 147 | public void CanBuildUsingNativeImage() | 122 | public void CanBuildUsingNativeImage() |
| 148 | { | 123 | { |
| 149 | var folder = TestData.Get(@"TestData\UsingNativeImage"); | 124 | var folder = TestData.Get(@"TestData\UsingNativeImage"); |
| @@ -162,7 +137,7 @@ namespace WixToolsetTest.Netfx | |||
| 162 | }, results.OrderBy(s => s).ToArray()); | 137 | }, results.OrderBy(s => s).ToArray()); |
| 163 | } | 138 | } |
| 164 | 139 | ||
| 165 | [Fact] | 140 | [TestMethod] |
| 166 | public void CanBuildUsingNativeImageX64() | 141 | public void CanBuildUsingNativeImageX64() |
| 167 | { | 142 | { |
| 168 | var folder = TestData.Get(@"TestData\UsingNativeImage"); | 143 | var folder = TestData.Get(@"TestData\UsingNativeImage"); |
| @@ -181,7 +156,7 @@ namespace WixToolsetTest.Netfx | |||
| 181 | }, results.OrderBy(s => s).ToArray()); | 156 | }, results.OrderBy(s => s).ToArray()); |
| 182 | } | 157 | } |
| 183 | 158 | ||
| 184 | [Fact] | 159 | [TestMethod] |
| 185 | public void CanBuildUsingNativeImageARM64() | 160 | public void CanBuildUsingNativeImageARM64() |
| 186 | { | 161 | { |
| 187 | var folder = TestData.Get(@"TestData\UsingNativeImage"); | 162 | var folder = TestData.Get(@"TestData\UsingNativeImage"); |
| @@ -200,7 +175,7 @@ namespace WixToolsetTest.Netfx | |||
| 200 | }, results.OrderBy(s => s).ToArray()); | 175 | }, results.OrderBy(s => s).ToArray()); |
| 201 | } | 176 | } |
| 202 | 177 | ||
| 203 | [Fact] | 178 | [TestMethod] |
| 204 | public void CanBuildUsingDotNetCompatibilityCheck() | 179 | public void CanBuildUsingDotNetCompatibilityCheck() |
| 205 | { | 180 | { |
| 206 | var folder = TestData.Get(@"TestData\UsingDotNetCompatibilityCheck"); | 181 | var folder = TestData.Get(@"TestData\UsingDotNetCompatibilityCheck"); |
diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj b/src/ext/NetFx/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj index 4e509cce..bdca49e6 100644 --- a/src/ext/NetFx/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 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. --> | 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 | 3 | ||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="MSTest.Sdk"> |
| 5 | <PropertyGroup> | 5 | <PropertyGroup> |
| 6 | <TargetFramework>net6.0</TargetFramework> | 6 | <TargetFramework>net6.0</TargetFramework> |
| 7 | <IsWixTestProject>true</IsWixTestProject> | 7 | <IsWixMSTestProject>true</IsWixMSTestProject> |
| 8 | </PropertyGroup> | 8 | </PropertyGroup> |
| 9 | 9 | ||
| 10 | <ItemGroup> | 10 | <ItemGroup> |
| @@ -16,6 +16,7 @@ | |||
| 16 | </ItemGroup> | 16 | </ItemGroup> |
| 17 | 17 | ||
| 18 | <ItemGroup> | 18 | <ItemGroup> |
| 19 | <PackageReference Include="WixInternal.Core.TestPackage" /> | 19 | <PackageReference Include="WixInternal.MSTestSupport" /> |
| 20 | <PackageReference Include="WixInternal.Core.MSTestPackage" /> | ||
| 20 | </ItemGroup> | 21 | </ItemGroup> |
| 21 | </Project> | 22 | </Project> |
