[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
This commit is contained in:
Jeremy Sinclair
2023-01-12 09:25:36 -05:00
committed by GitHub
parent dae0520375
commit 7a0dd5b455
7 changed files with 101 additions and 491 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -24,7 +24,13 @@ SET PTRoot=..\..\..\..
call "..\..\publish.cmd" arm64
)</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<PostBuildEvent>
call move /Y ..\..\Product.wxs.bk ..\..\Product.wxs
call move /Y ..\..\..\PowerToysSetupCustomActions\DepsFilesLists.h.bk ..\..\..\PowerToysSetupCustomActions\DepsFilesLists.h
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<Name>PowerToysInstaller</Name>
</PropertyGroup>

File diff suppressed because one or more lines are too long

View File

@@ -55,481 +55,6 @@ inline const std::vector<std::wstring> powerToysInteropFiles = {
L"vcruntime140_1.dll"
};
#ifdef _M_X64
inline const std::vector<std::wstring> 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<std::wstring> dotnetRuntimeFiles = { };
inline const std::vector<std::wstring> 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<std::wstring> 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<std::wstring> 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<std::wstring> dotnetRuntimeWPFFiles = { };

View File

@@ -43,6 +43,20 @@
<LinkIncremental>false</LinkIncremental>
<IncludePath>..\..\src\common\Telemetry;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>
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"
</Command>
<Message>Backing up original files and populating .NET and WPF Runtime dependencies </Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(RunBuildEvents)'=='false'">
<PreBuildEventUseInBuild>false</PreBuildEventUseInBuild>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>inc;..\..\src\;..\..\src\common\Telemetry;telemetry;$(WixSdkPath)VS2017\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@@ -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