Fix the net framework folder in nuget packages (#25269)

This commit is contained in:
Aditya Patwardhan
2025-04-01 14:35:48 -07:00
committed by GitHub
parent 5adac796c9
commit 146337283b
2 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -128,13 +128,13 @@ jobs:
Start-PSBuild -Clean -Runtime linux-x64 -Configuration Release -ReleaseTag $(ReleaseTagVar)
$sharedModules | Foreach-Object {
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net9.0\refint\$_.dll"
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net10.0\refint\$_.dll"
Write-Verbose -Verbose "RefAssembly: $refFile"
Copy-Item -Path $refFile -Destination "$refAssemblyFolder\$_.dll" -Verbose
$refDoc = "$(PowerShellRoot)\src\$_\bin\Release\net9.0\$_.xml"
$refDoc = "$(PowerShellRoot)\src\$_\bin\Release\net10.0\$_.xml"
if (-not (Test-Path $refDoc)) {
Write-Warning "$refDoc not found"
Get-ChildItem -Path "$(PowerShellRoot)\src\$_\bin\Release\net9.0\" | Out-String | Write-Verbose -Verbose
Get-ChildItem -Path "$(PowerShellRoot)\src\$_\bin\Release\net10.0\" | Out-String | Write-Verbose -Verbose
}
else {
Copy-Item -Path $refDoc -Destination "$refAssemblyFolder\$_.xml" -Verbose
@@ -144,13 +144,13 @@ jobs:
Start-PSBuild -Clean -Runtime win7-x64 -Configuration Release -ReleaseTag $(ReleaseTagVar)
$winOnlyModules | Foreach-Object {
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net9.0\refint\*.dll"
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net10.0\refint\*.dll"
Write-Verbose -Verbose 'RefAssembly: $refFile'
Copy-Item -Path $refFile -Destination "$refAssemblyFolder\$_.dll" -Verbose
$refDoc = "$(PowerShellRoot)\src\$_\bin\Release\net9.0\$_.xml"
$refDoc = "$(PowerShellRoot)\src\$_\bin\Release\net10.0\$_.xml"
if (-not (Test-Path $refDoc)) {
Write-Warning "$refDoc not found"
Get-ChildItem -Path "$(PowerShellRoot)\src\$_\bin\Release\net9.0" | Out-String | Write-Verbose -Verbose
Get-ChildItem -Path "$(PowerShellRoot)\src\$_\bin\Release\net10.0" | Out-String | Write-Verbose -Verbose
}
else {
Copy-Item -Path $refDoc -Destination "$refAssemblyFolder\$_.xml" -Verbose
@@ -275,7 +275,7 @@ jobs:
)
$sourceModulePath = Join-Path '$(GlobalToolArtifactPath)' 'publish' 'PowerShell.Windows.x64' 'release' 'Modules'
$destModulesPath = Join-Path "$outputPath" 'temp' 'tools' 'net9.0' 'any' 'modules'
$destModulesPath = Join-Path "$outputPath" 'temp' 'tools' 'net10.0' 'any' 'modules'
$modulesToCopy | ForEach-Object {
$modulePath = Join-Path $sourceModulePath $_
@@ -283,7 +283,7 @@ jobs:
}
# Copy ref assemblies
Copy-Item '$(Pipeline.Workspace)/Symbols_$(Architecture)/ref' "$outputPath\temp\tools\net9.0\any\ref" -Recurse -Force
Copy-Item '$(Pipeline.Workspace)/Symbols_$(Architecture)/ref' "$outputPath\temp\tools\net10.0\any\ref" -Recurse -Force
$contentPath = Join-Path "$outputPath\temp" 'content'
$contentFilesPath = Join-Path "$outputPath\temp" 'contentFiles'
@@ -291,14 +291,14 @@ jobs:
Remove-Item -Path $contentPath,$contentFilesPath -Recurse -Force
# remove PDBs to reduce the size of the nupkg
Remove-Item -Path "$outputPath\temp\tools\net9.0\any\*.pdb" -Recurse -Force
Remove-Item -Path "$outputPath\temp\tools\net10.0\any\*.pdb" -Recurse -Force
# create powershell.config.json
$config = [ordered]@{}
$config.Add("Microsoft.PowerShell:ExecutionPolicy", "RemoteSigned")
$config.Add("WindowsPowerShellCompatibilityModuleDenyList", @("PSScheduledJob", "BestPractices", "UpdateServices"))
$configPublishPath = Join-Path "$outputPath" 'temp' 'tools' 'net9.0' 'any' "powershell.config.json"
$configPublishPath = Join-Path "$outputPath" 'temp' 'tools' 'net10.0' 'any' "powershell.config.json"
Set-Content -Path $configPublishPath -Value ($config | ConvertTo-Json) -Force -ErrorAction Stop
Compress-Archive -Path "$outputPath\temp\*" -DestinationPath "$outputPath\$nupkgName" -Force