diff options
Diffstat (limited to 'src')
21 files changed, 226 insertions, 367 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs b/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs index 32680e5d..3271cc20 100644 --- a/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs +++ b/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs | |||
| @@ -17,7 +17,7 @@ namespace WixToolsetTest.Sdk | |||
| 17 | 17 | ||
| 18 | public static class MsbuildUtilities | 18 | public static class MsbuildUtilities |
| 19 | { | 19 | { |
| 20 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null, string verbosityLevel = "normal", bool suppressValidation = true) | 20 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", string verbosityLevel = "normal", bool suppressValidation = true) |
| 21 | { | 21 | { |
| 22 | var allArgs = new List<string> | 22 | var allArgs = new List<string> |
| 23 | { | 23 | { |
| @@ -30,11 +30,6 @@ namespace WixToolsetTest.Sdk | |||
| 30 | $"-bl:{Path.ChangeExtension(projectPath, ".binlog")}" | 30 | $"-bl:{Path.ChangeExtension(projectPath, ".binlog")}" |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | if (outOfProc.HasValue) | ||
| 34 | { | ||
| 35 | allArgs.Add($"-p:RunWixToolsOutOfProc={outOfProc.Value}"); | ||
| 36 | } | ||
| 37 | |||
| 38 | if (arguments != null) | 33 | if (arguments != null) |
| 39 | { | 34 | { |
| 40 | allArgs.AddRange(arguments); | 35 | allArgs.AddRange(arguments); |
| @@ -96,11 +91,9 @@ namespace WixToolsetTest.Sdk | |||
| 96 | } | 91 | } |
| 97 | } | 92 | } |
| 98 | 93 | ||
| 99 | public static IEnumerable<string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem, bool? outOfProc = null) | 94 | public static IEnumerable<string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem) |
| 100 | { | 95 | { |
| 101 | var expectedOutOfProc = buildSystem == BuildSystem.DotNetCoreSdk || outOfProc.HasValue && outOfProc.Value; | 96 | var expectedToolExe = buildSystem == BuildSystem.DotNetCoreSdk ? $"{toolName}.dll\"" : $"{toolName}.exe"; |
| 102 | var expectedToolExe = !expectedOutOfProc ? $"({toolName}.exe)" : | ||
| 103 | buildSystem == BuildSystem.DotNetCoreSdk ? $"{toolName}.dll\"" : $"{toolName}.exe"; | ||
| 104 | var expectedToolCommand = $"{expectedToolExe} {operation}"; | 97 | var expectedToolCommand = $"{expectedToolExe} {operation}"; |
| 105 | return result.Output.Where(line => line.Contains(expectedToolCommand)); | 98 | return result.Output.Where(line => line.Contains(expectedToolCommand)); |
| 106 | } | 99 | } |
diff --git a/src/internal/internal.cmd b/src/internal/internal.cmd index 8b46e77c..9380ce4e 100644 --- a/src/internal/internal.cmd +++ b/src/internal/internal.cmd | |||
| @@ -2,10 +2,21 @@ | |||
| 2 | @pushd %~dp0 | 2 | @pushd %~dp0 |
| 3 | 3 | ||
| 4 | @set _C=Debug | 4 | @set _C=Debug |
| 5 | @set _L=%~dp0..\..\build\logs | ||
| 6 | |||
| 5 | :parse_args | 7 | :parse_args |
| 6 | @if /i "%1"=="release" set _C=Release | 8 | @if /i "%1"=="release" set _C=Release |
| 9 | @if /i "%1"=="inc" set _INC=1 | ||
| 10 | @if /i "%1"=="clean" set _CLEAN=1 | ||
| 7 | @if not "%1"=="" shift & goto parse_args | 11 | @if not "%1"=="" shift & goto parse_args |
| 8 | 12 | ||
| 13 | @set _B=%~dp0..\..\build\wix\%_C% | ||
| 14 | |||
| 15 | :: Clean | ||
| 16 | |||
| 17 | @if "%_INC%"=="" call :clean | ||
| 18 | @if NOT "%_CLEAN%"=="" goto :end | ||
| 19 | |||
| 9 | @echo Building internal %_C% | 20 | @echo Building internal %_C% |
| 10 | 21 | ||
| 11 | :: internal | 22 | :: internal |
| @@ -14,10 +25,18 @@ nuget restore || exit /b | |||
| 14 | :: dotnet pack -c %_C% WixBuildTools.MsgGen\WixBuildTools.MsgGen.csproj || exit /b | 25 | :: dotnet pack -c %_C% WixBuildTools.MsgGen\WixBuildTools.MsgGen.csproj || exit /b |
| 15 | :: dotnet pack -c %_C% WixBuildTools.XsdGen\WixBuildTools.XsdGen.csproj || exit /b | 26 | :: dotnet pack -c %_C% WixBuildTools.XsdGen\WixBuildTools.XsdGen.csproj || exit /b |
| 16 | 27 | ||
| 17 | msbuild -t:Pack WixBuildTools.TestSupport\WixBuildTools.TestSupport.csproj -p:Configuration=%_C% -nologo -m -warnaserror -bl:..\..\build\logs\internal_build.binlog || exit /b | 28 | msbuild internal_t.proj -p:Configuration=%_C% -nologo -warnaserror -bl:%_L%\internal_build.binlog || exit /b |
| 29 | |||
| 30 | @goto :end | ||
| 18 | 31 | ||
| 19 | msbuild -t:Build WixBuildTools.TestSupport.Native\WixBuildTools.TestSupport.Native.vcxproj -p:Configuration=%_C%;Platform=x86 -nologo || exit /b | 32 | :clean |
| 20 | msbuild -t:Build WixBuildTools.TestSupport.Native\WixBuildTools.TestSupport.Native.vcxproj -p:Configuration=%_C%;Platform=x64 -nologo || exit /b | 33 | @rd /s/q "..\..\build\internal" 2> nul |
| 34 | @del "..\..\build\artifacts\WixBuildTools.TestSupport.*.nupkg" 2> nul | ||
| 35 | @del "..\..\build\artifacts\WixBuildTools.TestSupport.Native.*.nupkg" 2> nul | ||
| 36 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixbuildtools.testsupport" 2> nul | ||
| 37 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixbuildtools.testsupport.native" 2> nul | ||
| 38 | @exit /b | ||
| 21 | 39 | ||
| 40 | :end | ||
| 22 | @popd | 41 | @popd |
| 23 | @endlocal | 42 | @endlocal |
diff --git a/src/internal/internal_t.proj b/src/internal/internal_t.proj new file mode 100644 index 00000000..fda67786 --- /dev/null +++ b/src/internal/internal_t.proj | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | <Project Sdk="Microsoft.Build.Traversal"> | ||
| 2 | <ItemGroup> | ||
| 3 | <ProjectReference Include="WixBuildTools.TestSupport\WixBuildTools.TestSupport.csproj" Targets="Pack" /> | ||
| 4 | <ProjectReference Include="WixBuildTools.TestSupport.Native\WixBuildTools.TestSupport.Native.vcxproj" Properties="Platform=x86" /> | ||
| 5 | <ProjectReference Include="WixBuildTools.TestSupport.Native\WixBuildTools.TestSupport.Native.vcxproj" Properties="Platform=x64" /> | ||
| 6 | </ItemGroup> | ||
| 7 | </Project> | ||
diff --git a/src/testresultfilelist.txt b/src/testresultfilelist.txt index 43e5df11..6a2eadcb 100644 --- a/src/testresultfilelist.txt +++ b/src/testresultfilelist.txt | |||
| @@ -2,8 +2,7 @@ build/logs/TestResults/api.trx | |||
| 2 | build/logs/TestResults/burn.trx | 2 | build/logs/TestResults/burn.trx |
| 3 | build/logs/TestResults/libs.trx | 3 | build/logs/TestResults/libs.trx |
| 4 | build/logs/TestResults/tools.trx | 4 | build/logs/TestResults/tools.trx |
| 5 | build/logs/TestResults/wix_prepublish.trx | 5 | build/logs/TestResults/wix.trx |
| 6 | build/logs/TestResults/wix_postpublish.trx | ||
| 7 | build/logs/TestResults/WixToolsetTest.Bal.trx | 6 | build/logs/TestResults/WixToolsetTest.Bal.trx |
| 8 | build/logs/TestResults/WixToolsetTest.BurnE2E.trx | 7 | build/logs/TestResults/WixToolsetTest.BurnE2E.trx |
| 9 | build/logs/TestResults/WixToolsetTest.Dnc.HostGenerator.trx | 8 | build/logs/TestResults/WixToolsetTest.Dnc.HostGenerator.trx |
diff --git a/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj b/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj index ddc75c69..21fb419c 100644 --- a/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj +++ b/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | <Title>WiX Toolset Heat MSBuild Tasks</Title> | 7 | <Title>WiX Toolset Heat MSBuild Tasks</Title> |
| 8 | <DebugType>embedded</DebugType> | 8 | <DebugType>embedded</DebugType> |
| 9 | <PublishRepositoryUrl>true</PublishRepositoryUrl> | 9 | <PublishRepositoryUrl>true</PublishRepositoryUrl> |
| 10 | <!-- https://github.com/Microsoft/msbuild/issues/2360 --> | ||
| 11 | <PlatformTarget>AnyCPU</PlatformTarget> | 10 | <PlatformTarget>AnyCPU</PlatformTarget> |
| 12 | </PropertyGroup> | 11 | </PropertyGroup> |
| 13 | 12 | ||
diff --git a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs index d54da457..a0a98578 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs +++ b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs | |||
| @@ -43,7 +43,7 @@ namespace WixToolsetTest.Sdk | |||
| 43 | }); | 43 | }); |
| 44 | result.AssertSuccess(); | 44 | result.AssertSuccess(); |
| 45 | 45 | ||
| 46 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem, true); | 46 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
| 47 | Assert.Single(heatCommandLines); | 47 | Assert.Single(heatCommandLines); |
| 48 | 48 | ||
| 49 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 49 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
| @@ -99,7 +99,7 @@ namespace WixToolsetTest.Sdk | |||
| 99 | }); | 99 | }); |
| 100 | result.AssertSuccess(); | 100 | result.AssertSuccess(); |
| 101 | 101 | ||
| 102 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem, true); | 102 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
| 103 | Assert.Equal(2, heatCommandLines.Count()); | 103 | Assert.Equal(2, heatCommandLines.Count()); |
| 104 | 104 | ||
| 105 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 105 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
| @@ -185,7 +185,7 @@ namespace WixToolsetTest.Sdk | |||
| 185 | }); | 185 | }); |
| 186 | result.AssertSuccess(); | 186 | result.AssertSuccess(); |
| 187 | 187 | ||
| 188 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem, true); | 188 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); |
| 189 | var heatCommandLine = Assert.Single(heatCommandLines); | 189 | var heatCommandLine = Assert.Single(heatCommandLines); |
| 190 | 190 | ||
| 191 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | 191 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) |
| @@ -306,7 +306,7 @@ namespace WixToolsetTest.Sdk | |||
| 306 | }); | 306 | }); |
| 307 | result.AssertSuccess(); | 307 | result.AssertSuccess(); |
| 308 | 308 | ||
| 309 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem, true); | 309 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); |
| 310 | var heatCommandLine = Assert.Single(heatCommandLines); | 310 | var heatCommandLine = Assert.Single(heatCommandLines); |
| 311 | 311 | ||
| 312 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | 312 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) |
diff --git a/src/wix/Directory.Build.props b/src/wix/Directory.Build.props index 2e4d6227..09507ad6 100644 --- a/src/wix/Directory.Build.props +++ b/src/wix/Directory.Build.props | |||
| @@ -7,4 +7,8 @@ | |||
| 7 | </PropertyGroup> | 7 | </PropertyGroup> |
| 8 | 8 | ||
| 9 | <Import Project="..\Directory.Build.props" /> | 9 | <Import Project="..\Directory.Build.props" /> |
| 10 | |||
| 11 | <PropertyGroup> | ||
| 12 | <PublishRoot>$(OutputPath)publish\</PublishRoot> | ||
| 13 | </PropertyGroup> | ||
| 10 | </Project> | 14 | </Project> |
diff --git a/src/wix/WixToolset.BuildTasks/MsbuildMessageListener.cs b/src/wix/WixToolset.BuildTasks/MsbuildMessageListener.cs deleted file mode 100644 index f186d721..00000000 --- a/src/wix/WixToolset.BuildTasks/MsbuildMessageListener.cs +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | // 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 | |||
| 3 | #if !NETCOREAPP | ||
| 4 | namespace WixToolset.BuildTasks | ||
| 5 | { | ||
| 6 | using System; | ||
| 7 | using Microsoft.Build.Framework; | ||
| 8 | using Microsoft.Build.Utilities; | ||
| 9 | using WixToolset.Data; | ||
| 10 | using WixToolset.Extensibility; | ||
| 11 | using WixToolset.Extensibility.Services; | ||
| 12 | |||
| 13 | public sealed class MsbuildMessageListener : IMessageListener | ||
| 14 | { | ||
| 15 | public MsbuildMessageListener(TaskLoggingHelper logger, string shortName, string longName) | ||
| 16 | { | ||
| 17 | this.Logger = logger; | ||
| 18 | this.ShortAppName = shortName; | ||
| 19 | this.LongAppName = longName; | ||
| 20 | } | ||
| 21 | |||
| 22 | public string ShortAppName { get; } | ||
| 23 | |||
| 24 | public string LongAppName { get; } | ||
| 25 | |||
| 26 | private TaskLoggingHelper Logger { get; } | ||
| 27 | |||
| 28 | public void Write(Message message) | ||
| 29 | { | ||
| 30 | var code = this.ShortAppName + message.Id.ToString(); | ||
| 31 | var file = message.SourceLineNumbers?.FileName ?? this.LongAppName; | ||
| 32 | var lineNumber = message.SourceLineNumbers?.LineNumber ?? 0; | ||
| 33 | switch (message.Level) | ||
| 34 | { | ||
| 35 | case MessageLevel.Error: | ||
| 36 | this.Logger.LogError(null, code, null, file, lineNumber, 0, 0, 0, message.ResourceNameOrFormat, message.MessageArgs); | ||
| 37 | break; | ||
| 38 | |||
| 39 | case MessageLevel.Verbose: | ||
| 40 | this.Logger.LogMessage(null, code, null, file, lineNumber, 0, 0, 0, MessageImportance.Low, message.ResourceNameOrFormat, message.MessageArgs); | ||
| 41 | break; | ||
| 42 | |||
| 43 | case MessageLevel.Warning: | ||
| 44 | this.Logger.LogWarning(null, code, null, file, lineNumber, 0, 0, 0, message.ResourceNameOrFormat, message.MessageArgs); | ||
| 45 | break; | ||
| 46 | |||
| 47 | default: | ||
| 48 | if (message.Id > 0) | ||
| 49 | { | ||
| 50 | this.Logger.LogMessage(null, code, null, file, lineNumber, 0, 0, 0, MessageImportance.Normal, message.ResourceNameOrFormat, message.MessageArgs); | ||
| 51 | } | ||
| 52 | else | ||
| 53 | { | ||
| 54 | this.Logger.LogMessage(MessageImportance.Normal, message.ResourceNameOrFormat, message.MessageArgs); | ||
| 55 | } | ||
| 56 | break; | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | public void Write(string message) | ||
| 61 | { | ||
| 62 | this.Logger.LogMessage(MessageImportance.Low, message); | ||
| 63 | } | ||
| 64 | |||
| 65 | public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) => defaultMessageLevel; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | #endif | ||
diff --git a/src/wix/WixToolset.BuildTasks/ToolsetTask.cs b/src/wix/WixToolset.BuildTasks/ToolsetTask.cs index 7d4a7687..3eee7625 100644 --- a/src/wix/WixToolset.BuildTasks/ToolsetTask.cs +++ b/src/wix/WixToolset.BuildTasks/ToolsetTask.cs | |||
| @@ -7,15 +7,8 @@ namespace WixToolset.BuildTasks | |||
| 7 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
| 8 | using Microsoft.Build.Utilities; | 8 | using Microsoft.Build.Utilities; |
| 9 | 9 | ||
| 10 | public abstract partial class ToolsetTask : ToolTask | 10 | public abstract class ToolsetTask : ToolTask |
| 11 | { | 11 | { |
| 12 | #if NETCOREAPP | ||
| 13 | private static readonly string DotnetFullPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; | ||
| 14 | private static readonly string ThisDllPath = typeof(ToolsetTask).Assembly.Location; | ||
| 15 | #else | ||
| 16 | private static readonly string ThisDllPath = new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath; | ||
| 17 | #endif | ||
| 18 | |||
| 19 | /// <summary> | 12 | /// <summary> |
| 20 | /// Gets or sets additional options that are appended the the tool command-line. | 13 | /// Gets or sets additional options that are appended the the tool command-line. |
| 21 | /// </summary> | 14 | /// </summary> |
| @@ -31,12 +24,6 @@ namespace WixToolset.BuildTasks | |||
| 31 | public bool NoLogo { get; set; } | 24 | public bool NoLogo { get; set; } |
| 32 | 25 | ||
| 33 | /// <summary> | 26 | /// <summary> |
| 34 | /// Gets or sets a flag indicating whether the task | ||
| 35 | /// should be run as separate process or in-proc. | ||
| 36 | /// </summary> | ||
| 37 | public virtual bool RunAsSeparateProcess { get; set; } | ||
| 38 | |||
| 39 | /// <summary> | ||
| 40 | /// Gets or sets whether all warnings should be suppressed. | 27 | /// Gets or sets whether all warnings should be suppressed. |
| 41 | /// </summary> | 28 | /// </summary> |
| 42 | public bool SuppressAllWarnings { get; set; } | 29 | public bool SuppressAllWarnings { get; set; } |
| @@ -61,20 +48,6 @@ namespace WixToolset.BuildTasks | |||
| 61 | /// </summary> | 48 | /// </summary> |
| 62 | public bool VerboseOutput { get; set; } | 49 | public bool VerboseOutput { get; set; } |
| 63 | 50 | ||
| 64 | private string DefaultToolFullPath => Path.Combine(Path.GetDirectoryName(ThisDllPath), this.ToolExe); | ||
| 65 | |||
| 66 | private string ToolFullPath | ||
| 67 | { | ||
| 68 | get | ||
| 69 | { | ||
| 70 | if (String.IsNullOrEmpty(this.ToolPath)) | ||
| 71 | { | ||
| 72 | return this.DefaultToolFullPath; | ||
| 73 | } | ||
| 74 | return Path.Combine(this.ToolPath, this.ToolExe); | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | /// <summary> | 51 | /// <summary> |
| 79 | /// Get the path to the executable. | 52 | /// Get the path to the executable. |
| 80 | /// </summary> | 53 | /// </summary> |
| @@ -85,29 +58,22 @@ namespace WixToolset.BuildTasks | |||
| 85 | /// </remarks> | 58 | /// </remarks> |
| 86 | protected sealed override string GenerateFullPathToTool() | 59 | protected sealed override string GenerateFullPathToTool() |
| 87 | { | 60 | { |
| 61 | var defaultToolFullPath = this.GetDefaultToolFullPath(); | ||
| 62 | |||
| 88 | #if NETCOREAPP | 63 | #if NETCOREAPP |
| 89 | if (IsSelfExecutable(this.DefaultToolFullPath, out var toolFullPath)) | 64 | // If we're pointing at an executable use that. |
| 65 | if (IsSelfExecutable(defaultToolFullPath, out var finalToolFullPath)) | ||
| 90 | { | 66 | { |
| 91 | return toolFullPath; | 67 | return finalToolFullPath; |
| 92 | } | 68 | } |
| 93 | return DotnetFullPath; | 69 | |
| 70 | // Otherwise, use "dotnet.exe" to run an assembly dll. | ||
| 71 | return Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; | ||
| 94 | #else | 72 | #else |
| 95 | if (!this.RunAsSeparateProcess) | 73 | return defaultToolFullPath; |
| 96 | { | ||
| 97 | // We need to return a path that exists, so if we're not actually going to run the tool then just return this dll path. | ||
| 98 | return ThisDllPath; | ||
| 99 | } | ||
| 100 | return this.DefaultToolFullPath; | ||
| 101 | #endif | 74 | #endif |
| 102 | } | 75 | } |
| 103 | 76 | ||
| 104 | protected sealed override string GenerateResponseFileCommands() | ||
| 105 | { | ||
| 106 | var commandLineBuilder = new WixCommandLineBuilder(); | ||
| 107 | this.BuildCommandLine(commandLineBuilder); | ||
| 108 | return commandLineBuilder.ToString(); | ||
| 109 | } | ||
| 110 | |||
| 111 | /// <summary> | 77 | /// <summary> |
| 112 | /// Builds a command line from options in this and derivative tasks. | 78 | /// Builds a command line from options in this and derivative tasks. |
| 113 | /// </summary> | 79 | /// </summary> |
| @@ -124,33 +90,88 @@ namespace WixToolset.BuildTasks | |||
| 124 | commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors); | 90 | commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors); |
| 125 | } | 91 | } |
| 126 | 92 | ||
| 93 | protected sealed override string GenerateResponseFileCommands() | ||
| 94 | { | ||
| 95 | var commandLineBuilder = new WixCommandLineBuilder(); | ||
| 96 | this.BuildCommandLine(commandLineBuilder); | ||
| 97 | return commandLineBuilder.ToString(); | ||
| 98 | } | ||
| 99 | |||
| 127 | #if NETCOREAPP | 100 | #if NETCOREAPP |
| 128 | protected override string GenerateCommandLineCommands() | 101 | protected override string GenerateCommandLineCommands() |
| 129 | { | 102 | { |
| 130 | if (IsSelfExecutable(this.ToolFullPath, out var toolFullPath)) | 103 | // If the target tool path is an executable, we don't need to add anything to the command-line. |
| 104 | var toolFullPath = this.GetToolFullPath(); | ||
| 105 | |||
| 106 | if (IsSelfExecutable(toolFullPath, out var finalToolFullPath)) | ||
| 131 | { | 107 | { |
| 132 | return null; | 108 | return null; |
| 133 | } | 109 | } |
| 134 | else | 110 | else // we're using "dotnet.exe" to run the assembly so add "exec" plus path to the command-line. |
| 135 | { | 111 | { |
| 136 | return $"exec \"{toolFullPath}\""; | 112 | return $"exec \"{finalToolFullPath}\""; |
| 137 | } | 113 | } |
| 138 | } | 114 | } |
| 139 | 115 | ||
| 140 | private static bool IsSelfExecutable(string proposedToolFullPath, out string toolFullPath) | 116 | private static bool IsSelfExecutable(string proposedToolFullPath, out string finalToolFullPath) |
| 141 | { | 117 | { |
| 142 | var toolFullPathWithoutExtension = Path.Combine(Path.GetDirectoryName(proposedToolFullPath), Path.GetFileNameWithoutExtension(proposedToolFullPath)); | 118 | var toolFullPathWithoutExtension = Path.Combine(Path.GetDirectoryName(proposedToolFullPath), Path.GetFileNameWithoutExtension(proposedToolFullPath)); |
| 143 | var exeExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : String.Empty; | 119 | var exeExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : String.Empty; |
| 144 | var exeToolFullPath = $"{toolFullPathWithoutExtension}{exeExtension}"; | 120 | var exeToolFullPath = $"{toolFullPathWithoutExtension}{exeExtension}"; |
| 145 | if (File.Exists(exeToolFullPath)) | 121 | if (File.Exists(exeToolFullPath)) |
| 146 | { | 122 | { |
| 147 | toolFullPath = exeToolFullPath; | 123 | finalToolFullPath = exeToolFullPath; |
| 148 | return true; | 124 | return true; |
| 149 | } | 125 | } |
| 150 | 126 | ||
| 151 | toolFullPath = $"{toolFullPathWithoutExtension}.dll"; | 127 | finalToolFullPath = $"{toolFullPathWithoutExtension}.dll"; |
| 152 | return false; | 128 | return false; |
| 153 | } | 129 | } |
| 130 | #else | ||
| 131 | private static string GetArchitectureFolder(string baseFolder) | ||
| 132 | { | ||
| 133 | // First try to find a folder that matches this task's architecture. | ||
| 134 | var folder = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); | ||
| 135 | |||
| 136 | if (Directory.Exists(Path.Combine(baseFolder, folder))) | ||
| 137 | { | ||
| 138 | return folder; | ||
| 139 | } | ||
| 140 | |||
| 141 | // Try to fallback to "x86" folder. | ||
| 142 | if (folder != "x86" && Directory.Exists(Path.Combine(baseFolder, "x86"))) | ||
| 143 | { | ||
| 144 | return "x86"; | ||
| 145 | } | ||
| 146 | |||
| 147 | // Return empty, even though this isn't likely to be useful. | ||
| 148 | return String.Empty; | ||
| 149 | } | ||
| 150 | #endif | ||
| 151 | |||
| 152 | private string GetDefaultToolFullPath() | ||
| 153 | { | ||
| 154 | #if NETCOREAPP | ||
| 155 | var thisTaskFolder = Path.GetDirectoryName(typeof(ToolsetTask).Assembly.Location); | ||
| 156 | |||
| 157 | return Path.Combine(thisTaskFolder, this.ToolExe); | ||
| 158 | #else | ||
| 159 | var thisTaskFolder = Path.GetDirectoryName(new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath); | ||
| 160 | |||
| 161 | var archFolder = GetArchitectureFolder(thisTaskFolder); | ||
| 162 | |||
| 163 | return Path.Combine(thisTaskFolder, archFolder, this.ToolExe); | ||
| 154 | #endif | 164 | #endif |
| 165 | } | ||
| 166 | |||
| 167 | private string GetToolFullPath() | ||
| 168 | { | ||
| 169 | if (String.IsNullOrEmpty(this.ToolPath)) | ||
| 170 | { | ||
| 171 | return this.GetDefaultToolFullPath(); | ||
| 172 | } | ||
| 173 | |||
| 174 | return Path.Combine(this.ToolPath, this.ToolExe); | ||
| 175 | } | ||
| 155 | } | 176 | } |
| 156 | } | 177 | } |
diff --git a/src/wix/WixToolset.BuildTasks/ToolsetTask_InProc.cs b/src/wix/WixToolset.BuildTasks/ToolsetTask_InProc.cs deleted file mode 100644 index eff117da..00000000 --- a/src/wix/WixToolset.BuildTasks/ToolsetTask_InProc.cs +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | // 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 | |||
| 3 | #if !NETCOREAPP | ||
| 4 | namespace WixToolset.BuildTasks | ||
| 5 | { | ||
| 6 | using System; | ||
| 7 | using System.Runtime.InteropServices; | ||
| 8 | using System.Threading; | ||
| 9 | using System.Threading.Tasks; | ||
| 10 | using Microsoft.Build.Framework; | ||
| 11 | using WixToolset.Core; | ||
| 12 | using WixToolset.Data; | ||
| 13 | using WixToolset.Extensibility; | ||
| 14 | using WixToolset.Extensibility.Services; | ||
| 15 | |||
| 16 | public partial class ToolsetTask | ||
| 17 | { | ||
| 18 | protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) | ||
| 19 | { | ||
| 20 | if (this.RunAsSeparateProcess) | ||
| 21 | { | ||
| 22 | return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); | ||
| 23 | } | ||
| 24 | |||
| 25 | return this.ExecuteInProc($"{commandLineCommands} {responseFileCommands}"); | ||
| 26 | } | ||
| 27 | |||
| 28 | private int ExecuteInProc(string commandLineString) | ||
| 29 | { | ||
| 30 | this.Log.LogMessage(MessageImportance.Normal, $"({this.ToolName}){commandLineString}"); | ||
| 31 | |||
| 32 | var listener = new MsbuildMessageListener(this.Log, this.TaskShortName, this.BuildEngine.ProjectFileOfTaskNode); | ||
| 33 | var exitCode = -1; | ||
| 34 | |||
| 35 | try | ||
| 36 | { | ||
| 37 | var coreProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | ||
| 38 | |||
| 39 | var messaging = coreProvider.GetService<IMessaging>(); | ||
| 40 | messaging.SetListener(listener); | ||
| 41 | |||
| 42 | exitCode = this.ExecuteCoreAsync(coreProvider, commandLineString, CancellationToken.None).GetAwaiter().GetResult(); | ||
| 43 | } | ||
| 44 | catch (WixException e) | ||
| 45 | { | ||
| 46 | listener.Write(e.Error); | ||
| 47 | } | ||
| 48 | catch (Exception e) | ||
| 49 | { | ||
| 50 | this.Log.LogErrorFromException(e, showStackTrace: true, showDetail: true, null); | ||
| 51 | |||
| 52 | if (e is NullReferenceException || e is SEHException) | ||
| 53 | { | ||
| 54 | throw; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | if (exitCode == 0 && this.Log.HasLoggedErrors) | ||
| 59 | { | ||
| 60 | exitCode = -1; | ||
| 61 | } | ||
| 62 | return exitCode; | ||
| 63 | } | ||
| 64 | |||
| 65 | protected sealed override void LogToolCommand(string message) | ||
| 66 | { | ||
| 67 | // Only log this if we're actually going to do it. | ||
| 68 | if (this.RunAsSeparateProcess) | ||
| 69 | { | ||
| 70 | base.LogToolCommand(message); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | protected abstract Task<int> ExecuteCoreAsync(IWixToolsetCoreServiceProvider coreProvider, string commandLineString, CancellationToken cancellationToken); | ||
| 75 | |||
| 76 | protected abstract string TaskShortName { get; } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | #endif | ||
diff --git a/src/wix/WixToolset.BuildTasks/WixExeBaseTask.cs b/src/wix/WixToolset.BuildTasks/WixExeBaseTask.cs index c1904213..5583f64e 100644 --- a/src/wix/WixToolset.BuildTasks/WixExeBaseTask.cs +++ b/src/wix/WixToolset.BuildTasks/WixExeBaseTask.cs | |||
| @@ -5,7 +5,7 @@ namespace WixToolset.BuildTasks | |||
| 5 | /// <summary> | 5 | /// <summary> |
| 6 | /// An MSBuild task to run WiX to update cabinet signatures in a MSI. | 6 | /// An MSBuild task to run WiX to update cabinet signatures in a MSI. |
| 7 | /// </summary> | 7 | /// </summary> |
| 8 | public abstract partial class WixExeBaseTask : ToolsetTask | 8 | public abstract class WixExeBaseTask : ToolsetTask |
| 9 | { | 9 | { |
| 10 | protected override string ToolName => "wix.exe"; | 10 | protected override string ToolName => "wix.exe"; |
| 11 | } | 11 | } |
diff --git a/src/wix/WixToolset.BuildTasks/WixExeBaseTask_Inproc.cs b/src/wix/WixToolset.BuildTasks/WixExeBaseTask_Inproc.cs deleted file mode 100644 index cda5f57f..00000000 --- a/src/wix/WixToolset.BuildTasks/WixExeBaseTask_Inproc.cs +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | // 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 | |||
| 3 | #if !NETCOREAPP | ||
| 4 | namespace WixToolset.BuildTasks | ||
| 5 | { | ||
| 6 | using System; | ||
| 7 | using System.Threading; | ||
| 8 | using System.Threading.Tasks; | ||
| 9 | using WixToolset.Core.Burn; | ||
| 10 | using WixToolset.Core.WindowsInstaller; | ||
| 11 | using WixToolset.Extensibility.Services; | ||
| 12 | |||
| 13 | public abstract partial class WixExeBaseTask | ||
| 14 | { | ||
| 15 | protected override string TaskShortName => "WIX"; | ||
| 16 | |||
| 17 | protected override Task<int> ExecuteCoreAsync(IWixToolsetCoreServiceProvider coreProvider, string commandLineString, CancellationToken cancellationToken) | ||
| 18 | { | ||
| 19 | coreProvider.AddWindowsInstallerBackend() | ||
| 20 | .AddBundleBackend(); | ||
| 21 | |||
| 22 | var commandLine = coreProvider.GetService<ICommandLine>(); | ||
| 23 | var command = commandLine.CreateCommand(commandLineString); | ||
| 24 | return command?.ExecuteAsync(cancellationToken) ?? Task.FromResult(1); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | #endif | ||
diff --git a/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj b/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj index 1fce528e..92651ed2 100644 --- a/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj +++ b/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | <Title>WiX Toolset MSBuild Tasks</Title> | 8 | <Title>WiX Toolset MSBuild Tasks</Title> |
| 9 | <DebugType>embedded</DebugType> | 9 | <DebugType>embedded</DebugType> |
| 10 | <PublishRepositoryUrl>true</PublishRepositoryUrl> | 10 | <PublishRepositoryUrl>true</PublishRepositoryUrl> |
| 11 | <RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)'=='' and '$(TargetFramework)'!='net6.0' ">win-x86;win-x64</RuntimeIdentifiers> | ||
| 12 | <!-- https://github.com/Microsoft/msbuild/issues/2360 --> | ||
| 13 | <PlatformTarget>AnyCPU</PlatformTarget> | 11 | <PlatformTarget>AnyCPU</PlatformTarget> |
| 14 | </PropertyGroup> | 12 | </PropertyGroup> |
| 15 | 13 | ||
| @@ -17,13 +15,4 @@ | |||
| 17 | <PackageReference Include="WixToolset.Dtf.WindowsInstaller" /> | 15 | <PackageReference Include="WixToolset.Dtf.WindowsInstaller" /> |
| 18 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> | 16 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> |
| 19 | </ItemGroup> | 17 | </ItemGroup> |
| 20 | |||
| 21 | <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" > | ||
| 22 | <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" /> | ||
| 23 | <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" /> | ||
| 24 | <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" /> | ||
| 25 | </ItemGroup> | ||
| 26 | |||
| 27 | <ItemGroup Condition="'$(TargetFramework)'=='net6.0' "> | ||
| 28 | </ItemGroup> | ||
| 29 | </Project> | 18 | </Project> |
diff --git a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj index 550ba9da..8c2d866c 100644 --- a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj +++ b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | <PropertyGroup> | 5 | <PropertyGroup> |
| 6 | <TargetFramework>net6.0</TargetFramework> | 6 | <TargetFramework>net6.0</TargetFramework> |
| 7 | <Description>WiX Toolset MSBuild integration</Description> | 7 | <Description>WiX Toolset MSBuild integration</Description> |
| 8 | <PublishDir>$(OutputPath)publish\WixToolset.Sdk\</PublishDir> | 8 | <PublishDir>$(PublishRoot)WixToolset.Sdk\</PublishDir> |
| 9 | <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile> | 9 | <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile> |
| 10 | <NuspecBasePath>$(PublishDir)</NuspecBasePath> | 10 | <NuspecBasePath>$(PublishDir)</NuspecBasePath> |
| 11 | </PropertyGroup> | 11 | </PropertyGroup> |
diff --git a/src/wix/WixToolset.Sdk/tools/WixToolset.Signing.targets b/src/wix/WixToolset.Sdk/tools/WixToolset.Signing.targets index abf25177..a575181a 100644 --- a/src/wix/WixToolset.Sdk/tools/WixToolset.Signing.targets +++ b/src/wix/WixToolset.Sdk/tools/WixToolset.Signing.targets | |||
| @@ -213,7 +213,6 @@ | |||
| 213 | VerboseOutput="$(InscribeVerboseOutput)" | 213 | VerboseOutput="$(InscribeVerboseOutput)" |
| 214 | AdditionalOptions="$(InscribeAdditionalOptions)" | 214 | AdditionalOptions="$(InscribeAdditionalOptions)" |
| 215 | 215 | ||
| 216 | RunAsSeparateProcess="$(RunWixToolsOutOfProc)" | ||
| 217 | ToolExe="$(WixToolExe)" | 216 | ToolExe="$(WixToolExe)" |
| 218 | ToolPath="$(WixToolDir)" /> | 217 | ToolPath="$(WixToolDir)" /> |
| 219 | </Target> | 218 | </Target> |
| @@ -255,7 +254,6 @@ | |||
| 255 | VerboseOutput="$(InscribeVerboseOutput)" | 254 | VerboseOutput="$(InscribeVerboseOutput)" |
| 256 | AdditionalOptions="$(InscribeAdditionalOptions)" | 255 | AdditionalOptions="$(InscribeAdditionalOptions)" |
| 257 | 256 | ||
| 258 | RunAsSeparateProcess="$(RunWixToolsOutOfProc)" | ||
| 259 | ToolExe="$(WixToolExe)" | 257 | ToolExe="$(WixToolExe)" |
| 260 | ToolPath="$(WixToolDir)"> | 258 | ToolPath="$(WixToolDir)"> |
| 261 | <Output TaskParameter="Output" ItemName="SignBundleEngine" /> | 259 | <Output TaskParameter="Output" ItemName="SignBundleEngine" /> |
| @@ -304,7 +302,6 @@ | |||
| 304 | VerboseOutput="$(InscribeVerboseOutput)" | 302 | VerboseOutput="$(InscribeVerboseOutput)" |
| 305 | AdditionalOptions="$(InscribeAdditionalOptions)" | 303 | AdditionalOptions="$(InscribeAdditionalOptions)" |
| 306 | 304 | ||
| 307 | RunAsSeparateProcess="$(RunWixToolsOutOfProc)" | ||
| 308 | ToolExe="$(WixToolExe)" | 305 | ToolExe="$(WixToolExe)" |
| 309 | ToolPath="$(WixToolDir)"> | 306 | ToolPath="$(WixToolDir)"> |
| 310 | <Output TaskParameter="Output" ItemName="SignBundle" /> | 307 | <Output TaskParameter="Output" ItemName="SignBundle" /> |
diff --git a/src/wix/WixToolset.Sdk/tools/wix.targets b/src/wix/WixToolset.Sdk/tools/wix.targets index 752c7490..340fb91f 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.targets | |||
| @@ -27,10 +27,8 @@ | |||
| 27 | <!-- These properties can be overridden to support non-default installations. --> | 27 | <!-- These properties can be overridden to support non-default installations. --> |
| 28 | <PropertyGroup> | 28 | <PropertyGroup> |
| 29 | <WixBinDir Condition=" '$(WixBinDir)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">$(MSBuildThisFileDirectory)net6.0\</WixBinDir> | 29 | <WixBinDir Condition=" '$(WixBinDir)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">$(MSBuildThisFileDirectory)net6.0\</WixBinDir> |
| 30 | <WixBinDir Condition=" '$(WixBinDir)' == '' ">$(MSBuildThisFileDirectory)net472\x86\</WixBinDir> | 30 | <WixBinDir Condition=" '$(WixBinDir)' == '' ">$(MSBuildThisFileDirectory)net472\</WixBinDir> |
| 31 | <WixBinDir64 Condition=" '$(WixBinDir64)' == '' and '$(MSBuildRuntimeType)' != 'Core' ">$(MSBuildThisFileDirectory)net472\x64\</WixBinDir64> | ||
| 32 | <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixBinDir)WixToolset.BuildTasks.dll</WixTasksPath> | 31 | <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixBinDir)WixToolset.BuildTasks.dll</WixTasksPath> |
| 33 | <WixTasksPath64 Condition=" '$(WixTasksPath64)' == '' and '$(WixBinDir64)' != '' ">$(WixBinDir64)WixToolset.BuildTasks.dll</WixTasksPath64> | ||
| 34 | </PropertyGroup> | 32 | </PropertyGroup> |
| 35 | 33 | ||
| 36 | <PropertyGroup> | 34 | <PropertyGroup> |
| @@ -147,39 +145,14 @@ | |||
| 147 | *********************************************************************************************** | 145 | *********************************************************************************************** |
| 148 | --> | 146 | --> |
| 149 | 147 | ||
| 150 | <!-- These tasks can be used as general-purpose build tasks. --> | 148 | <UsingTask TaskName="CreateItemAvoidingInference" AssemblyFile="$(WixTasksPath)" /> |
| 151 | <UsingTask TaskName="WixBuild" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | 149 | <UsingTask TaskName="UpdateProjectReferenceMetadata" AssemblyFile="$(WixTasksPath)" /> |
| 152 | <UsingTask TaskName="WixBuild" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 150 | <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" AssemblyFile="$(WixTasksPath)" /> |
| 153 | <UsingTask TaskName="WixBuild" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 151 | <UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" /> |
| 154 | 152 | <UsingTask TaskName="ReadTracking" AssemblyFile="$(WixTasksPath)" /> | |
| 155 | <!-- These tasks are specific to the build process defined in this file, and are not considered general-purpose build tasks. --> | 153 | <UsingTask TaskName="ResolveWixReferences" AssemblyFile="$(WixTasksPath)" /> |
| 156 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | 154 | <UsingTask TaskName="WixBuild" AssemblyFile="$(WixTasksPath)" /> |
| 157 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 155 | <UsingTask TaskName="WindowsInstallerValidation" AssemblyFile="$(WixTasksPath)" /> |
| 158 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 159 | |||
| 160 | <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 161 | <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 162 | <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 163 | |||
| 164 | <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 165 | <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 166 | <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 167 | |||
| 168 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 169 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 170 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 171 | |||
| 172 | <UsingTask TaskName="ReadTracking" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 173 | <UsingTask TaskName="ReadTracking" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 174 | <UsingTask TaskName="ReadTracking" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 175 | |||
| 176 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 177 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 178 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 179 | |||
| 180 | <UsingTask TaskName="WindowsInstallerValidation" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | ||
| 181 | <UsingTask TaskName="WindowsInstallerValidation" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | ||
| 182 | <UsingTask TaskName="WindowsInstallerValidation" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | ||
| 183 | 156 | ||
| 184 | <!-- | 157 | <!-- |
| 185 | *********************************************************************************************** | 158 | *********************************************************************************************** |
| @@ -661,7 +634,6 @@ | |||
| 661 | TreatSpecificWarningsAsErrors="$(TreatSpecificWarningsAsErrors)" | 634 | TreatSpecificWarningsAsErrors="$(TreatSpecificWarningsAsErrors)" |
| 662 | VerboseOutput="$(VerboseOutput)" | 635 | VerboseOutput="$(VerboseOutput)" |
| 663 | 636 | ||
| 664 | RunAsSeparateProcess="$(RunWixToolsOutOfProc)" | ||
| 665 | ToolExe="$(WixToolExe)" | 637 | ToolExe="$(WixToolExe)" |
| 666 | ToolPath="$(WixToolDir)" | 638 | ToolPath="$(WixToolDir)" |
| 667 | YieldDuringToolExecution="true"> | 639 | YieldDuringToolExecution="true"> |
diff --git a/src/wix/publish_t.proj b/src/wix/publish_t.proj index 0f034f2a..a50c75b8 100644 --- a/src/wix/publish_t.proj +++ b/src/wix/publish_t.proj | |||
| @@ -1,14 +1,37 @@ | |||
| 1 | <Project Sdk="Microsoft.Build.Traversal"> | 1 | <Project Sdk="Microsoft.Build.Traversal"> |
| 2 | <PropertyGroup> | ||
| 3 | <StagePublishX86>$(BaseIntermediateOutputPath)$(Configuration)\net472\x86\</StagePublishX86> | ||
| 4 | <StagePublishX64>$(BaseIntermediateOutputPath)$(Configuration)\net472\x64\</StagePublishX64> | ||
| 5 | <StagePublishDnc>$(BaseIntermediateOutputPath)$(Configuration)\net6.0\</StagePublishDnc> | ||
| 6 | |||
| 7 | <PublishBuildFolder>$(PublishRoot)WixToolset.Sdk\build\</PublishBuildFolder> | ||
| 8 | <PublishHere>$(PublishRoot)WixToolset.Sdk\tools\net472\</PublishHere> | ||
| 9 | <PublishX86>$(PublishRoot)WixToolset.Sdk\tools\net472\x86\</PublishX86> | ||
| 10 | <PublishX64>$(PublishRoot)WixToolset.Sdk\tools\net472\x64\</PublishX64> | ||
| 11 | <PublishDnc>$(PublishRoot)WixToolset.Sdk\tools\net6.0\</PublishDnc> | ||
| 12 | </PropertyGroup> | ||
| 13 | |||
| 2 | <ItemGroup> | 14 | <ItemGroup> |
| 15 | <ProjectReference Include="WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" Properties="TargetFramework=net472;PublishDir=$(StagePublishX86)WixToolset.BuildTasks" Targets="Publish" /> | ||
| 16 | <ProjectReference Include="WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" Properties="TargetFramework=net6.0;UseAppHost=false;PublishDir=$(StagePublishDnc)WixToolset.BuildTasks" Targets="Publish" /> | ||
| 17 | |||
| 3 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net6.0;PublishDir=$(BaseOutputPath)$(Configuration)\publish\wix\" Targets="Publish" /> | 18 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net6.0;PublishDir=$(BaseOutputPath)$(Configuration)\publish\wix\" Targets="Publish" /> |
| 4 | 19 | ||
| 5 | <ProjectReference Include="WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x86;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net472\x86\buildtasks\" Targets="Publish" /> | 20 | <!-- wix.exe doesn't need to filter any files so publish it straight into its final location --> |
| 6 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x86;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net472\x86\wix\" Targets="Publish" /> | 21 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x86;PublishDir=$(PublishX86)" Targets="Publish" /> |
| 22 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x64;PublishDir=$(PublishX64)" Targets="Publish" /> | ||
| 23 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net6.0;UseAppHost=false;PublishDir=$(PublishDnc)" Targets="Publish" /> | ||
| 24 | </ItemGroup> | ||
| 7 | 25 | ||
| 8 | <ProjectReference Include="WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x64;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net472\x64\buildtasks\" Targets="Publish" /> | 26 | <Target Name="CopyToFinalPublishFolder" AfterTargets="Build"> |
| 9 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net472;RuntimeIdentifier=win-x64;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net472\x64\wix\" Targets="Publish" /> | 27 | <ItemGroup> |
| 28 | <From Include="$(StagePublishX86)\WixToolset.BuildTasks\*.*" Exclude="$(StagePublishx86)\WixToolset.BuildTasks\Microsoft.Build.*.dll" To="$(PublishHere)" /> | ||
| 29 | <From Include="$(StagePublishDnc)\WixToolset.BuildTasks\*.*" Exclude="$(StagePublishDnc)\WixToolset.BuildTasks\Microsoft.Build.*.dll" To="$(PublishDnc)" /> | ||
| 30 | </ItemGroup> | ||
| 10 | 31 | ||
| 11 | <ProjectReference Include="WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" Properties="TargetFramework=net6.0;UseAppHost=false;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net6.0\buildtasks\" Targets="Publish" /> | 32 | <Copy SourceFiles="@(From)" |
| 12 | <ProjectReference Include="wix\wix.csproj" Properties="TargetFramework=net6.0;UseAppHost=false;PublishDir=$(BaseIntermediateOutputPath)$(Configuration)\WixToolset.Sdk\separate\net6.0\wix\" Targets="Publish" /> | 33 | DestinationFiles="%(To)%(RecursiveDir)%(Filename)%(Extension)" |
| 13 | </ItemGroup> | 34 | SkipUnchangedFiles="true" |
| 35 | UseHardlinksIfPossible="true" /> | ||
| 36 | </Target> | ||
| 14 | </Project> | 37 | </Project> |
diff --git a/src/wix/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs b/src/wix/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs index f158e3f2..5271c1bb 100644 --- a/src/wix/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs +++ b/src/wix/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs | |||
| @@ -2,8 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.BuildTasks | 3 | namespace WixToolsetTest.BuildTasks |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 5 | using System.IO; | 6 | using System.IO; |
| 6 | using System.Linq; | 7 | using System.Linq; |
| 8 | using System.Runtime.InteropServices; | ||
| 7 | using Microsoft.Build.Utilities; | 9 | using Microsoft.Build.Utilities; |
| 8 | using WixBuildTools.TestSupport; | 10 | using WixBuildTools.TestSupport; |
| 9 | using WixToolset.BuildTasks; | 11 | using WixToolset.BuildTasks; |
| @@ -13,16 +15,22 @@ namespace WixToolsetTest.BuildTasks | |||
| 13 | 15 | ||
| 14 | public class WixBuildTaskFixture | 16 | public class WixBuildTaskFixture |
| 15 | { | 17 | { |
| 18 | public static readonly string PublishedWixSdkToolsFolder = Path.Combine(Path.GetDirectoryName(new Uri(typeof(WixBuildTaskFixture).Assembly.CodeBase).AbsolutePath), "..", "..", "..", "publish", "WixToolset.Sdk", "tools"); | ||
| 19 | |||
| 20 | // This line replicates what happens in WixBuild task when hosted in the PublishedWixSdkToolsFolder. However, WixBuild task is hosted inproc to this test assembly so the | ||
| 21 | // root folder is relative to the test assembly's folder which does not have wix.exe local. So, we have to find wix.exe relative to PublishedWixSdkToolsFolder. | ||
| 22 | public static readonly string PublishedWixExeFolder = Path.Combine(PublishedWixSdkToolsFolder, "net472", RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()); | ||
| 23 | |||
| 16 | [Fact] | 24 | [Fact] |
| 17 | public void CanBuildSimpleMsiPackage() | 25 | public void CanBuildSimpleMsiPackage() |
| 18 | { | 26 | { |
| 19 | var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); | 27 | var folder = TestData.Get("TestData", "SimpleMsiPackage", "MsiPackage"); |
| 20 | 28 | ||
| 21 | using (var fs = new DisposableFileSystem()) | 29 | using (var fs = new DisposableFileSystem()) |
| 22 | { | 30 | { |
| 23 | var baseFolder = fs.GetFolder(); | 31 | var baseFolder = fs.GetFolder(); |
| 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 32 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 25 | var pdbPath = Path.Combine(baseFolder, @"bin\testpackage.wixpdb"); | 33 | var pdbPath = Path.Combine(baseFolder, "bin", "testpackage.wixpdb"); |
| 26 | var engine = new FakeBuildEngine(); | 34 | var engine = new FakeBuildEngine(); |
| 27 | 35 | ||
| 28 | var task = new WixBuild | 36 | var task = new WixBuild |
| @@ -42,24 +50,25 @@ namespace WixToolsetTest.BuildTasks | |||
| 42 | new TaskItem(Path.Combine(folder, "data")), | 50 | new TaskItem(Path.Combine(folder, "data")), |
| 43 | }, | 51 | }, |
| 44 | IntermediateDirectory = new TaskItem(intermediateFolder), | 52 | IntermediateDirectory = new TaskItem(intermediateFolder), |
| 45 | OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), | 53 | OutputFile = new TaskItem(Path.Combine(baseFolder, "bin", "test.msi")), |
| 46 | PdbType = "Full", | 54 | PdbType = "Full", |
| 47 | PdbFile = new TaskItem(pdbPath), | 55 | PdbFile = new TaskItem(pdbPath), |
| 48 | DefaultCompressionLevel = "nOnE", | 56 | DefaultCompressionLevel = "nOnE", |
| 57 | ToolPath = PublishedWixExeFolder | ||
| 49 | }; | 58 | }; |
| 50 | 59 | ||
| 51 | var result = task.Execute(); | 60 | var result = task.Execute(); |
| 52 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); | 61 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); |
| 53 | 62 | ||
| 54 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); | 63 | Assert.True(File.Exists(Path.Combine(baseFolder, "bin", "test.msi"))); |
| 55 | Assert.True(File.Exists(pdbPath)); | 64 | Assert.True(File.Exists(pdbPath)); |
| 56 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); | 65 | Assert.True(File.Exists(Path.Combine(baseFolder, "bin", "cab1.cab"))); |
| 57 | 66 | ||
| 58 | var intermediate = Intermediate.Load(pdbPath); | 67 | var intermediate = Intermediate.Load(pdbPath); |
| 59 | var section = intermediate.Sections.Single(); | 68 | var section = intermediate.Sections.Single(); |
| 60 | 69 | ||
| 61 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | 70 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); |
| 62 | WixAssert.StringEqual(Path.Combine(folder, @"data\test.txt"), fileSymbol[FileSymbolFields.Source].AsPath().Path); | 71 | WixAssert.StringEqual(Path.Combine(folder, "data", "test.txt"), fileSymbol[FileSymbolFields.Source].AsPath().Path); |
| 63 | WixAssert.StringEqual(@"test.txt", fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath().Path); | 72 | WixAssert.StringEqual(@"test.txt", fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath().Path); |
| 64 | } | 73 | } |
| 65 | } | 74 | } |
diff --git a/src/wix/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/wix/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj index f8bb4438..d53dbe02 100644 --- a/src/wix/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj +++ b/src/wix/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="Microsoft.NET.Sdk"> |
| 5 | <PropertyGroup> | 5 | <PropertyGroup> |
| 6 | <TargetFramework>net472</TargetFramework> | 6 | <TargetFramework>net472</TargetFramework> |
| 7 | <RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
| 8 | <RequiresNativeWixAssets>true</RequiresNativeWixAssets> | 7 | <RequiresNativeWixAssets>true</RequiresNativeWixAssets> |
| 9 | <IsWixTestProject>true</IsWixTestProject> | 8 | <IsWixTestProject>true</IsWixTestProject> |
| 10 | </PropertyGroup> | 9 | </PropertyGroup> |
| @@ -18,11 +17,11 @@ | |||
| 18 | 17 | ||
| 19 | <ItemGroup> | 18 | <ItemGroup> |
| 20 | <ProjectReference Include="..\..\WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" /> | 19 | <ProjectReference Include="..\..\WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" /> |
| 21 | <ProjectReference Include="..\..\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" /> | ||
| 22 | </ItemGroup> | 20 | </ItemGroup> |
| 23 | 21 | ||
| 24 | <ItemGroup> | 22 | <ItemGroup> |
| 25 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> | 23 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> |
| 24 | <PackageReference Include="WixToolset.Data" /> | ||
| 26 | <PackageReference Include="WixBuildTools.TestSupport" /> | 25 | <PackageReference Include="WixBuildTools.TestSupport" /> |
| 27 | </ItemGroup> | 26 | </ItemGroup> |
| 28 | </Project> | 27 | </Project> |
diff --git a/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs b/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs index bd6f70bc..1201620b 100644 --- a/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs +++ b/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs | |||
| @@ -20,7 +20,7 @@ namespace WixToolsetTest.Sdk | |||
| 20 | [InlineData(BuildSystem.MSBuild64)] | 20 | [InlineData(BuildSystem.MSBuild64)] |
| 21 | public void CanBuildSimpleBundle(BuildSystem buildSystem) | 21 | public void CanBuildSimpleBundle(BuildSystem buildSystem) |
| 22 | { | 22 | { |
| 23 | var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage"); | 23 | var sourceFolder = TestData.Get(@"TestData", "SimpleMsiPackage"); |
| 24 | 24 | ||
| 25 | using (var fs = new TestDataFolderFileSystem()) | 25 | using (var fs = new TestDataFolderFileSystem()) |
| 26 | { | 26 | { |
| @@ -430,13 +430,10 @@ namespace WixToolsetTest.Sdk | |||
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | [Theory] | 432 | [Theory] |
| 433 | [InlineData(BuildSystem.DotNetCoreSdk, null)] | 433 | [InlineData(BuildSystem.DotNetCoreSdk)] |
| 434 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | 434 | [InlineData(BuildSystem.MSBuild)] |
| 435 | [InlineData(BuildSystem.MSBuild, null)] | 435 | [InlineData(BuildSystem.MSBuild64)] |
| 436 | [InlineData(BuildSystem.MSBuild, true)] | 436 | public void CanBuildSimpleMsiPackageAsWixipl(BuildSystem buildSystem) |
| 437 | [InlineData(BuildSystem.MSBuild64, null)] | ||
| 438 | [InlineData(BuildSystem.MSBuild64, true)] | ||
| 439 | public void CanBuildSimpleMsiPackageAsWixipl(BuildSystem buildSystem, bool? outOfProc) | ||
| 440 | { | 437 | { |
| 441 | var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); | 438 | var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); |
| 442 | 439 | ||
| @@ -451,10 +448,10 @@ namespace WixToolsetTest.Sdk | |||
| 451 | { | 448 | { |
| 452 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), | 449 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), |
| 453 | "-p:OutputType=IntermediatePostLink", | 450 | "-p:OutputType=IntermediatePostLink", |
| 454 | }, outOfProc: outOfProc); | 451 | }); |
| 455 | result.AssertSuccess(); | 452 | result.AssertSuccess(); |
| 456 | 453 | ||
| 457 | var wixBuildCommands = MsbuildUtilities.GetToolCommandLines(result, "wix", "build", buildSystem, outOfProc); | 454 | var wixBuildCommands = MsbuildUtilities.GetToolCommandLines(result, "wix", "build", buildSystem); |
| 458 | Assert.Single(wixBuildCommands); | 455 | Assert.Single(wixBuildCommands); |
| 459 | 456 | ||
| 460 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) | 457 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) |
| @@ -465,13 +462,10 @@ namespace WixToolsetTest.Sdk | |||
| 465 | } | 462 | } |
| 466 | 463 | ||
| 467 | [Theory] | 464 | [Theory] |
| 468 | [InlineData(BuildSystem.DotNetCoreSdk, null)] | 465 | [InlineData(BuildSystem.DotNetCoreSdk)] |
| 469 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | 466 | [InlineData(BuildSystem.MSBuild)] |
| 470 | [InlineData(BuildSystem.MSBuild, null)] | 467 | [InlineData(BuildSystem.MSBuild64)] |
| 471 | [InlineData(BuildSystem.MSBuild, true)] | 468 | public void CanBuildSimpleWixlib(BuildSystem buildSystem) |
| 472 | [InlineData(BuildSystem.MSBuild64, null)] | ||
| 473 | [InlineData(BuildSystem.MSBuild64, true)] | ||
| 474 | public void CanBuildSimpleWixlib(BuildSystem buildSystem, bool? outOfProc) | ||
| 475 | { | 469 | { |
| 476 | var sourceFolder = TestData.Get(@"TestData", "Wixlib", "SimpleWixlib"); | 470 | var sourceFolder = TestData.Get(@"TestData", "Wixlib", "SimpleWixlib"); |
| 477 | 471 | ||
| @@ -485,10 +479,10 @@ namespace WixToolsetTest.Sdk | |||
| 485 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 479 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
| 486 | { | 480 | { |
| 487 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), | 481 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), |
| 488 | }, outOfProc: outOfProc); | 482 | }); |
| 489 | result.AssertSuccess(); | 483 | result.AssertSuccess(); |
| 490 | 484 | ||
| 491 | var wixBuildCommands = MsbuildUtilities.GetToolCommandLines(result, "wix", "build", buildSystem, outOfProc); | 485 | var wixBuildCommands = MsbuildUtilities.GetToolCommandLines(result, "wix", "build", buildSystem); |
| 492 | Assert.Single(wixBuildCommands); | 486 | Assert.Single(wixBuildCommands); |
| 493 | 487 | ||
| 494 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) | 488 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) |
| @@ -499,13 +493,10 @@ namespace WixToolsetTest.Sdk | |||
| 499 | } | 493 | } |
| 500 | 494 | ||
| 501 | [Theory] | 495 | [Theory] |
| 502 | [InlineData(BuildSystem.DotNetCoreSdk, null)] | 496 | [InlineData(BuildSystem.DotNetCoreSdk)] |
| 503 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | 497 | [InlineData(BuildSystem.MSBuild)] |
| 504 | [InlineData(BuildSystem.MSBuild, null)] | 498 | [InlineData(BuildSystem.MSBuild64)] |
| 505 | [InlineData(BuildSystem.MSBuild, true)] | 499 | public void CanBuildPackageIncludingSimpleWixlib(BuildSystem buildSystem) |
| 506 | [InlineData(BuildSystem.MSBuild64, null)] | ||
| 507 | [InlineData(BuildSystem.MSBuild64, true)] | ||
| 508 | public void CanBuildPackageIncludingSimpleWixlib(BuildSystem buildSystem, bool? outOfProc) | ||
| 509 | { | 500 | { |
| 510 | var sourceFolder = TestData.Get(@"TestData", "Wixlib"); | 501 | var sourceFolder = TestData.Get(@"TestData", "Wixlib"); |
| 511 | 502 | ||
| @@ -519,7 +510,7 @@ namespace WixToolsetTest.Sdk | |||
| 519 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 510 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
| 520 | { | 511 | { |
| 521 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), | 512 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), |
| 522 | }, outOfProc: outOfProc); | 513 | }); |
| 523 | result.AssertSuccess(); | 514 | result.AssertSuccess(); |
| 524 | 515 | ||
| 525 | var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) | 516 | var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) |
| @@ -612,7 +603,7 @@ namespace WixToolsetTest.Sdk | |||
| 612 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 603 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
| 613 | { | 604 | { |
| 614 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixToolDir", Path.Combine(MsbuildFixture.WixMsbuildPath, "broken", "net461")), | 605 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixToolDir", Path.Combine(MsbuildFixture.WixMsbuildPath, "broken", "net461")), |
| 615 | }, outOfProc: true); | 606 | }); |
| 616 | Assert.Equal(1, result.ExitCode); | 607 | Assert.Equal(1, result.ExitCode); |
| 617 | 608 | ||
| 618 | var expectedMessage = "System.PlatformNotSupportedException: Could not find platform specific 'wixnative.exe' ---> System.IO.FileNotFoundException: Could not find internal piece of WiX Toolset from"; | 609 | var expectedMessage = "System.PlatformNotSupportedException: Could not find platform specific 'wixnative.exe' ---> System.IO.FileNotFoundException: Could not find internal piece of WiX Toolset from"; |
diff --git a/src/wix/wix.cmd b/src/wix/wix.cmd index e1bfe384..c0a1c384 100644 --- a/src/wix/wix.cmd +++ b/src/wix/wix.cmd | |||
| @@ -3,14 +3,19 @@ | |||
| 3 | 3 | ||
| 4 | @set _C=Debug | 4 | @set _C=Debug |
| 5 | @set _L=%~dp0..\..\build\logs | 5 | @set _L=%~dp0..\..\build\logs |
| 6 | |||
| 6 | :parse_args | 7 | :parse_args |
| 7 | @if /i "%1"=="release" set _C=Release | 8 | @if /i "%1"=="release" set _C=Release |
| 9 | @if /i "%1"=="inc" set _INC=1 | ||
| 10 | @if /i "%1"=="clean" set _CLEAN=1 | ||
| 8 | @if not "%1"=="" shift & goto parse_args | 11 | @if not "%1"=="" shift & goto parse_args |
| 9 | 12 | ||
| 10 | @set _B=%~dp0..\..\build\wix\%_C% | 13 | @set _B=%~dp0..\..\build\wix\%_C% |
| 11 | @set _P_OBJ=%~dp0..\..\build\wix\obj\publish_t\%_C%\ | 14 | |
| 12 | @set _P=%~dp0..\..\build\wix\%_C%\publish\ | 15 | :: Clean |
| 13 | @set _RCO=/S /R:1 /W:1 /NP /XO /NS /NC /NFL /NDL /NJH /NJS | 16 | |
| 17 | @if "%_INC%"=="" call :clean | ||
| 18 | @if NOT "%_CLEAN%"=="" goto :end | ||
| 14 | 19 | ||
| 15 | @echo Building wix %_C% | 20 | @echo Building wix %_C% |
| 16 | 21 | ||
| @@ -23,29 +28,8 @@ msbuild wixnative\wixnative_t.proj -p:Configuration=%_C% -nologo -m -warnaserror | |||
| 23 | 28 | ||
| 24 | msbuild wix.sln -p:Configuration=%_C% -nologo -m -warnaserror -bl:%_L%\wix_build.binlog || exit /b | 29 | msbuild wix.sln -p:Configuration=%_C% -nologo -m -warnaserror -bl:%_L%\wix_build.binlog || exit /b |
| 25 | 30 | ||
| 26 | |||
| 27 | :: Pre-Publish Test | ||
| 28 | dotnet test ^ | ||
| 29 | %_B%\test\WixToolsetTest.Converters\net6.0\WixToolsetTest.Converters.dll ^ | ||
| 30 | %_B%\test\WixToolsetTest.Converters.Symbolizer\net472\WixToolsetTest.Converters.Symbolizer.dll ^ | ||
| 31 | %_B%\test\WixToolsetTest.Core\net6.0\WixToolsetTest.Core.dll ^ | ||
| 32 | %_B%\test\WixToolsetTest.Core.Native\net6.0\win-x64\WixToolsetTest.Core.Native.dll ^ | ||
| 33 | %_B%\test\WixToolsetTest.CoreIntegration\net6.0\WixToolsetTest.CoreIntegration.dll ^ | ||
| 34 | --nologo -l "trx;LogFileName=%_L%\TestResults\wix_prepublish.trx" || exit /b | ||
| 35 | |||
| 36 | |||
| 37 | :: Publish | ||
| 38 | msbuild publish_t.proj -p:Configuration=%_C% -nologo -warnaserror -bl:%_L%\wix_publish.binlog || exit /b | 31 | msbuild publish_t.proj -p:Configuration=%_C% -nologo -warnaserror -bl:%_L%\wix_publish.binlog || exit /b |
| 39 | 32 | ||
| 40 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net472\x86\buildtasks %_P%\WixToolset.Sdk\tools\net472\x86 %_RCO% /XF Microsoft.Build.*.dll | ||
| 41 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net472\x86\wix %_P%\WixToolset.Sdk\tools\net472\x86 %_RCO% | ||
| 42 | |||
| 43 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net472\x64\buildtasks %_P%\WixToolset.Sdk\tools\net472\x64 %_RCO% /XF Microsoft.Build.*.dll | ||
| 44 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net472\x64\wix %_P%\WixToolset.Sdk\tools\net472\x64 %_RCO% | ||
| 45 | |||
| 46 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net6.0\buildtasks %_P%\WixToolset.Sdk\tools\net6.0 %_RCO% /XF Microsoft.Build.*.dll | ||
| 47 | robocopy %_P_OBJ%\WixToolset.Sdk\separate\net6.0\wix %_P%\WixToolset.Sdk\tools\net6.0 %_RCO% | ||
| 48 | |||
| 49 | msbuild -t:Publish -p:Configuration=%_C% -nologo -warnaserror WixToolset.Sdk\WixToolset.Sdk.csproj -bl:%_L%\wix_sdk_publish.binlog || exit /b | 33 | msbuild -t:Publish -p:Configuration=%_C% -nologo -warnaserror WixToolset.Sdk\WixToolset.Sdk.csproj -bl:%_L%\wix_sdk_publish.binlog || exit /b |
| 50 | 34 | ||
| 51 | :: TODO - used by MsbuildFixture.ReportsInnerExceptionForUnexpectedExceptions test | 35 | :: TODO - used by MsbuildFixture.ReportsInnerExceptionForUnexpectedExceptions test |
| @@ -54,13 +38,41 @@ msbuild -t:Publish -p:Configuration=%_C% -nologo -warnaserror WixToolset.Sdk\Wix | |||
| 54 | 38 | ||
| 55 | :: Test | 39 | :: Test |
| 56 | dotnet test ^ | 40 | dotnet test ^ |
| 57 | %_B%\test\WixToolsetTest.BuildTasks\net472\win-x64\WixToolsetTest.BuildTasks.dll ^ | 41 | %_B%\test\WixToolsetTest.Converters\net6.0\WixToolsetTest.Converters.dll ^ |
| 42 | %_B%\test\WixToolsetTest.Converters.Symbolizer\net472\WixToolsetTest.Converters.Symbolizer.dll ^ | ||
| 43 | %_B%\test\WixToolsetTest.Core\net6.0\WixToolsetTest.Core.dll ^ | ||
| 44 | %_B%\test\WixToolsetTest.Core.Native\net6.0\win-x64\WixToolsetTest.Core.Native.dll ^ | ||
| 45 | %_B%\test\WixToolsetTest.CoreIntegration\net6.0\WixToolsetTest.CoreIntegration.dll ^ | ||
| 46 | %_B%\test\WixToolsetTest.BuildTasks\net472\WixToolsetTest.BuildTasks.dll ^ | ||
| 58 | %_B%\test\WixToolsetTest.Sdk\net472\WixToolsetTest.Sdk.dll ^ | 47 | %_B%\test\WixToolsetTest.Sdk\net472\WixToolsetTest.Sdk.dll ^ |
| 59 | --nologo -l "trx;LogFileName=%_L%\TestResults\wix_postpublish.trx" || exit /b | 48 | --nologo -l "trx;LogFileName=%_L%\TestResults\wix.trx" || exit /b |
| 60 | 49 | ||
| 61 | 50 | ||
| 62 | :: Pack | 51 | :: Pack |
| 63 | msbuild pack_t.proj -p:Configuration=%_C% -nologo -m -warnaserror -bl:%_L%\wix_pack.binlog || exit /b | 52 | msbuild pack_t.proj -p:Configuration=%_C% -nologo -m -warnaserror -bl:%_L%\wix_pack.binlog || exit /b |
| 64 | 53 | ||
| 54 | @goto :end | ||
| 55 | |||
| 56 | :clean | ||
| 57 | @rd /s/q "..\..\build\wix" 2> nul | ||
| 58 | @del "..\..\build\artifacts\wix.*.nupkg" 2> nul | ||
| 59 | @del "..\..\build\artifacts\WixToolset.BuildTasks.*.nupkg" 2> nul | ||
| 60 | @del "..\..\build\artifacts\WixToolset.Converters.*.nupkg" 2> nul | ||
| 61 | @del "..\..\build\artifacts\WixToolset.Core.*.nupkg" 2> nul | ||
| 62 | @del "..\..\build\artifacts\WixToolset.Sdk.*.nupkg" 2> nul | ||
| 63 | @del "%_L%\TestResults\wix.trx" 2> nul | ||
| 64 | @rd /s/q "%USERPROFILE%\.nuget\packages\wix" 2> nul | ||
| 65 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.buildtasks" 2> nul | ||
| 66 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.converters" 2> nul | ||
| 67 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.converters.symbolizer" 2> nul | ||
| 68 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.core" 2> nul | ||
| 69 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.core.burn" 2> nul | ||
| 70 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.core.native" 2> nul | ||
| 71 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.core.windowsinstaller" 2> nul | ||
| 72 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.core.testpackage" 2> nul | ||
| 73 | @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.sdk" 2> nul | ||
| 74 | @exit /b | ||
| 75 | |||
| 76 | :end | ||
| 65 | @popd | 77 | @popd |
| 66 | @endlocal | 78 | @endlocal |
