Remove unnecessary native dependencies from the package (#18213)
This commit is contained in:
parent
67a3830fec
commit
b90a1e65a3
@ -172,16 +172,11 @@
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define all OS, release configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'StaticAnalysis' ">
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define windows, release configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' == 'true' ">
|
||||
<Optimize>true</Optimize>
|
||||
<!-- This is required to be full for compliance tools !-->
|
||||
<DebugType>full</DebugType>
|
||||
@ -193,15 +188,6 @@
|
||||
Debugging the issues resolves the problem
|
||||
-->
|
||||
<Optimize>false</Optimize>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define all OS, CodeCoverage configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
|
||||
<!-- This is required to be portable to Coverlet tool !-->
|
||||
<PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
|
||||
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -2936,9 +2936,6 @@
|
||||
<Component Id="cmpF2634E50875D4698921081E3C6B1D5DC">
|
||||
<File Id="fil5A54754B01054DB590032470CE5F1EBD" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationCore.dll" />
|
||||
</Component>
|
||||
<Component Id="cmpBFAC308E2D8645278D61C126C0FC2C61">
|
||||
<File Id="fil2954DD50127543F991A9F0A539E80FA4" KeyPath="yes" Source="$(var.ProductSourcePath)\PenImc_cor3.dll" />
|
||||
</Component>
|
||||
<Component Id="cmp8F0E2CF1B76B4D5185CB6A8DB9236F93">
|
||||
<File Id="fil91831C8BEFBB49AE8A4FDE50300CA3E8" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationFramework-SystemXml.dll" />
|
||||
</Component>
|
||||
@ -3023,9 +3020,6 @@
|
||||
<Component Id="cmp930F2D2320B94F6397ECD91862AF7A90">
|
||||
<File Id="fil0B2E8182CDEC485F8364AB82F5EA2D35" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationFramework.Luna.dll" />
|
||||
</Component>
|
||||
<Component Id="cmp5C8827EF42BE4C098EF08EBD4011DA47">
|
||||
<File Id="fil15D3E880E8AD4F9A970422D79FADDBAF" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationNative_cor3.dll" />
|
||||
</Component>
|
||||
<Component Id="cmp6C0567CC32E4457A8F2D03C6E7F5897E">
|
||||
<File Id="filB46C0C9BDA404C51ACB0F93E5ADACDE5" KeyPath="yes" Source="$(var.ProductSourcePath)\WindowsFormsIntegration.dll" />
|
||||
</Component>
|
||||
@ -3089,9 +3083,6 @@
|
||||
<Component Id="cmp0BD7D15E0377407FA4C43BFE89F0C12E">
|
||||
<File Id="fil6EF5C2AED8674A32B0F3CCEE9CBEED71" KeyPath="yes" Source="$(var.ProductSourcePath)\System.Formats.Asn1.dll" />
|
||||
</Component>
|
||||
<Component Id="cmpC0FFB3F4FB30438082D2DC0F4E4BF12D">
|
||||
<File Id="fil8FEEEB3B27DF40148EB85CE6AE1A420B" KeyPath="yes" Source="$(var.ProductSourcePath)\Microsoft.DiaSymReader.Native.$(var.FileArchitecture).dll" />
|
||||
</Component>
|
||||
<Component Id="cmpB92B70CEFC2F438386F97264FB436CDD">
|
||||
<File Id="fil824D1A506096432888ABC2FDFAFABEE5" KeyPath="yes" Source="$(var.ProductSourcePath)\System.Diagnostics.EventLog.Messages.dll" />
|
||||
</Component>
|
||||
@ -3153,6 +3144,9 @@
|
||||
<Component Id="cmp76EB2749D0464D41AD1D2BA2C51CF4C9">
|
||||
<File Id="filDC81A93ACA6045E4A22C108F59D69083" KeyPath="yes" Source="$(var.ProductSourcePath)\mscordaccore_$(var.FileArchitecture)_$(var.FileArchitecture)_7.0.22.42610.dll" />
|
||||
</Component>
|
||||
<Component Id="cmp6986F8B66C514347A25E03DD3096B5AE">
|
||||
<File Id="fil9276D1BDBF8B4C91B90761633720A419" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationNative_cor3.dll" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
</Fragment>
|
||||
<Fragment>
|
||||
@ -4052,7 +4046,6 @@
|
||||
<ComponentRef Id="cmp30126C60BD784974B74EA45AE9B04032" />
|
||||
<ComponentRef Id="cmp9EC1507780D247E095EA92A7715B4BAC" />
|
||||
<ComponentRef Id="cmpF2634E50875D4698921081E3C6B1D5DC" />
|
||||
<ComponentRef Id="cmpBFAC308E2D8645278D61C126C0FC2C61" />
|
||||
<ComponentRef Id="cmp8F0E2CF1B76B4D5185CB6A8DB9236F93" />
|
||||
<ComponentRef Id="cmp14EA1CB2EC4E4B1DB7F7968B5B3D8E16" />
|
||||
<ComponentRef Id="cmpF543DDEF59CB4ACB85CBC9A106BD853D" />
|
||||
@ -4081,7 +4074,6 @@
|
||||
<ComponentRef Id="cmpDEE7C0BADEA14B9A9AFFD4C9BF4E7702" />
|
||||
<ComponentRef Id="cmp10ABC7FB464B42FCA1EDEC7015AFEDCF" />
|
||||
<ComponentRef Id="cmp930F2D2320B94F6397ECD91862AF7A90" />
|
||||
<ComponentRef Id="cmp5C8827EF42BE4C098EF08EBD4011DA47" />
|
||||
<ComponentRef Id="cmp6C0567CC32E4457A8F2D03C6E7F5897E" />
|
||||
<ComponentRef Id="cmp18A181D71C894FBE96F4A3563213DC57" />
|
||||
<ComponentRef Id="cmp1C666476BE6044B4B8C74450F1F32E67" />
|
||||
@ -4103,7 +4095,6 @@
|
||||
<ComponentRef Id="cmpE9599A00802144DF98F5792E029C8875" />
|
||||
<ComponentRef Id="cmp0989343D60B74AF082291F612F0E6FA6" />
|
||||
<ComponentRef Id="cmp0BD7D15E0377407FA4C43BFE89F0C12E" />
|
||||
<ComponentRef Id="cmpC0FFB3F4FB30438082D2DC0F4E4BF12D" />
|
||||
<ComponentRef Id="cmpB92B70CEFC2F438386F97264FB436CDD" />
|
||||
<ComponentRef Id="cmp8635213A03B04AAE8E1BFB7EA85E0DB2" />
|
||||
<ComponentRef Id="cmp834F3E0C83664E92B0D115A39A8FAACB" />
|
||||
@ -4166,6 +4157,7 @@
|
||||
<ComponentRef Id="cmp76EB2749D0464D41AD1D2BA2C51CF4C9" />
|
||||
<ComponentRef Id="cmpF5FD2E392BD94BCD957480F128A38E10" />
|
||||
<ComponentRef Id="cmp28DEAACC47FD4B04A95521A375761643" />
|
||||
<ComponentRef Id="cmp6986F8B66C514347A25E03DD3096B5AE" />
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
|
67
build.psm1
67
build.psm1
@ -674,6 +674,8 @@ Fix steps:
|
||||
Restore-PSPester -Destination (Join-Path $publishPath "Modules")
|
||||
}
|
||||
|
||||
Clear-NativeDependencies -PublishFolder $publishPath
|
||||
|
||||
if ($PSOptionsPath) {
|
||||
$resolvedPSOptionsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($PSOptionsPath)
|
||||
$parent = Split-Path -Path $resolvedPSOptionsPath
|
||||
@ -3357,3 +3359,68 @@ function Find-AzCopy {
|
||||
$azCopy = Get-Command -Name azCopy -ErrorAction Stop | Select-Object -First 1
|
||||
return $azCopy.Path
|
||||
}
|
||||
|
||||
function Clear-NativeDependencies
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true)] [string] $PublishFolder
|
||||
)
|
||||
|
||||
$diasymFileNamePattern = 'microsoft.diasymreader.native.{0}.dll'
|
||||
|
||||
switch -regex ($($script:Options.Runtime)) {
|
||||
'.*-x64' {
|
||||
$diasymFileName = $diasymFileNamePattern -f 'amd64'
|
||||
}
|
||||
'.*-x86' {
|
||||
$diasymFileName = $diasymFileNamePattern -f 'x86'
|
||||
}
|
||||
'.*-arm' {
|
||||
$diasymFileName = $diasymFileNamePattern -f 'arm'
|
||||
}
|
||||
'.*-arm64' {
|
||||
$diasymFileName = $diasymFileNamePattern -f 'arm64'
|
||||
}
|
||||
'fxdependent.*' {
|
||||
Write-Verbose -Message "$($script:Options.Runtime) is a fxdependent runtime, skipping diasymreader removal" -Verbose
|
||||
$diasymFileName = $null
|
||||
}
|
||||
Default {
|
||||
throw "Unknown runtime $($script:Options.Runtime)"
|
||||
}
|
||||
}
|
||||
|
||||
$filesToDeleteCore = @($diasymFileName)
|
||||
|
||||
$filesToDeleteWinDesktop = @('penimc_cor3.dll')
|
||||
|
||||
$deps = Get-Content "$PublishFolder/pwsh.deps.json" -Raw | ConvertFrom-Json -Depth 20
|
||||
$targetRuntime = ".NETCoreApp,Version=v7.0/$($script:Options.Runtime)"
|
||||
|
||||
$runtimePackNetCore = $deps.targets.${targetRuntime}.PSObject.Properties.Name -like 'runtimepack.Microsoft.NETCore.App.Runtime*'
|
||||
$runtimePackWinDesktop = $deps.targets.${targetRuntime}.PSObject.Properties.Name -like 'runtimepack.Microsoft.WindowsDesktop.App.Runtime*'
|
||||
|
||||
if ($runtimePackNetCore)
|
||||
{
|
||||
$filesToDeleteCore | ForEach-Object {
|
||||
Write-Verbose "Removing $_ from pwsh.deps.json" -Verbose
|
||||
$deps.targets.${targetRuntime}.${runtimePackNetCore}.native.PSObject.Properties.Remove($_)
|
||||
if (Test-Path $PublishFolder/$_) {
|
||||
Remove-Item -Path $PublishFolder/$_ -Force -Verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($runtimePackWinDesktop)
|
||||
{
|
||||
$filesToDeleteWinDesktop | ForEach-Object {
|
||||
Write-Verbose "Removing $_ from pwsh.deps.json" -Verbose
|
||||
$deps.targets.${targetRuntime}.${runtimePackWinDesktop}.native.PSObject.Properties.Remove($_)
|
||||
if (Test-Path $PublishFolder/$_) {
|
||||
Remove-Item -Path $PublishFolder/$_ -Force -Verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$deps | ConvertTo-Json -Depth 20 | Set-Content "$PublishFolder/pwsh.deps.json" -Force
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user