Skip to content

Commit 7c1cc86

Browse files
authored
Use new TargetFramwork as net5.0 in packaging scripts (PowerShell#12503)
1 parent 86b6a9d commit 7c1cc86

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

PowerShell.Common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<Company>Microsoft Corporation</Company>
9696
<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>
9797

98-
<TargetFramework>netcoreapp5.0</TargetFramework>
98+
<TargetFramework>net5.0</TargetFramework>
9999
<LangVersion>8.0</LangVersion>
100100
<PublishReadyToRun>true</PublishReadyToRun>
101101

test/tools/OpenCover/OpenCover.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ function Install-OpenCover
615615
.Description
616616
Invoke-OpenCover runs tests under OpenCover by executing tests on PowerShell located at $PowerShellExeDirectory.
617617
.EXAMPLE
618-
Invoke-OpenCover -TestPath $PWD/test/powershell -PowerShellExeDirectory $PWD/src/powershell-win-core/bin/CodeCoverage/netcoreapp5.0/win7-x64
618+
Invoke-OpenCover -TestPath $PWD/test/powershell -PowerShellExeDirectory $PWD/src/powershell-win-core/bin/CodeCoverage/net5.0/win7-x64
619619
#>
620620
function Invoke-OpenCover
621621
{
@@ -624,7 +624,7 @@ function Invoke-OpenCover
624624
[parameter()]$OutputLog = "$HOME/Documents/OpenCover.xml",
625625
[parameter()]$TestPath = "${script:psRepoPath}/test/powershell",
626626
[parameter()]$OpenCoverPath = "$HOME/OpenCover",
627-
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp5.0/win7-x64/publish",
627+
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/net5.0/win7-x64/publish",
628628
[parameter()]$PesterLogElevated = "$HOME/Documents/TestResultsElevated.xml",
629629
[parameter()]$PesterLogUnelevated = "$HOME/Documents/TestResultsUnelevated.xml",
630630
[parameter()]$PesterLogFormat = "NUnitXml",

tools/packaging/packaging.psm1

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ $packagingStrings = Import-PowerShellDataFile "$PSScriptRoot\packaging.strings.p
88
Import-Module "$PSScriptRoot\..\Xml" -ErrorAction Stop -Force
99
$DebianDistributions = @("ubuntu.16.04", "ubuntu.18.04", "debian.9", "debian.10", "debian.11")
1010
$RedhatDistributions = @("rhel.7","centos.8")
11+
$script:netCoreRuntime = 'net5.0'
1112

1213
function Start-PSPackage {
1314
[CmdletBinding(DefaultParameterSetName='Version',SupportsShouldProcess=$true)]
@@ -131,14 +132,14 @@ function Start-PSPackage {
131132
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
132133
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
133134
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
134-
$Script:Options.Framework -ne "net5.0" ## Last build wasn't for CoreCLR
135+
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
135136
} else {
136137
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
137138
-not $crossGenCorrect -or ## Last build didn't specify '-CrossGen' correctly
138139
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
139140
$Script:Options.Runtime -ne $Runtime -or ## Last build wasn't for the required RID
140141
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
141-
$Script:Options.Framework -ne "net5.0" ## Last build wasn't for CoreCLR
142+
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
142143
}
143144

144145
# Make sure the most recent build satisfies the package requirement
@@ -1719,7 +1720,7 @@ function CreateNugetPlatformFolder
17191720
[string] $PlatformBinPath
17201721
)
17211722

1722-
$destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/netcoreapp5.0")
1723+
$destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/$script:netCoreRuntime")
17231724
$fullPath = Join-Path $PlatformBinPath $file
17241725

17251726
if (-not(Test-Path $fullPath)) {
@@ -1819,7 +1820,7 @@ function New-ILNugetPackage
18191820
$packageRuntimesFolder = New-Item (Join-Path $filePackageFolder.FullName 'runtimes') -ItemType Directory
18201821

18211822
#region ref
1822-
$refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/netcoreapp5.0') -ItemType Directory -Force
1823+
$refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/$script:netCoreRuntime') -ItemType Directory -Force
18231824
CopyReferenceAssemblies -assemblyName $fileBaseName -refBinPath $refBinPath -refNugetPath $refFolder -assemblyFileList $fileList
18241825
#endregion ref
18251826

@@ -1863,8 +1864,8 @@ function New-ILNugetPackage
18631864
"Microsoft.PowerShell.Utility"
18641865
)
18651866

1866-
$winModuleFolder = New-Item (Join-Path $contentFolder "runtimes\win\lib\netcoreapp5.0\Modules") -ItemType Directory -Force
1867-
$unixModuleFolder = New-Item (Join-Path $contentFolder "runtimes\unix\lib\netcoreapp5.0\Modules") -ItemType Directory -Force
1867+
$winModuleFolder = New-Item (Join-Path $contentFolder "runtimes\win\lib\$script:netCoreRuntime\Modules") -ItemType Directory -Force
1868+
$unixModuleFolder = New-Item (Join-Path $contentFolder "runtimes\unix\lib\$script:netCoreRuntime\Modules") -ItemType Directory -Force
18681869

18691870
foreach ($module in $winBuiltInModules) {
18701871
$source = Join-Path $WinFxdBinPath "Modules\$module"
@@ -1991,7 +1992,7 @@ function New-ILNugetPackage
19911992
}
19921993

19931994
<#
1994-
Copy the generated reference assemblies to the 'ref/netcoreapp5.0' folder properly.
1995+
Copy the generated reference assemblies to the 'ref/net5.0' folder properly.
19951996
This is a helper function used by 'New-ILNugetPackage'
19961997
#>
19971998
function CopyReferenceAssemblies
@@ -2234,7 +2235,7 @@ function New-ReferenceAssembly
22342235
Write-Log "Running: dotnet $arguments"
22352236
Start-NativeExecution -sb {dotnet $arguments}
22362237

2237-
$refBinPath = Join-Path $projectFolder "bin/Release/netcoreapp5.0/$assemblyName.dll"
2238+
$refBinPath = Join-Path $projectFolder "bin/Release/$script:netCoreRuntime/$assemblyName.dll"
22382239
if ($null -eq $refBinPath) {
22392240
throw "Reference assembly was not built."
22402241
}
@@ -2886,7 +2887,7 @@ function New-MSIPatch
28862887
# This example shows how to produce a Debug-x64 installer for development purposes.
28872888
cd $RootPathOfPowerShellRepo
28882889
Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1
2889-
New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
2890+
New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
28902891
#>
28912892
function New-MSIPackage
28922893
{
@@ -3088,7 +3089,7 @@ function New-MSIPackage
30883089
# This example shows how to produce a Debug-x64 installer for development purposes.
30893090
cd $RootPathOfPowerShellRepo
30903091
Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1
3091-
New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
3092+
New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
30923093
#>
30933094
function New-MSIXPackage
30943095
{
@@ -3678,7 +3679,7 @@ function New-GlobalToolNupkg
36783679
}
36793680

36803681
$packageInfo | ForEach-Object {
3681-
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp5.0/any") -ItemType Directory
3682+
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
36823683

36833684
$packageType = $_.Type
36843685

0 commit comments

Comments
 (0)