Skip to content

Compile against net452 because net451 is not supported any more #828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ param(

$script:IsCIBuild = $env:APPVEYOR -ne $null
$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows
$script:TargetFrameworksParam = "/p:TargetFrameworks=\`"$(if (!$script:IsUnix) { "net451;" })netstandard1.6\`""
$script:TargetFrameworksParam = "/p:TargetFrameworks=\`"$(if (!$script:IsUnix) { "net452;" })netstandard1.6\`""
$script:SaveModuleSupportsAllowPrerelease = (Get-Command Save-Module).Parameters.ContainsKey("AllowPrerelease")
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Host", "BuildInfo", "BuildInfo.cs")

Expand Down Expand Up @@ -136,7 +136,7 @@ task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {

function BuildForPowerShellVersion($version) {
Write-Host -ForegroundColor Green "`n### Testing API usage for PowerShell $version...`n"
exec { & $script:dotnetExe build -f net451 .\src\PowerShellEditorServices\PowerShellEditorServices.csproj /p:PowerShellVersion=$version }
exec { & $script:dotnetExe build -f net452 .\src\PowerShellEditorServices\PowerShellEditorServices.csproj /p:PowerShellVersion=$version }
}

task TestPowerShellApi -If { !$script:IsUnix } {
Expand Down Expand Up @@ -196,7 +196,7 @@ namespace Microsoft.PowerShell.EditorServices.Host
task Build {
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f netstandard1.6 }
if (!$script:IsUnix) {
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f net451 }
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f net452 }
}
exec { & $script:dotnetExe build -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj $script:TargetFrameworksParam }
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f netstandard1.6 }
Expand Down Expand Up @@ -267,12 +267,12 @@ task LayoutModule -After Build {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\publish\runtimes\win\lib\netstandard1.3\* -Filter System.IO.Pipes*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\

if (!$script:IsUnix) {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net451\Serilog*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net451\System.Runtime.InteropServices.RuntimeInformation.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net452\Serilog*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net452\System.Runtime.InteropServices.RuntimeInformation.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\

Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\Newtonsoft.Json.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\UnixConsoleEcho.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net452\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net452\Newtonsoft.Json.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net452\UnixConsoleEcho.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
}

# Copy Third Party Notices.txt to module folder
Expand All @@ -285,7 +285,7 @@ task LayoutModule -After Build {

Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\netstandard1.6\* -Filter Microsoft.PowerShell.EditorServices.VSCode*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Core\
if (!$script:IsUnix) {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\net451\* -Filter Microsoft.PowerShell.EditorServices.VSCode*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\net452\* -Filter Microsoft.PowerShell.EditorServices.VSCode*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Desktop\
}

if ($Configuration -eq "Debug") {
Expand All @@ -295,10 +295,10 @@ task LayoutModule -After Build {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Protocol\bin\$Configuration\netstandard1.6\Microsoft.PowerShell.EditorServices.Protocol.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\

if (!$script:IsUnix) {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\net451\Microsoft.PowerShell.EditorServices.VSCode.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net451\Microsoft.PowerShell.EditorServices.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\Microsoft.PowerShell.EditorServices.Host.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Protocol\bin\$Configuration\net451\Microsoft.PowerShell.EditorServices.Protocol.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\net452\Microsoft.PowerShell.EditorServices.VSCode.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\net452\Microsoft.PowerShell.EditorServices.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net452\Microsoft.PowerShell.EditorServices.Host.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Protocol\bin\$Configuration\net452\Microsoft.PowerShell.EditorServices.Protocol.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ If you are using macOS you will need to download the latest version of OpenSSL.
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
```
### 2. On Windows, install the .NET 4.5.1 Targeting Pack
### 2. On Windows, install the .NET 4.5.2 Targeting Pack

**NOTE: This is only necessary if you don't have Visual Studio installed**

If you try to build the code and receive an error about a missing .NET 4.5.1
If you try to build the code and receive an error about a missing .NET 4.5.2
Targeting Pack, you should download and install the [.NET Framework 4.5.2 Developer Pack](https://www.microsoft.com/en-us/download/details.aspx?id=42637).

### 3. Clone the GitHub repository:
Expand Down
8 changes: 4 additions & 4 deletions module/PowerShellEditorServices/Start-EditorServices.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@ if ($host.Runspace.LanguageMode -eq 'ConstrainedLanguage') {
ExitWithError "PowerShell is configured with an unsupported LanguageMode (ConstrainedLanguage), language features are disabled."
}

# net45 is not supported, only net451 and up
# net451 and lower are not supported, only net452 and up
if ($PSVersionTable.PSVersion.Major -le 5) {
$net451Version = 378675
$net452Version = 379893
$dotnetVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\").Release
if ($dotnetVersion -lt $net451Version) {
if ($dotnetVersion -lt $net452Version) {
Write-SessionFile @{
status = failed
reason = "netversion"
detail = "$netVersion"
}

ExitWithError "Your .NET version is too low. Upgrade to net451 or higher to run the PowerShell extension."
ExitWithError "Your .NET version is too low. Upgrade to net452 or higher to run the PowerShell extension."
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services WebSocket Protocol Channel</AssemblyTitle>
<TargetFramework>net451</TargetFramework>
<TargetFramework>net452</TargetFramework>
<AssemblyName>Microsoft.PowerShell.EditorServices.Channel.WebSocket</AssemblyName>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<ProjectReference Include="..\PowerShellEditorServices\PowerShellEditorServices.csproj" />
<ProjectReference Include="..\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj" />
</ItemGroup>
Expand All @@ -18,7 +18,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<PackageReference Include="CommonServiceLocator" Version="1.3" />
<PackageReference Include="Microsoft.Owin" Version="3.0.0" />
<PackageReference Include="Owin" Version="1.0" />
Expand All @@ -29,7 +29,7 @@
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PowerShellEditorServices.Host/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services Host Process</AssemblyTitle>
<Description>Provides a process for hosting the PowerShell Editor Services library exposed by a JSON message protocol.</Description>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard1.6;net452</TargetFrameworks>
<AssemblyName>Microsoft.PowerShell.EditorServices.Host</AssemblyName>
</PropertyGroup>

Expand All @@ -26,7 +26,7 @@
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services Host Protocol Library</AssemblyTitle>
<Description>Provides message types and client/server APIs for the PowerShell Editor Services JSON protocol.</Description>
<TargetFrameworks>netstandard1.6;net451;</TargetFrameworks>
<TargetFrameworks>netstandard1.6;net452;</TargetFrameworks>
<AssemblyName>Microsoft.PowerShell.EditorServices.Protocol</AssemblyName>
</PropertyGroup>
<ItemGroup>
Expand All @@ -20,7 +20,7 @@
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services, Visual Studio Code Extensions</AssemblyTitle>
<Description>Provides added functionality to PowerShell Editor Services for the Visual Studio Code editor.</Description>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard1.6;net452</TargetFrameworks>
<AssemblyName>Microsoft.PowerShell.EditorServices.VSCode</AssemblyName>
</PropertyGroup>

Expand All @@ -24,7 +24,7 @@
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/PowerShellEditorServices/PowerShellEditorServices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services</AssemblyTitle>
<Description>Provides common PowerShell editor capabilities as a .NET library.</Description>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard1.6;net452</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be worth it to move to netstandard2.0 for .NET Core builds?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been wondering the same. Would there be any reason not to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What version of .NET Core did 6.0 & 6.1 ship with? Seems like at least 6.0 was 1.x so maybe we're stuck with 1.6 until we're willing to drop support for 6.0 (and maybe 6.1). Doh!

Copy link
Contributor Author

@bergmeister bergmeister Dec 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSCore 6.0 and 6.1 both run on .Net Core 2.1 and implement netstandard2.0. The only hypothetical reason not to would be a reduced set of runtimes but this would only apply in restricted scenarios like e.g. mobile phone apps using Xamarin.
But I have been told not to submit a PR for such changes because the 2.0.0 branch upgrades it to .netstandard2.0 and PSStandard already. PR #830 got closed for that reason for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're both compatible I'm pretty sure. The real work in the upgrade was eliminating net45 stuff and things PSStandard didn't like. In which case I think we may as well upgrade to netstandard2.0. But @TylerLeonhardt may have good reasons not to

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.0 ships with .NET Core 2.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless something changed in the last patch version

<AssemblyName>Microsoft.PowerShell.EditorServices</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
Expand All @@ -28,18 +28,18 @@
</PropertyGroup>

<Target Name="PowerShellVersionOutput" BeforeTargets="Compile">
<Message Condition=" '$(TargetFramework)' == 'net451' And '$(PowerShellVersion)' != '' " Text="Target PowerShell Version: $(PowerShellVersion) -- Constants: $(DefineConstants)" Importance="High" />
<Message Condition=" '$(TargetFramework)' == 'net452' And '$(PowerShellVersion)' != '' " Text="Target PowerShell Version: $(PowerShellVersion) -- Constants: $(DefineConstants)" Importance="High" />
</Target>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' And '$(PowerShellVersion)' == 'v3' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' And '$(PowerShellVersion)' == 'v3' ">
<PackageReference Include="Microsoft.PowerShell.3.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' And '$(PowerShellVersion)' == 'v4' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' And '$(PowerShellVersion)' == 'v4' ">
<PackageReference Include="Microsoft.PowerShell.4.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' And ('$(PowerShellVersion)' == 'v5r2' Or '$(PowerShellVersion)' == 'v5r1')">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' And ('$(PowerShellVersion)' == 'v5r2' Or '$(PowerShellVersion)' == 'v5r1')">
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

Expand All @@ -49,7 +49,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
Expand Down
3 changes: 1 addition & 2 deletions tools/releaseBuild/Image/DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ RUN Import-Module PackageManagement; `
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force; `
Install-Module platyPS -RequiredVersion 0.9.0 -Scope CurrentUser -Force;

# Install .NET Framework 4.5.1 & 4.5.2 Developer Packs
# Install .NET Framework 4.5.2 Developer Packs
RUN Import-Module ./containerFiles/dockerInstall.psm1; `
Install-ChocolateyPackage -PackageName netfx-4.5.1-devpack; `
Install-ChocolateyPackage -PackageName netfx-4.5.2-devpack;

# Copy build script over
Expand Down