mirror of
				https://github.com/velopack/velopack.git
				synced 2025-10-25 15:19:22 +00:00 
			
		
		
		
	Removes MSI deployment tool feature
Removes the option to build a separate MSI deployment tool. This simplifies the packaging process and reduces the number of artifacts produced. The functionality is deemed redundant and not widely used.
This commit is contained in:
		| @@ -20,10 +20,8 @@ namespace Velopack | ||||
|         Portable = 3, | ||||
|         /// <summary> An application installer archive. </summary> | ||||
|         Installer = 4, | ||||
|         /// <summary> A Windows Installer package (.msi) for the deployment tool.</summary> | ||||
|         MsiDeploymentTool = 5, | ||||
|         /// <summary> A Windows Installer package (.msi).</summary> | ||||
|         Msi = 6, | ||||
|         Msi = 5, | ||||
|     } | ||||
| 
 | ||||
|     /// <summary> | ||||
|   | ||||
| @@ -103,7 +103,6 @@ public class PackTask : MSBuildAsyncTask | ||||
|      | ||||
|     public string? Compression { get; set; } | ||||
| 
 | ||||
|     public bool BuildMsiDeploymentTool { get; set; } | ||||
|     public bool BuildMsi { get; set; } | ||||
| 
 | ||||
|     public string? MsiVersionOverride { get; set; } | ||||
|   | ||||
| @@ -220,12 +220,6 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions> | ||||
|         Log.Debug($"Setup bundle created '{Path.GetFileName(targetSetupExe)}'."); | ||||
|         setupExeProgress(100); | ||||
| 
 | ||||
|         if (Options.BuildMsiDeploymentTool && VelopackRuntimeInfo.IsWindows) { | ||||
|             var msiName = DefaultName.GetSuggestedMsiDeploymentToolName(Options.PackId, Options.Channel, TargetOs); | ||||
|             var msiPath = createAsset(msiName, VelopackAssetType.MsiDeploymentTool); | ||||
|             CompileWixTemplateToMsiDeploymentTool(msiProgress, targetSetupExe, msiPath); | ||||
|         } | ||||
| 
 | ||||
