diff --git a/PowerShell.Common.props b/PowerShell.Common.props
index 99b5341804..5e7e41f147 100644
--- a/PowerShell.Common.props
+++ b/PowerShell.Common.props
@@ -172,16 +172,11 @@
true
true
true
+ portable
- true
- full
-
-
-
-
true
full
@@ -193,15 +188,6 @@
Debugging the issues resolves the problem
-->
false
- portable
-
-
-
-
-
- true
- true
- portable
diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs
index 4a9c36ad3d..c0ca7d624d 100644
--- a/assets/wix/files.wxs
+++ b/assets/wix/files.wxs
@@ -2936,9 +2936,6 @@
-
-
-
@@ -3023,9 +3020,6 @@
-
-
-
@@ -3089,9 +3083,6 @@
-
-
-
@@ -3153,6 +3144,9 @@
+
+
+
@@ -4052,7 +4046,6 @@
-
@@ -4081,7 +4074,6 @@
-
@@ -4103,7 +4095,6 @@
-
@@ -4166,6 +4157,7 @@
+
diff --git a/build.psm1 b/build.psm1
index 3d42e66e63..de6a13834b 100644
--- a/build.psm1
+++ b/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
+}