Skip to content

Commit 77e256a

Browse files
authored
Update build to use net462 (#3285)
net461 is reaching end of support on 4/26/2022.
1 parent b083ce7 commit 77e256a

File tree

14 files changed

+32
-45
lines changed

14 files changed

+32
-45
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ The build script `build.ps1` can be used to bootstrap, build and test the projec
7575

7676
* Bootstrap: `./build.ps1 -Bootstrap`
7777
* Build:
78-
* Targeting .NET 4.6.1 (Windows only): `./build.ps1 -Configuration Debug -Framework net461`
78+
* Targeting .NET 4.6.2 (Windows only): `./build.ps1 -Configuration Debug -Framework net462`
7979
* Targeting .NET Core: `./build.ps1 -Configuration Debug -Framework netcoreapp2.1`
8080
* Test:
81-
* Targeting .NET 4.6.1 (Windows only): `./build.ps1 -Test -Configuration Debug -Framework net461`
81+
* Targeting .NET 4.6.2 (Windows only): `./build.ps1 -Test -Configuration Debug -Framework net462`
8282
* Targeting .NET Core: `./build.ps1 -Test -Configuration Debug -Framework netcoreapp2.1`
8383

8484
After build, the produced artifacts can be found at `<your-local-repo-root>/bin/Debug`.

.vsts-ci/releaseBuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ stages:
4242
Write-Host "PS Version: $($($PSVersionTable.PSVersion))"
4343
Set-Location -Path '$(Build.SourcesDirectory)\PSReadLine'
4444
.\build.ps1 -Bootstrap
45-
.\build.ps1 -Configuration Release -Framework net461 -CheckHelpContent
45+
.\build.ps1 -Configuration Release -Framework net462 -CheckHelpContent
4646
4747
# Set target folder paths
4848
New-Item -Path .\bin\Release\NuGetPackage -ItemType Directory > $null

MockPSConsole/MockPSConsole.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<OutputType>Exe</OutputType>
55
<RootNamespace>MockPSConsole</RootNamespace>
66
<AssemblyName>MockPSConsole</AssemblyName>
7-
<TargetFrameworks>net461;net6.0</TargetFrameworks>
7+
<TargetFrameworks>net462;net6.0</TargetFrameworks>
88
<FileAlignment>512</FileAlignment>
99
<ApplicationManifest>Program.manifest</ApplicationManifest>
1010
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1111
</PropertyGroup>
1212

13-
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
13+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
1414
<PackageReference Include="System.Xml.XDocument" version="4.3.0" />
1515
<PackageReference Include="System.Data.DataSetExtensions" version="4.5.0" />
1616
<PackageReference Include="Microsoft.CSharp" version="4.7.0" />

PSReadLine.build.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ param(
1919
[ValidateSet("Debug", "Release")]
2020
[string]$Configuration = (property Configuration Release),
2121

22-
[ValidateSet("net461", "net6.0")]
22+
[ValidateSet("net462", "net6.0")]
2323
[string]$Framework,
2424

2525
[switch]$CheckHelpContent
@@ -32,7 +32,7 @@ $targetDir = "bin/$Configuration/PSReadLine"
3232

3333
if (-not $Framework)
3434
{
35-
$Framework = if ($PSVersionTable.PSEdition -eq "Core") { "net6.0" } else { "net461" }
35+
$Framework = if ($PSVersionTable.PSEdition -eq "Core") { "net6.0" } else { "net462" }
3636
}
3737

3838
Write-Verbose "Building for '$Framework'" -Verbose
@@ -64,9 +64,9 @@ $mockPSConsoleParams = @{
6464
<#
6565
Synopsis: Build the Polyfiller assembly
6666
#>
67-
task BuildPolyfiller @polyFillerParams -If ($Framework -eq "net461") {
68-
## Build both "net461" and "net6.0"
69-
exec { dotnet publish -f "net461" -c $Configuration Polyfill }
67+
task BuildPolyfiller @polyFillerParams -If ($Framework -eq "net462") {
68+
## Build both "net462" and "net6.0"
69+
exec { dotnet publish -f "net462" -c $Configuration Polyfill }
7070
exec { dotnet publish -f "net6.0" -c $Configuration Polyfill }
7171
}
7272

@@ -128,15 +128,15 @@ task LayoutModule BuildPolyfiller, BuildMainModule, {
128128
Set-Content -Path (Join-Path $targetDir (Split-Path $file -Leaf)) -Value (ConvertTo-CRLF $content) -Force
129129
}
130130

131-
if ($Framework -eq "net461") {
132-
if (-not (Test-Path "$targetDir/net461")) {
133-
New-Item "$targetDir/net461" -ItemType Directory -Force > $null
131+
if ($Framework -eq "net462") {
132+
if (-not (Test-Path "$targetDir/net462")) {
133+
New-Item "$targetDir/net462" -ItemType Directory -Force > $null
134134
}
135135
if (-not (Test-Path "$targetDir/net6plus")) {
136136
New-Item "$targetDir/net6plus" -ItemType Directory -Force > $null
137137
}
138138

139-
Copy-Item "Polyfill/bin/$Configuration/net461/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" "$targetDir/net461" -Force
139+
Copy-Item "Polyfill/bin/$Configuration/net462/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" "$targetDir/net462" -Force
140140
Copy-Item "Polyfill/bin/$Configuration/net6.0/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" "$targetDir/net6plus" -Force
141141
}
142142

PSReadLine/OnImportAndRemove.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
2828
}
2929

3030
string root = Path.GetDirectoryName(typeof(OnModuleImportAndRemove).Assembly.Location);
31-
string subd = (Environment.Version.Major >= 6) ? "net6plus" : "net461";
31+
string subd = (Environment.Version.Major >= 6) ? "net6plus" : "net462";
3232
string path = Path.Combine(root, subd, "Microsoft.PowerShell.PSReadLine.Polyfiller.dll");
3333

3434
return Assembly.LoadFrom(path);

PSReadLine/PSReadLine.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<FileVersion>2.2.3</FileVersion>
1010
<InformationalVersion>2.2.3</InformationalVersion>
1111
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
12-
<TargetFrameworks>net461;net6.0</TargetFrameworks>
12+
<TargetFrameworks>net462;net6.0</TargetFrameworks>
1313
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1414
<LangVersion>9.0</LangVersion>
1515
</PropertyGroup>
1616

17-
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
17+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
1818
<PackageReference Include="PowerShellStandard.Library" version="5.1.0" />
1919
<PackageReference Include="Microsoft.CSharp" version="4.7.0" />
2020
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" />

PSReadLine/PSReadLine.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CompanyName = 'Microsoft Corporation'
88
Copyright = '(c) Microsoft Corporation. All rights reserved.'
99
Description = 'Great command line editing in the PowerShell console host'
1010
PowerShellVersion = '5.0'
11-
DotNetFrameworkVersion = '4.6.1'
11+
DotNetFrameworkVersion = '4.6.2'
1212
CLRVersion = '4.0.0'
1313
FormatsToProcess = 'PSReadLine.format.ps1xml'
1414
AliasesToExport = @()

PSReadLine/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"profiles": {
3-
"PSReadLine-net461": {
3+
"PSReadLine-net462": {
44
"commandName": "Executable",
55
"executablePath": "powershell",
66
"commandLineArgs": "-NoProfile -NonInteractive -NoExit -Command Import-Module .\\PSReadLine.psd1"

Polyfill/Polyfill.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
<PropertyGroup>
44
<AssemblyName>Microsoft.PowerShell.PSReadLine.Polyfiller</AssemblyName>
55
<AssemblyVersion>1.0.0.0</AssemblyVersion>
6-
<TargetFrameworks>net461;net6.0</TargetFrameworks>
6+
<TargetFrameworks>net462;net6.0</TargetFrameworks>
77
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
88
</PropertyGroup>
99

10-
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
10+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
1111
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
1515
<PackageReference Include="System.Management.Automation" Version="7.2.0" />
1616
</ItemGroup>
1717

18-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
18+
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
1919
<DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
2020
</PropertyGroup>
2121

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ The build script `build.ps1` can be used to bootstrap, build and test the projec
233233

234234
* Bootstrap: `./build.ps1 -Bootstrap`
235235
* Build:
236-
* Targeting .NET 4.6.1 (Windows only): `./build.ps1 -Configuration Debug -Framework net461`
236+
* Targeting .NET 4.6.2 (Windows only): `./build.ps1 -Configuration Debug -Framework net462`
237237
* Targeting .NET Core: `./build.ps1 -Configuration Debug -Framework netcoreapp2.1`
238238
* Test:
239-
* Targeting .NET 4.6.1 (Windows only): `./build.ps1 -Test -Configuration Debug -Framework net461`
239+
* Targeting .NET 4.6.2 (Windows only): `./build.ps1 -Test -Configuration Debug -Framework net462`
240240
* Targeting .NET Core: `./build.ps1 -Test -Configuration Debug -Framework netcoreapp2.1`
241241

242242
After build, the produced artifacts can be found at `<your-local-repo-root>/bin/Debug`.

0 commit comments

Comments
 (0)