|         if (Options.BuildMsi && VelopackRuntimeInfo.IsWindows) { | ||||
|             var msiName = DefaultName.GetSuggestedMsiName(Options.PackId, Options.Channel, TargetOs); | ||||
|             var msiPath = createAsset(msiName, VelopackAssetType.Msi); | ||||
| @@ -730,83 +724,6 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions> | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     [SupportedOSPlatform("windows")] | ||||
|     private void CompileWixTemplateToMsiDeploymentTool(Action<int> progress, | ||||
|         string setupExePath, string msiFilePath) | ||||
|     { | ||||
|         bool packageAs64Bit = | ||||
|             Options.TargetRuntime.Architecture is RuntimeCpu.x64 or RuntimeCpu.arm64; | ||||
| 
 | ||||
|         Log.Info($"Compiling machine-wide msi deployment tool in {(packageAs64Bit ? "64-bit" : "32-bit")} mode"); | ||||
| 
 | ||||
|         var outputDirectory = Path.GetDirectoryName(setupExePath); | ||||
|         var setupName = Path.GetFileNameWithoutExtension(setupExePath); | ||||
|         var culture = CultureInfo.GetCultureInfo("en-US").TextInfo.ANSICodePage; | ||||
| 
 | ||||
|         // WiX Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or | ||||
|         // periods(.). Every identifier must begin with either a letter or an underscore. | ||||
|         var wixId = Regex.Replace(Options.PackId, @"[^\w\.]", "_"); | ||||
|         if (char.GetUnicodeCategory(wixId[0]) == UnicodeCategory.DecimalDigitNumber) | ||||
|             wixId = "_" + wixId; | ||||
| 
 | ||||
|         Regex stacheRegex = new(@"\{\{(?<key>[^\}]+)\}\}", RegexOptions.Compiled); | ||||
| 
 | ||||
|         var wxsFile = Path.Combine(outputDirectory, wixId + ".wxs"); | ||||
|         var objFile = Path.Combine(outputDirectory, wixId + ".wixobj"); | ||||
| 
 | ||||
| 
 | ||||
|         var msiVersion = Options.MsiVersionOverride; | ||||
|         if (string.IsNullOrWhiteSpace(msiVersion)) { | ||||
|             var parsedVersion = SemanticVersion.Parse(Options.PackVersion); | ||||
|             msiVersion = $"{parsedVersion.Major}.{parsedVersion.Minor}.{parsedVersion.Patch}.0"; | ||||
|         } | ||||
| 
 | ||||
|         try { | ||||
|             // apply dictionary to wsx template | ||||
|             var templateText = File.ReadAllText(HelperFile.WixTemplatePath); | ||||
| 
 | ||||
|             var templateResult = stacheRegex.Replace(templateText, match => { | ||||
|                 string key = match.Groups["key"].Value; | ||||
|                 return key switch { | ||||
|                     "Id" => wixId, | ||||
|                     "Title" => GetEffectiveTitle(), | ||||
|                     "Author" => GetEffectiveAuthors(), | ||||
|                     "Version" => msiVersion, | ||||
|                     "Summary" => GetEffectiveTitle(), | ||||
|                     "Codepage" => $"{culture}", | ||||
|                     "Platform" => packageAs64Bit ? "x64" : "x86", | ||||
|                     "ProgramFilesFolder" => packageAs64Bit ? "ProgramFiles64Folder" : "ProgramFilesFolder", | ||||
|                     "Win64YesNo" => packageAs64Bit ? "yes" : "no", | ||||
|                     "SetupName" => setupName, | ||||
|                     _ when key.StartsWith("IdAsGuid", StringComparison.OrdinalIgnoreCase) => GuidUtil.CreateGuidFromHash($"{Options.PackId}:{key.Substring("IdAsGuid".Length)}").ToString(), | ||||
|                     _ => match.Value, | ||||
|                 }; | ||||
|             }); | ||||
| 
 | ||||
|             File.WriteAllText(wxsFile, templateResult, Encoding.UTF8); | ||||
| 
 | ||||
|             // Candle preprocesses and compiles WiX source files into object files (.wixobj). | ||||
|             Log.Info("Compiling WiX Template (candle.exe)"); | ||||
|             var candleCommand = $"{HelperFile.WixCandlePath} -nologo -out \"{objFile}\" \"{wxsFile}\""; | ||||
|             _ = Exe.RunHostedCommand(candleCommand); | ||||
| 
 | ||||
|             progress(45); | ||||
| 
 | ||||
|             // Light links and binds one or more .wixobj files and creates a Windows Installer database (.msi or .msm).  | ||||
|             Log.Info("Linking WiX Template (light.exe)"); | ||||
|             var lightCommand = $"{HelperFile.WixLightPath} -spdb -sval -out \"{msiFilePath}\" \"{objFile}\""; | ||||
|             _ = Exe.RunHostedCommand(lightCommand); | ||||
| 
 | ||||
|             progress(90); | ||||
| 
 | ||||
|         } finally { | ||||
|             IoUtil.DeleteFileOrDirectoryHard(wxsFile, throwOnFailure: false); | ||||
|             IoUtil.DeleteFileOrDirectoryHard(objFile, throwOnFailure: false); | ||||
|         } | ||||
|         progress(100); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     protected override string[] GetMainExeSearchPaths(string packDirectory, string mainExeName) | ||||
|     { | ||||
|         return [ | ||||
|   | ||||
| @@ -39,7 +39,6 @@ public class WindowsPackOptions : WindowsReleasifyOptions, INugetPackCommand, IP | ||||
|     public string MsiLogo { get; set; } | ||||
| 
 | ||||
|     public bool BuildMsi { get; set; } | ||||
|     public bool BuildMsiDeploymentTool { get; set; } | ||||
| 
 | ||||
|     public string MsiVersionOverride { get; set; } | ||||
| } | ||||
|   | ||||
| @@ -67,14 +67,6 @@ public static class HelperFile | ||||
| 
 | ||||
|     public static string StubExecutablePath => FindHelperFile("stub.exe"); | ||||
| 
 | ||||
|     [SupportedOSPlatform("windows")] | ||||
|     public static string WixTemplatePath => FindHelperFile("wix\\template.wxs"); | ||||
|     [SupportedOSPlatform("windows")] | ||||
|     public static string WixCandlePath => FindHelperFile("wix\\candle.exe"); | ||||
| 
 | ||||
|     [SupportedOSPlatform("windows")] | ||||
|     public static string WixLightPath => FindHelperFile("wix\\light.exe"); | ||||
| 
 | ||||
|     [SupportedOSPlatform("windows")] | ||||
|     public static string WixPath => FindHelperFile($"wix\\{WixVersion}\\wix.exe"); | ||||
| 
 | ||||
|   | ||||
| @@ -38,7 +38,6 @@ public class WindowsPackCommand : PackCommand | ||||
| 
 | ||||
| 
 | ||||
|     public bool BuildMsi { get; private set; } | ||||
|     public bool BuildMsiDeploymentTool { get; private set; } | ||||
| 
 | ||||
|     public string MsiVersionOverride { get; private set; } | ||||
| 
 | ||||
| @@ -92,10 +91,6 @@ public class WindowsPackCommand : PackCommand | ||||
| 
 | ||||
|             this.AreMutuallyExclusive(signTemplate, signParams, azTrustedSign); | ||||
| 
 | ||||
|             AddOption<bool>((v) => BuildMsiDeploymentTool = v, "--msiDeploymentTool") | ||||
|                 .SetDescription("Compile a .msi machine-wide deployment tool.") | ||||
|                 .SetHidden(); | ||||
| 
 | ||||
|             AddOption<bool>((v) => BuildMsi = v, "--msi") | ||||
|                 .SetDescription("Compile a .msi machine-wide bootstrap package."); | ||||
|              | ||||
|   | ||||
| @@ -13,12 +13,7 @@ | ||||
|     <PackageReference Include="Octokit" Version="14.0.0" /> | ||||
|     <PackageReference Include="NuGet.Packaging" Version="6.13.2" /> | ||||
|     <PackageReference Include="System.Formats.Asn1" Version="9.0.3" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <Reference Include="Microsoft.Deployment.WindowsInstaller"> | ||||
|       <HintPath>..\..\vendor\wix\Microsoft.Deployment.WindowsInstaller.dll</HintPath> | ||||
|     </Reference> | ||||
|     <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="5.0.2" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
| using System.Globalization; | ||||
| using System.Runtime.Versioning; | ||||
| using System.Xml.Linq; | ||||
| using Microsoft.Deployment.WindowsInstaller; | ||||
| using Microsoft.Win32; | ||||
| using NuGet.Packaging; | ||||
| using Velopack.Compression; | ||||
| @@ -13,6 +12,7 @@ using Velopack.Util; | ||||
| using Velopack.Vpk; | ||||
| using Velopack.Vpk.Logging; | ||||
| using Velopack.Windows; | ||||
| using WixToolset.Dtf.WindowsInstaller; | ||||
| 
 | ||||
| namespace Velopack.Packaging.Tests; | ||||
| 
 | ||||
| @@ -645,7 +645,7 @@ public class WindowsPackTests | ||||
|         var runner = GetPackRunner(logger); | ||||
|         await runner.Run(options); | ||||
| 
 | ||||
|         string msiPath = Path.Combine(tmpReleaseDir, $"{id}-win-DeploymentTool.msi"); | ||||
|         string msiPath = Path.Combine(tmpReleaseDir, $"{id}-win.msi"); | ||||
|         Assert.True(File.Exists(msiPath)); | ||||
| 
 | ||||
|         using Database db = new Database(msiPath); | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/Microsoft.Deployment.Resources.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/Microsoft.Deployment.Resources.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/Microsoft.Deployment.WindowsInstaller.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/Microsoft.Deployment.WindowsInstaller.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/WixNetFxExtension.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/WixNetFxExtension.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/candle.exe
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/candle.exe
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										18
									
								
								vendor/wix/candle.exe.config
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/wix/candle.exe.config
									
									
									
									
										vendored
									
									
								
							| @@ -1,18 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <!-- | ||||
|   <copyright file="app.config" company="Outercurve Foundation"> | ||||
|     Copyright (c) 2004, Outercurve Foundation. | ||||
|     This software is released under Microsoft Reciprocal License (MS-RL). | ||||
|     The license and further copyright text can be found in the file | ||||
|     LICENSE.TXT at the root directory of the distribution. | ||||
|   </copyright> | ||||
| --> | ||||
| <configuration> | ||||
|     <startup useLegacyV2RuntimeActivationPolicy="true"> | ||||
|         <supportedRuntime version="v4.0" /> | ||||
|         <supportedRuntime version="v2.0.50727" /> | ||||
|     </startup> | ||||
|     <runtime> | ||||
|         <loadFromRemoteSources enabled="true"/> | ||||
|     </runtime> | ||||
| </configuration> | ||||
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/darice.cub
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/darice.cub
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/light.exe
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/light.exe
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										18
									
								
								vendor/wix/light.exe.config
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/wix/light.exe.config
									
									
									
									
										vendored
									
									
								
							| @@ -1,18 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <!-- | ||||
|   <copyright file="app.config" company="Outercurve Foundation"> | ||||
|     Copyright (c) 2004, Outercurve Foundation. | ||||
|     This software is released under Microsoft Reciprocal License (MS-RL). | ||||
|     The license and further copyright text can be found in the file | ||||
|     LICENSE.TXT at the root directory of the distribution. | ||||
|   </copyright> | ||||
| --> | ||||
| <configuration> | ||||
|     <startup useLegacyV2RuntimeActivationPolicy="true"> | ||||
|         <supportedRuntime version="v4.0" /> | ||||
|         <supportedRuntime version="v2.0.50727" /> | ||||
|     </startup> | ||||
|     <runtime> | ||||
|         <loadFromRemoteSources enabled="true"/> | ||||
|     </runtime> | ||||
| </configuration> | ||||
							
								
								
									
										33
									
								
								vendor/wix/template.wxs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/wix/template.wxs
									
									
									
									
										vendored
									
									
								
							| @@ -1,33 +0,0 @@ | ||||
| <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> | ||||
|   <Product Id="*" Name="{{Title}} Deployment Tool" Language="1033" Codepage="{{Codepage}}" Version="{{Version}}" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}"> | ||||
|  | ||||
|     <Package Description="This package installs a deployment tool for {{Title}}. Not {{Title}} itself. {{Title}} is only installed if a user logs into the machine." InstallScope="perMachine" Comments="Comments" InstallerVersion="200" Compressed="yes" Platform="{{Platform}}"/> | ||||
|     <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A later version of this product is already installed. Setup will now exit."/> | ||||
|     <Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/> | ||||
|  | ||||
|     <Directory Id="TARGETDIR" Name="SourceDir"> | ||||
|       <Directory Id="{{ProgramFilesFolder}}"> | ||||
|         <Directory Id="APPLICATIONROOTDIRECTORY" Name="{{Title}} Deployment Tool" /> | ||||
|       </Directory> | ||||
|     </Directory> | ||||
|  | ||||
|     <DirectoryRef Id="APPLICATIONROOTDIRECTORY"> | ||||
|       <Component Id="{{Id}}.exe" Guid="{{IdAsGuid2}}" Win64="{{Win64YesNo}}"> | ||||
|         <File Id="{{Id}}.exe" Name="{{Id}}DeploymentTool.exe" Source="./{{SetupName}}.exe" KeyPath="yes"/> | ||||
|       </Component> | ||||
|     </DirectoryRef> | ||||
|  | ||||
|     <DirectoryRef Id="TARGETDIR"> | ||||
|       <Component Id="RegistryEntries" Guid="{{IdAsGuid3}}" Win64="{{Win64YesNo}}"> | ||||
|         <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run"> | ||||
|           <RegistryValue Type="expandable" Name="{{Id}}Deployment" Value=""[#{{Id}}.exe]" --checkInstall" /> | ||||
|         </RegistryKey> | ||||
|       </Component> | ||||
|     </DirectoryRef> | ||||
|  | ||||
|     <Feature Id="MainApplication" Title="Main Application" Level="1"> | ||||
|       <ComponentRef Id="{{Id}}.exe" /> | ||||
|       <ComponentRef Id="RegistryEntries" /> | ||||
|     </Feature> | ||||
|   </Product> | ||||
| </Wix> | ||||
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/wconsole.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/wconsole.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/winterop.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/winterop.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/wix/wix.dll
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/wix/wix.dll
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user