From 7a0dd5b4553433242068add8b394f6ab7c6bdc4e Mon Sep 17 00:00:00 2001 From: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Date: Thu, 12 Jan 2023 09:25:36 -0500 Subject: [PATCH] [Build][Installer]Automatically add list of .NET Runtime deps to Installer during build (#23102) * Added PowerShell script for parsing .NET Runtimes from deps.json * Removed static list set of .NET Runtime and WPF file list * Updated DepsFilesLists to write output. Moved to CustomActions directory * Added space between runtime files variables * Fix Parameter and Set-Content invocation * Added PreBuild event to call parseRuntimes script * Update spelling * Removed runtime files from Product.wxs * Updated script to add support for Product.wxs * Modify process to create copies of unmodified files and restore them on post build. * Fix spacing * Fix spelling * Updated script to create new Guid for Dotnet component * Fix invalid regex * Remove reverting Product.wxs in Custom Actions project * Add Post Build Action in Installer to revert Product.wxs * Set Post Build Event to run always on Installer * Fix path to Product.wxs in Post Build Event * Final fix to Product.wxs path * Switch to use powershell.exe and read from ColorPicker directory. * wip: fix release pipeline * remove conditions for build events in PowerToysInstaller.wixproj --- .github/actions/spell-check/expect.txt | 4 + .pipelines/release.yml | 4 +- .../PowerToysSetup/PowerToysInstaller.wixproj | 8 +- installer/PowerToysSetup/Product.wxs | 14 +- .../DepsFilesLists.h | 479 +----------------- .../PowerToysSetupCustomActions.vcxproj | 14 + .../parseRuntimes.ps1 | 69 +++ 7 files changed, 101 insertions(+), 491 deletions(-) create mode 100644 installer/PowerToysSetupCustomActions/parseRuntimes.ps1 diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index f8c62326bb..9a5ad6f8cd 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -389,6 +389,8 @@ DENORMAL Deondre depersist deprioritized +depsfileslistspath +depsjsonpath deref DESKTOPABSOLUTEEDITING DESKTOPABSOLUTEPARSING @@ -1384,6 +1386,7 @@ proactively PROCESSKEY PRODEXT PRODUCTVERSION +productwxspath Progman programdata PROGRAMFILES @@ -1544,6 +1547,7 @@ runsettings runtimeclass runtimeconfig runtimeobject +runtimepack runtimes rus Rutkas diff --git a/.pipelines/release.yml b/.pipelines/release.yml index 773de6921e..01665c74c1 100644 --- a/.pipelines/release.yml +++ b/.pipelines/release.yml @@ -317,7 +317,7 @@ jobs: inputs: solution: '**/installer/PowerToysSetup.sln' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysSetupCustomActions + msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysSetupCustomActions /p:RunBuildEvents=true platform: $(BuildPlatform) configuration: $(BuildConfiguration) maximumCpuCount: true @@ -362,7 +362,7 @@ jobs: inputs: solution: '**/installer/PowerToysSetup.sln' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true /target:PowerToysInstaller /bl:$(Build.SourcesDirectory)\msbuild.binlog + msbuildArgs: /p:CIBuild=true /target:PowerToysInstaller /bl:$(Build.SourcesDirectory)\msbuild.binlog /p:RunBuildEvents=false platform: $(BuildPlatform) configuration: $(BuildConfiguration) clean: false # don't undo our hard work above by deleting the CustomActions dll diff --git a/installer/PowerToysSetup/PowerToysInstaller.wixproj b/installer/PowerToysSetup/PowerToysInstaller.wixproj index f091ec1ce3..d61e1f0c05 100644 --- a/installer/PowerToysSetup/PowerToysInstaller.wixproj +++ b/installer/PowerToysSetup/PowerToysInstaller.wixproj @@ -24,7 +24,13 @@ SET PTRoot=..\..\..\.. call "..\..\publish.cmd" arm64 ) - + + Always + + call move /Y ..\..\Product.wxs.bk ..\..\Product.wxs + call move /Y ..\..\..\PowerToysSetupCustomActions\DepsFilesLists.h.bk ..\..\..\PowerToysSetupCustomActions\DepsFilesLists.h + + PowerToysInstaller diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index 8fe1f74ade..0c0c0dba8b 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -144,18 +144,10 @@ + + - - - - - - - - - - - + powerToysInteropFiles = { L"vcruntime140_1.dll" }; -#ifdef _M_X64 -inline const std::vector dotnetRuntimeFiles = { - L"clrcompression.dll", - L"clretwrc.dll", - L"clrgc.dll", - L"clrjit.dll", - L"coreclr.dll", - L"hostfxr.dll", - L"hostpolicy.dll", - L"Microsoft.CSharp.dll", - L"Microsoft.DiaSymReader.Native.amd64.dll", - L"Microsoft.VisualBasic.Core.dll", - L"Microsoft.VisualBasic.dll", - L"Microsoft.Win32.Primitives.dll", - L"Microsoft.Win32.Registry.dll", - L"mscordaccore.dll", - L"mscordbi.dll", - L"mscorlib.dll", - L"mscorrc.dll", - L"msquic.dll", - L"netstandard.dll", - L"System.AppContext.dll", - L"System.Buffers.dll", - L"System.CodeDom.dll", - L"System.Collections.Concurrent.dll", - L"System.Collections.dll", - L"System.Collections.Immutable.dll", - L"System.Collections.NonGeneric.dll", - L"System.Collections.Specialized.dll", - L"System.ComponentModel.Annotations.dll", - L"System.ComponentModel.DataAnnotations.dll", - L"System.ComponentModel.dll", - L"System.ComponentModel.EventBasedAsync.dll", - L"System.ComponentModel.Primitives.dll", - L"System.ComponentModel.TypeConverter.dll", - L"System.Configuration.dll", - L"System.Console.dll", - L"System.Core.dll", - L"System.Data.Common.dll", - L"System.Data.DataSetExtensions.dll", - L"System.Data.dll", - L"System.Diagnostics.Contracts.dll", - L"System.Diagnostics.Debug.dll", - L"System.Diagnostics.DiagnosticSource.dll", - L"System.Diagnostics.FileVersionInfo.dll", - L"System.Diagnostics.Process.dll", - L"System.Diagnostics.StackTrace.dll", - L"System.Diagnostics.TextWriterTraceListener.dll", - L"System.Diagnostics.Tools.dll", - L"System.Diagnostics.TraceSource.dll", - L"System.Diagnostics.Tracing.dll", - L"System.dll", - L"System.Drawing.dll", - L"System.Drawing.Primitives.dll", - L"System.Dynamic.Runtime.dll", - L"System.Formats.Asn1.dll", - L"System.Formats.Tar.dll", - L"System.Globalization.Calendars.dll", - L"System.Globalization.dll", - L"System.Globalization.Extensions.dll", - L"System.IO.Compression.Brotli.dll", - L"System.IO.Compression.dll", - L"System.IO.Compression.FileSystem.dll", - L"System.IO.Compression.Native.dll", - L"System.IO.Compression.ZipFile.dll", - L"System.IO.dll", - L"System.IO.FileSystem.AccessControl.dll", - L"System.IO.FileSystem.dll", - L"System.IO.FileSystem.DriveInfo.dll", - L"System.IO.FileSystem.Primitives.dll", - L"System.IO.FileSystem.Watcher.dll", - L"System.IO.IsolatedStorage.dll", - L"System.IO.MemoryMappedFiles.dll", - L"System.IO.Pipes.AccessControl.dll", - L"System.IO.Pipes.dll", - L"System.IO.UnmanagedMemoryStream.dll", - L"System.Linq.dll", - L"System.Linq.Expressions.dll", - L"System.Linq.Parallel.dll", - L"System.Linq.Queryable.dll", - L"System.Memory.dll", - L"System.Net.dll", - L"System.Net.Http.dll", - L"System.Net.Http.Json.dll", - L"System.Net.HttpListener.dll", - L"System.Net.Mail.dll", - L"System.Net.NameResolution.dll", - L"System.Net.NetworkInformation.dll", - L"System.Net.Ping.dll", - L"System.Net.Primitives.dll", - L"System.Net.Quic.dll", - L"System.Net.Requests.dll", - L"System.Net.Security.dll", - L"System.Net.ServicePoint.dll", - L"System.Net.Sockets.dll", - L"System.Net.WebClient.dll", - L"System.Net.WebHeaderCollection.dll", - L"System.Net.WebProxy.dll", - L"System.Net.WebSockets.Client.dll", - L"System.Net.WebSockets.dll", - L"System.Numerics.dll", - L"System.Numerics.Vectors.dll", - L"System.ObjectModel.dll", - L"System.Private.CoreLib.dll", - L"System.Private.DataContractSerialization.dll", - L"System.Private.Uri.dll", - L"System.Private.Xml.dll", - L"System.Private.Xml.Linq.dll", - L"System.Reflection.DispatchProxy.dll", - L"System.Reflection.dll", - L"System.Reflection.Emit.dll", - L"System.Reflection.Emit.ILGeneration.dll", - L"System.Reflection.Emit.Lightweight.dll", - L"System.Reflection.Extensions.dll", - L"System.Reflection.Metadata.dll", - L"System.Reflection.Primitives.dll", - L"System.Reflection.TypeExtensions.dll", - L"System.Resources.Reader.dll", - L"System.Resources.ResourceManager.dll", - L"System.Resources.Writer.dll", - L"System.Runtime.CompilerServices.Unsafe.dll", - L"System.Runtime.CompilerServices.VisualC.dll", - L"System.Runtime.dll", - L"System.Runtime.Extensions.dll", - L"System.Runtime.Handles.dll", - L"System.Runtime.InteropServices.dll", - L"System.Runtime.InteropServices.JavaScript.dll", - L"System.Runtime.InteropServices.RuntimeInformation.dll", - L"System.Runtime.Intrinsics.dll", - L"System.Runtime.Loader.dll", - L"System.Runtime.Numerics.dll", - L"System.Runtime.Serialization.dll", - L"System.Runtime.Serialization.Formatters.dll", - L"System.Runtime.Serialization.Json.dll", - L"System.Runtime.Serialization.Primitives.dll", - L"System.Runtime.Serialization.Xml.dll", - L"System.Security.AccessControl.dll", - L"System.Security.Claims.dll", - L"System.Security.Cryptography.dll", - L"System.Security.Cryptography.Algorithms.dll", - L"System.Security.Cryptography.Cng.dll", - L"System.Security.Cryptography.Csp.dll", - L"System.Security.Cryptography.Encoding.dll", - L"System.Security.Cryptography.OpenSsl.dll", - L"System.Security.Cryptography.Primitives.dll", - L"System.Security.Cryptography.X509Certificates.dll", - L"System.Security.dll", - L"System.Security.Principal.dll", - L"System.Security.Principal.Windows.dll", - L"System.Security.SecureString.dll", - L"System.ServiceModel.Web.dll", - L"System.ServiceProcess.dll", - L"System.Text.Encoding.CodePages.dll", - L"System.Text.Encoding.dll", - L"System.Text.Encoding.Extensions.dll", - L"System.Text.Encodings.Web.dll", - L"System.Text.RegularExpressions.dll", - L"System.Threading.Channels.dll", - L"System.Threading.dll", - L"System.Threading.Overlapped.dll", - L"System.Threading.Tasks.Dataflow.dll", - L"System.Threading.Tasks.dll", - L"System.Threading.Tasks.Extensions.dll", - L"System.Threading.Tasks.Parallel.dll", - L"System.Threading.Thread.dll", - L"System.Threading.ThreadPool.dll", - L"System.Threading.Timer.dll", - L"System.Transactions.dll", - L"System.Transactions.Local.dll", - L"System.ValueTuple.dll", - L"System.Web.dll", - L"System.Web.HttpUtility.dll", - L"System.Windows.dll", - L"System.Xml.dll", - L"System.Xml.Linq.dll", - L"System.Xml.ReaderWriter.dll", - L"System.Xml.Serialization.dll", - L"System.Xml.XDocument.dll", - L"System.Xml.XmlDocument.dll", - L"System.Xml.XmlSerializer.dll", - L"System.Xml.XPath.dll", - L"System.Xml.XPath.XDocument.dll" }; +inline const std::vector dotnetRuntimeFiles = { }; -inline const std::vector dotnetRuntimeWPFFiles = { - L"Accessibility.dll", - L"D3DCompiler_47_cor3.dll", - L"DirectWriteForwarder.dll", - L"Microsoft.VisualBasic.Forms.dll", - L"Microsoft.Win32.Registry.AccessControl.dll", - L"Microsoft.Win32.SystemEvents.dll", - L"PenImc_cor3.dll", - L"PresentationCore.dll", - L"PresentationFramework-SystemCore.dll", - L"PresentationFramework-SystemData.dll", - L"PresentationFramework-SystemDrawing.dll", - L"PresentationFramework-SystemXml.dll", - L"PresentationFramework-SystemXmlLinq.dll", - L"PresentationFramework.Aero.dll", - L"PresentationFramework.Aero2.dll", - L"PresentationFramework.AeroLite.dll", - L"PresentationFramework.Classic.dll", - L"PresentationFramework.dll", - L"PresentationFramework.Luna.dll", - L"PresentationFramework.Royale.dll", - L"PresentationNative_cor3.dll", - L"PresentationUI.dll", - L"ReachFramework.dll", - L"System.Configuration.ConfigurationManager.dll", - L"System.Design.dll", - L"System.Diagnostics.EventLog.dll", - L"System.Diagnostics.EventLog.Messages.dll", - L"System.Diagnostics.PerformanceCounter.dll", - L"System.DirectoryServices.dll", - L"System.Drawing.Common.dll", - L"System.Drawing.Design.dll", - L"System.IO.Packaging.dll", - L"System.Printing.dll", - L"System.Resources.Extensions.dll", - L"System.Security.Cryptography.Pkcs.dll", - L"System.Security.Cryptography.ProtectedData.dll", - L"System.Security.Cryptography.Xml.dll", - L"System.Security.Permissions.dll", - L"System.Threading.AccessControl.dll", - L"System.Windows.Controls.Ribbon.dll", - L"System.Windows.Extensions.dll", - L"System.Windows.Forms.Design.dll", - L"System.Windows.Forms.Design.Editors.dll", - L"System.Windows.Forms.dll", - L"System.Windows.Forms.Primitives.dll", - L"System.Windows.Input.Manipulations.dll", - L"System.Windows.Presentation.dll", - L"System.Xaml.dll", - L"UIAutomationClient.dll", - L"UIAutomationClientSideProviders.dll", - L"UIAutomationProvider.dll", - L"UIAutomationTypes.dll", - L"vcruntime140_cor3.dll", - L"WindowsFormsIntegration.dll", - L"wpfgfx_cor3.dll" }; -#else //ARM64 -inline const std::vector dotnetRuntimeFiles = { - L"clretwrc.dll", - L"clrgc.dll", - L"clrjit.dll", - L"coreclr.dll", - L"dbgshim.dll", - L"hostfxr.dll", - L"hostpolicy.dll", - L"Microsoft.CSharp.dll", - L"Microsoft.DiaSymReader.Native.arm64.dll", - L"Microsoft.Graphics.Canvas.dll", - L"Microsoft.VisualBasic.Core.dll", - L"Microsoft.VisualBasic.dll", - L"Microsoft.Win32.Primitives.dll", - L"Microsoft.Win32.Registry.dll", - L"mscordaccore.dll", - L"mscordbi.dll", - L"mscorlib.dll", - L"mscorrc.dll", - L"netstandard.dll", - L"System.AppContext.dll", - L"System.Buffers.dll", - L"System.Collections.Concurrent.dll", - L"System.Collections.dll", - L"System.Collections.Immutable.dll", - L"System.Collections.NonGeneric.dll", - L"System.Collections.Specialized.dll", - L"System.ComponentModel.Annotations.dll", - L"System.ComponentModel.DataAnnotations.dll", - L"System.ComponentModel.dll", - L"System.ComponentModel.EventBasedAsync.dll", - L"System.ComponentModel.Primitives.dll", - L"System.ComponentModel.TypeConverter.dll", - L"System.Configuration.dll", - L"System.Console.dll", - L"System.Core.dll", - L"System.Data.Common.dll", - L"System.Data.DataSetExtensions.dll", - L"System.Data.dll", - L"System.Diagnostics.Contracts.dll", - L"System.Diagnostics.Debug.dll", - L"System.Diagnostics.DiagnosticSource.dll", - L"System.Diagnostics.FileVersionInfo.dll", - L"System.Diagnostics.Process.dll", - L"System.Diagnostics.StackTrace.dll", - L"System.Diagnostics.TextWriterTraceListener.dll", - L"System.Diagnostics.Tools.dll", - L"System.Diagnostics.TraceSource.dll", - L"System.Diagnostics.Tracing.dll", - L"System.dll", - L"System.Drawing.dll", - L"System.Drawing.Primitives.dll", - L"System.Dynamic.Runtime.dll", - L"System.Formats.Asn1.dll", - L"System.Formats.Tar.dll", - L"System.Globalization.Calendars.dll", - L"System.Globalization.dll", - L"System.Globalization.Extensions.dll", - L"System.IO.Compression.Brotli.dll", - L"System.IO.Compression.dll", - L"System.IO.Compression.FileSystem.dll", - L"System.IO.Compression.Native.dll", - L"System.IO.Compression.ZipFile.dll", - L"System.IO.dll", - L"System.IO.FileSystem.AccessControl.dll", - L"System.IO.FileSystem.dll", - L"System.IO.FileSystem.DriveInfo.dll", - L"System.IO.FileSystem.Primitives.dll", - L"System.IO.FileSystem.Watcher.dll", - L"System.IO.IsolatedStorage.dll", - L"System.IO.MemoryMappedFiles.dll", - L"System.IO.Pipes.AccessControl.dll", - L"System.IO.Pipes.dll", - L"System.IO.UnmanagedMemoryStream.dll", - L"System.Linq.dll", - L"System.Linq.Expressions.dll", - L"System.Linq.Parallel.dll", - L"System.Linq.Queryable.dll", - L"System.Memory.dll", - L"System.Net.dll", - L"System.Net.Http.dll", - L"System.Net.Http.Json.dll", - L"System.Net.HttpListener.dll", - L"System.Net.Mail.dll", - L"System.Net.NameResolution.dll", - L"System.Net.NetworkInformation.dll", - L"System.Net.Ping.dll", - L"System.Net.Primitives.dll", - L"System.Net.Quic.dll", - L"System.Net.Requests.dll", - L"System.Net.Security.dll", - L"System.Net.ServicePoint.dll", - L"System.Net.Sockets.dll", - L"System.Net.WebClient.dll", - L"System.Net.WebHeaderCollection.dll", - L"System.Net.WebProxy.dll", - L"System.Net.WebSockets.Client.dll", - L"System.Net.WebSockets.dll", - L"System.Numerics.dll", - L"System.Numerics.Vectors.dll", - L"System.ObjectModel.dll", - L"System.Private.CoreLib.dll", - L"System.Private.DataContractSerialization.dll", - L"System.Private.Uri.dll", - L"System.Private.Xml.dll", - L"System.Private.Xml.Linq.dll", - L"System.Reflection.DispatchProxy.dll", - L"System.Reflection.dll", - L"System.Reflection.Emit.dll", - L"System.Reflection.Emit.ILGeneration.dll", - L"System.Reflection.Emit.Lightweight.dll", - L"System.Reflection.Extensions.dll", - L"System.Reflection.Metadata.dll", - L"System.Reflection.Primitives.dll", - L"System.Reflection.TypeExtensions.dll", - L"System.Resources.Reader.dll", - L"System.Resources.ResourceManager.dll", - L"System.Resources.Writer.dll", - L"System.Runtime.CompilerServices.Unsafe.dll", - L"System.Runtime.CompilerServices.VisualC.dll", - L"System.Runtime.dll", - L"System.Runtime.Extensions.dll", - L"System.Runtime.Handles.dll", - L"System.Runtime.InteropServices.dll", - L"System.Runtime.InteropServices.JavaScript.dll", - L"System.Runtime.InteropServices.RuntimeInformation.dll", - L"System.Runtime.Intrinsics.dll", - L"System.Runtime.Loader.dll", - L"System.Runtime.Numerics.dll", - L"System.Runtime.Serialization.dll", - L"System.Runtime.Serialization.Formatters.dll", - L"System.Runtime.Serialization.Json.dll", - L"System.Runtime.Serialization.Primitives.dll", - L"System.Runtime.Serialization.Xml.dll", - L"System.Security.AccessControl.dll", - L"System.Security.Claims.dll", - L"System.Security.Cryptography.dll", - L"System.Security.Cryptography.Algorithms.dll", - L"System.Security.Cryptography.Cng.dll", - L"System.Security.Cryptography.Csp.dll", - L"System.Security.Cryptography.Encoding.dll", - L"System.Security.Cryptography.OpenSsl.dll", - L"System.Security.Cryptography.Primitives.dll", - L"System.Security.Cryptography.X509Certificates.dll", - L"System.Security.dll", - L"System.Security.Principal.dll", - L"System.Security.Principal.Windows.dll", - L"System.Security.SecureString.dll", - L"System.ServiceModel.Web.dll", - L"System.ServiceProcess.dll", - L"System.Text.Encoding.CodePages.dll", - L"System.Text.Encoding.dll", - L"System.Text.Encoding.Extensions.dll", - L"System.Text.Encodings.Web.dll", - L"System.Text.Json.dll", - L"System.Text.RegularExpressions.dll", - L"System.Threading.Channels.dll", - L"System.Threading.dll", - L"System.Threading.Overlapped.dll", - L"System.Threading.Tasks.Dataflow.dll", - L"System.Threading.Tasks.dll", - L"System.Threading.Tasks.Extensions.dll", - L"System.Threading.Tasks.Parallel.dll", - L"System.Threading.Thread.dll", - L"System.Threading.ThreadPool.dll", - L"System.Threading.Timer.dll", - L"System.Transactions.dll", - L"System.Transactions.Local.dll", - L"System.ValueTuple.dll", - L"System.Web.dll", - L"System.Web.HttpUtility.dll", - L"System.Windows.dll", - L"System.Xml.dll", - L"System.Xml.Linq.dll", - L"System.Xml.ReaderWriter.dll", - L"System.Xml.Serialization.dll", - L"System.Xml.XDocument.dll", - L"System.Xml.XmlDocument.dll", - L"System.Xml.XmlSerializer.dll", - L"System.Xml.XPath.dll", - L"System.Xml.XPath.XDocument.dll" }; - -inline const std::vector dotnetRuntimeWPFFiles = { - L"Accessibility.dll", - L"DirectWriteForwarder.dll", - L"Microsoft.VisualBasic.Forms.dll", - L"Microsoft.Win32.Registry.AccessControl.dll", - L"Microsoft.Win32.SystemEvents.dll", - L"PenImc_cor3.dll", - L"PresentationCore.dll", - L"PresentationFramework-SystemCore.dll", - L"PresentationFramework-SystemData.dll", - L"PresentationFramework-SystemDrawing.dll", - L"PresentationFramework-SystemXml.dll", - L"PresentationFramework-SystemXmlLinq.dll", - L"PresentationFramework.Aero.dll", - L"PresentationFramework.Aero2.dll", - L"PresentationFramework.AeroLite.dll", - L"PresentationFramework.Classic.dll", - L"PresentationFramework.dll", - L"PresentationFramework.Luna.dll", - L"PresentationFramework.Royale.dll", - L"PresentationNative_cor3.dll", - L"PresentationUI.dll", - L"ReachFramework.dll", - L"System.CodeDom.dll", - L"System.Configuration.ConfigurationManager.dll", - L"System.Design.dll", - L"System.Diagnostics.EventLog.dll", - L"System.Diagnostics.EventLog.Messages.dll", - L"System.Diagnostics.PerformanceCounter.dll", - L"System.DirectoryServices.dll", - L"System.Drawing.Common.dll", - L"System.Drawing.Design.dll", - L"System.IO.Packaging.dll", - L"System.Security.Cryptography.Pkcs.dll", - L"System.Security.Cryptography.ProtectedData.dll", - L"System.Security.Cryptography.Xml.dll", - L"System.Security.Permissions.dll", - L"System.Threading.AccessControl.dll", - L"System.Windows.Controls.Ribbon.dll", - L"System.Windows.Extensions.dll", - L"System.Windows.Forms.Design.dll", - L"System.Windows.Forms.Design.Editors.dll", - L"System.Windows.Forms.dll", - L"System.Windows.Forms.Primitives.dll", - L"System.Windows.Input.Manipulations.dll", - L"System.Windows.Presentation.dll", - L"System.Xaml.dll", - L"UIAutomationClient.dll", - L"UIAutomationClientSideProviders.dll", - L"UIAutomationProvider.dll", - L"UIAutomationTypes.dll", - L"vcruntime140_cor3.dll", - L"WindowsFormsIntegration.dll", - L"wpfgfx_cor3.dll" -}; -#endif +inline const std::vector dotnetRuntimeWPFFiles = { }; diff --git a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj index 985d920f58..07b2a3a065 100644 --- a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj +++ b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj @@ -43,6 +43,20 @@ false ..\..\src\common\Telemetry;$(IncludePath) + + + + call cmd /C "copy ""$(ProjectDir)DepsFilesLists.h"" ""$(ProjectDir)DepsFilesLists.h.bk""" + call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\Product.wxs"" ""$(ProjectDir)..\PowerToysSetup\Product.wxs.bk"""" + call powershell.exe -File parseRuntimes.ps1 -depsjsonpath "$(ProjectDir)..\..\$(Platform)\$(Configuration)\modules\ColorPicker\PowerToys.ColorPickerUI.deps.json" -depsfileslistspath "$(ProjectDir)DepsFilesLists.h" -productwxspath "$(ProjectDir)..\PowerToysSetup\Product.wxs" + + Backing up original files and populating .NET and WPF Runtime dependencies + + + + false + false + inc;..\..\src\;..\..\src\common\Telemetry;telemetry;$(WixSdkPath)VS2017\inc;%(AdditionalIncludeDirectories) diff --git a/installer/PowerToysSetupCustomActions/parseRuntimes.ps1 b/installer/PowerToysSetupCustomActions/parseRuntimes.ps1 new file mode 100644 index 0000000000..f031c4429d --- /dev/null +++ b/installer/PowerToysSetupCustomActions/parseRuntimes.ps1 @@ -0,0 +1,69 @@ +[CmdletBinding()] +Param( + [Parameter(Mandatory = $True, Position = 1)] + [string]$depsjsonpath, + [Parameter(Mandatory = $True, Position = 2)] + [string]$depsfileslistspath, + [Parameter(Mandatory = $True, Position = 3)] + [string]$productwxspath +) + +function Update-RuntimeFileList($runtimeToken, $runtimeKey) { + $depsFilesLists -replace "($runtimeToken = )(.*);", "`$1 {`r`n$(($runtimes[$runtimeKey] | ForEach-Object {' L"'+$_+'"'} | Sort-Object) -join ",`r`n") };" +} + +function Update-ProductWxsRuntimeFileList($runtimeToken, $runtimeKey) { + $productWxs -replace "(define $runtimeToken=)(.*)?>", "`$1$($runtimes[$runtimeKey] -join ';')?>" +} + +function Update-DotnetFilesComponentGuid() +{ + $productWxs -replace "Dlls_DotnetFiles_Component"" Guid=""([{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?)""", "Dlls_DotnetFiles_Component"" Guid=""$((New-Guid).ToString().ToUpper())""" +} + +# Read the DepsFilesLists.h file +$depsFilesLists = Get-Content $depsfileslistspath; + +# Read Product.wxs file +$productWxs = Get-Content $productwxspath; + +# Read the deps.json file and convert it to a JSON object +$runtimeFile = Get-Content $depsjsonpath | ConvertFrom-Json; + +$runtimes = @{} + +Write-Host "Parsing .NET Runtimes from $depsjsonpath `r`n" + +$runtimeList = ([array]$runtimeFile.targets.PSObject.Properties)[-1].Value.PSObject.Properties | Where-Object { $_.Name -match "runtimepack" }; + +if ($runtimeList.Length -eq 0) { + Write-Host -ForegroundColor Red "No runtimes have been detected" + exit 1 +} + +# Enumerate through array of custom objects and parse the names of the property values into a HashTable +$runtimeList | ForEach-Object { + $runtimes += @{"$($_.Name -replace "runtimepack\.(\S+)\.\S+/\S+",'$1')" = $_.Value.PSObject.Properties.Value | ForEach-Object { + $_.PSObject.Properties.Name + } + } +} + +Write-Host "Writing Microsoft.NETCore.App.Runtime files" +$depsFilesLists = Update-RuntimeFileList "dotnetRuntimeFiles" "Microsoft.NETCore.App.Runtime" +$productWxs = Update-ProductWxsRuntimeFileList "DotnetRuntimeFiles" "Microsoft.NETCore.App.Runtime" + +Write-Host "Writing Microsoft.WindowsDesktop.App.Runtime files" +$depsFilesLists = Update-RuntimeFileList "dotnetRuntimeWPFFiles" "Microsoft.WindowsDesktop.App.Runtime" +$productWxs = Update-ProductWxsRuntimeFileList "DotnetRuntimeWPFFiles" "Microsoft.WindowsDesktop.App.Runtime" + +Write-Host "Update DotnetFiles Component GUID" +$productWxs = Update-DotnetFilesComponentGuid + +Write-Host "Updating $depsfileslistspath" +Set-Content -Path $depsfileslistspath -Value $depsFilesLists + +Write-Host "Updating $productwxspath" +Set-Content -Path $productwxspath -Value $productWxs + +