Skip to content

Migrate to netstandard2.0 and PSStandard #741

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 70 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
dc7cae2
Move PSES builds to netstandard and use PSStandard APIs
rjmholt Aug 29, 2018
624f7fe
Fix missed net451 reference in build file
rjmholt Aug 29, 2018
3cda894
First test fixes
rjmholt Aug 29, 2018
187aea6
Add PowerShell SDK references to tests where needed
rjmholt Aug 29, 2018
bdf008e
Converted test paths, removed #ifs from src/
rjmholt Aug 30, 2018
3ba9c0a
Add restore to build rule
rjmholt Sep 3, 2018
3567a2d
Unskip some tests, use non-Windows specific tests, lose hash key orde…
rjmholt Sep 3, 2018
15dcb61
Fix alias tests
rjmholt Sep 3, 2018
e622473
Fix platform specific tests, move build to netcoreapp2.1, break things
rjmholt Sep 4, 2018
a929752
Use latest xunit
rjmholt Sep 5, 2018
05d2f44
Use PrivateAssets to make PS SDK binding work
rjmholt Sep 5, 2018
f5114c8
Exclude host integration tests
rjmholt Sep 5, 2018
e189f87
Change dotnet xunit to dotnet test in test invocation
rjmholt Sep 5, 2018
f220082
Improve test support on Windows
rjmholt Sep 5, 2018
071b7e0
Move project references
rjmholt Sep 5, 2018
9304ba0
Drop unsupported msbuild switches for net461 builds
rjmholt Sep 5, 2018
8fc5b68
Fix net461 test bugs
Sep 6, 2018
7146a05
Add net461 shim binaries for Windows PowerShell
Sep 12, 2018
d9f3168
Build in single dir
Sep 12, 2018
66bf56f
Clean up build script
Sep 12, 2018
6fac967
Skip failing AsyncDebouncer test
Sep 12, 2018
7651f0f
Update build tooling
Sep 12, 2018
f8f60bd
Use correct Newtonsoft.Json version for PSCore 6.0
Sep 12, 2018
1525ff8
Address some PR feedback
Sep 13, 2018
88639c5
Fix casing typos
Sep 13, 2018
d8f4b2e
Make travis fail when errors occur
Sep 13, 2018
32b770f
Merge branch '2.0.0' into migrate-netstandard2.0
rjmholt Sep 13, 2018
395771e
Fix travis build
Sep 13, 2018
f5cfe42
Fix command module import path
Sep 13, 2018
02ee0e8
Try another travis fix
Sep 13, 2018
b8482c5
Restore travis build with verbose flags
Sep 13, 2018
063dadc
Try new travis script
Sep 13, 2018
25c322b
Travis
Sep 13, 2018
0a66601
Another travis try
Sep 13, 2018
d5cbd9a
TRAVIS!!!!!!
Sep 13, 2018
e1d0ac3
travis
Sep 13, 2018
e978b7c
travis >:(
Sep 13, 2018
3c13822
Suspect Save-Module is lying about the prerelease param
Sep 13, 2018
f8c462c
Never check for AllowPrerelease parameter
Sep 13, 2018
38bce43
Add ridiculous psget update dance back in
Sep 13, 2018
12b4cb6
Use newer PowerShell version in Travis
Sep 13, 2018
b47d915
Use newer powershell version
Sep 13, 2018
8b86ac9
Update dotnet CLI download
Sep 13, 2018
0bac8b6
Update dotnet SDK to latest release
Sep 13, 2018
4297563
Fix nuget bin declaration schema
Sep 13, 2018
59edb3c
Move restore to clean rule
Sep 13, 2018
865dc97
Clean up code
rjmholt Sep 14, 2018
32e13fe
Optimise encoding setting
rjmholt Sep 14, 2018
514ccf0
Update travis platforms
rjmholt Sep 14, 2018
2f870b7
Reformat travis.yml
rjmholt Sep 14, 2018
ff1b14d
Update travis config
rjmholt Sep 14, 2018
05ed5b5
Fix travis.yml
rjmholt Sep 14, 2018
8677a7a
Use CreateDefault2() again
rjmholt Sep 14, 2018
f08b6a9
Test for correct platforms
rjmholt Sep 14, 2018
da2e0b0
Move back to net461 for testing
rjmholt Sep 14, 2018
cdccf3a
Test appveyor pwsh path
Sep 14, 2018
354da07
Remove PSHome from appveyor
Sep 14, 2018
6a60e46
Try to set the module path with a config file
rjmholt Sep 17, 2018
e7a3cc9
Actually make the tests work
Sep 17, 2018
6cc0fb3
Enable writing to the config path
Sep 17, 2018
3462b23
Use sudo
Sep 17, 2018
f9d3018
Try different permissions set
Sep 17, 2018
86601f4
Give up and use a CreateDefault test hook instead
Sep 17, 2018
3511ed6
Use dotnet xunit instead of dotnet test
Sep 18, 2018
c69610e
Use simple pwsh process name
Sep 20, 2018
131e51f
Change test paths back to ensure backslack supported on *nix
Sep 20, 2018
271df79
Fix session details gathering in nested prompts
SeeminglyScience Sep 26, 2018
d99fbb6
Fix session details gathering in nested prompts
rjmholt Sep 26, 2018
784cef5
Address @tylerl0706's feedback
Oct 1, 2018
71c9ee9
Clean up temp file for nupkgs
Oct 1, 2018
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
4 changes: 2 additions & 2 deletions PowerShellEditorServices.Common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.8.2</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>PowerShell;editor;development;language;debugging</PackageTags>
Expand All @@ -9,6 +9,6 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/PowerShell/PowerShellEditorServices</RepositoryUrl>
<DebugType>portable</DebugType>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
<!--<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>-->
</PropertyGroup>
</Project>
112 changes: 48 additions & 64 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ 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:TargetPlatform = "netstandard2.0"
$script:TargetFrameworksParam = "/p:TargetFrameworks=`"$script:TargetPlatform`""
$script:SaveModuleSupportsAllowPrerelease = (Get-Command Save-Module).Parameters.ContainsKey("AllowPrerelease")

if ($PSVersionTable.PSEdition -ne "Core") {
Add-Type -Assembly System.IO.Compression.FileSystem
}

task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi, PackageNuGet {
task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, PackageNuGet {

$requiredSdkVersion = "2.0.0"
$requiredSdkVersion = "2.1.300"
Copy link
Member

Choose a reason for hiding this comment

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

did you really need a newer version of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to 2.1.301 (I think that's a stable one?) -- I needed to change it to get things to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now changed to 2.1.401 since that's the latest release. I had to update, and there doesn't seem to be a reason to not update to the latest.


$dotnetPath = "$PSScriptRoot/.dotnet"
$dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" }
Expand Down Expand Up @@ -128,30 +129,14 @@ task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {
Write-Host "`n### Product Version: $script:FullVersion`n" -ForegroundColor Green
}

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 }
}

task TestPowerShellApi -If { !$script:IsUnix } {
BuildForPowerShellVersion v3
BuildForPowerShellVersion v4
BuildForPowerShellVersion v5r1
Copy link
Member

Choose a reason for hiding this comment

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

😎


# Do a final restore to put everything back to normal
exec { & $script:dotnetExe restore .\src\PowerShellEditorServices\PowerShellEditorServices.csproj }
}

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 restore }
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f $script:TargetPlatform }
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 }
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\publish\UnixConsoleEcho.dll -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\publish\runtimes\osx-64\native\libdisablekeyecho.dylib -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\publish\runtimes\linux-64\native\libdisablekeyecho.so -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:TargetPlatform }
Copy link
Member

Choose a reason for hiding this comment

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

nit: can you put the PSES.VSCode one on the bottom since that is separate to the actual PSES module?

Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\$script:TargetPlatform\publish\UnixConsoleEcho.dll -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\$script:TargetPlatform\publish\runtimes\osx-64\native\libdisablekeyecho.dylib -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\$script:TargetPlatform\publish\runtimes\linux-64\native\libdisablekeyecho.so -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform
}

function UploadTestLogs {
Expand All @@ -174,22 +159,40 @@ function UploadTestLogs {

task Test TestServer,TestProtocol,TestHost

task TestServer -If { !$script:IsUnix } {
task TestServer {
Set-Location .\test\PowerShellEditorServices.Test\
exec { & $script:dotnetExe build -c $Configuration -f net452 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild }

if (-not $script:IsUnix) {
exec { & $script:dotnetExe build -c $Configuration -f net461 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net461 -verbose -nobuild }
}

exec { & $script:dotnetExe build -c $Configuration -f netcoreapp2.1 }
exec { & $script:dotnetExe test -f netcoreapp2.1 }
}

task TestProtocol -If { !$script:IsUnix } {
task TestProtocol {
Set-Location .\test\PowerShellEditorServices.Test.Protocol\
exec { & $script:dotnetExe build -c $Configuration -f net452 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild }

if (-not $script:IsUnix) {
exec { & $script:dotnetExe build -c $Configuration -f net461 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net461 -verbose -nobuild }
}

exec { & $script:dotnetExe build -c $Configuration -f netcoreapp2.1 }
exec { & $script:dotnetExe test -f netcoreapp2.1 }
}

task TestHost -If { !$script:IsUnix } {
task TestHost -If {
Copy link
Member

Choose a reason for hiding this comment

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

there still is a -If that I don't think needs to be there.

Copy link
Member

Choose a reason for hiding this comment

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

p.s. I thought these were the evil tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes! I thought I fixed this already but evidently not

Set-Location .\test\PowerShellEditorServices.Test.Host\
exec { & $script:dotnetExe build -c $Configuration -f net452 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild }

if (-not $script:IsUnix) {
exec { & $script:dotnetExe build -c $Configuration -f net461 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net461 -verbose -nobuild }
}

exec { & $script:dotnetExe build -c $Configuration -f netcoreapp2.1 }
exec { & $script:dotnetExe test -f netcoreapp2.1 }
}

task CITest ?Test, {
Expand All @@ -207,21 +210,12 @@ task LayoutModule -After Build {
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop -Type Directory | Out-Null
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices\bin\Core -Type Directory | Out-Null

Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\publish\Serilog*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\

Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\UnixConsoleEcho.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\libdisablekeyecho.* -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
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\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\$script:TargetPlatform\publish\Serilog*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy link
Member

Choose a reason for hiding this comment

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

As @SeeminglyScience said, we don't need to put this in bin\Core it can just be under bin


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.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\net451\publish\System.Runtime.InteropServices.RuntimeInformation.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
}
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform\UnixConsoleEcho.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform\libdisablekeyecho.* -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform\publish\runtimes\win\lib\netstandard1.3\* -Filter System.IO.Pipes*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\

# Copy Third Party Notices.txt to module folder
Copy-Item -Force -Path "$PSScriptRoot\Third Party Notices.txt" -Destination $PSScriptRoot\module\PowerShellEditorServices
Expand All @@ -231,23 +225,13 @@ task LayoutModule -After Build {
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Desktop -Type Directory | Out-Null
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Core -Type Directory | Out-Null

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\$script:TargetPlatform\* -Filter Microsoft.PowerShell.EditorServices.VSCode*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Core\

if ($Configuration -eq "Debug") {
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.VSCode\bin\$Configuration\netstandard1.6\Microsoft.PowerShell.EditorServices.VSCode.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\Microsoft.PowerShell.EditorServices.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\Microsoft.PowerShell.EditorServices.Host.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
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\$script:TargetPlatform\Microsoft.PowerShell.EditorServices.VSCode.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\$script:TargetPlatform\Microsoft.PowerShell.EditorServices.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\$script:TargetPlatform\Microsoft.PowerShell.EditorServices.Host.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Protocol\bin\$Configuration\$script:TargetPlatform\Microsoft.PowerShell.EditorServices.Protocol.pdb -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
}
}

Expand Down Expand Up @@ -359,4 +343,4 @@ task UploadArtifacts -If ($script:IsCIBuild) {
}

# The default task is to run the entire CI build
task . GetProductVersion, Clean, Build, TestPowerShellApi, CITest, BuildCmdletHelp, PackageNuGet, PackageModule, UploadArtifacts
task . GetProductVersion, Clean, Build, CITest, BuildCmdletHelp, PackageNuGet, PackageModule, UploadArtifacts
30 changes: 5 additions & 25 deletions src/PowerShellEditorServices.Host/EditorServicesHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Management.Automation.Runspaces;
using System.Reflection;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace Microsoft.PowerShell.EditorServices.Host
{
Expand Down Expand Up @@ -118,9 +119,7 @@ public EditorServicesHost(
#endif

// Catch unhandled exceptions for logging purposes
#if !CoreCLR
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif
}

#endregion
Expand All @@ -139,21 +138,12 @@ public void StartLogging(string logFilePath, LogLevel logLevel)
.AddLogFile(logFilePath)
.Build();

#if CoreCLR
FileVersionInfo fileVersionInfo =
FileVersionInfo.GetVersionInfo(this.GetType().GetTypeInfo().Assembly.Location);

// TODO #278: Need the correct dependency package for this to work correctly
//string osVersionString = RuntimeInformation.OSDescription;
//string processArchitecture = RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "64-bit" : "32-bit";
//string osArchitecture = RuntimeInformation.OSArchitecture == Architecture.X64 ? "64-bit" : "32-bit";
#else
FileVersionInfo fileVersionInfo =
FileVersionInfo.GetVersionInfo(this.GetType().Assembly.Location);
string osVersionString = Environment.OSVersion.VersionString;
string processArchitecture = Environment.Is64BitProcess ? "64-bit" : "32-bit";
string osArchitecture = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";
#endif
string osVersionString = RuntimeInformation.OSDescription;
string processArchitecture = RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "64-bit" : "32-bit";
string osArchitecture = RuntimeInformation.OSArchitecture == Architecture.X64 ? "64-bit" : "32-bit";

string newLine = Environment.NewLine;

Expand All @@ -165,14 +155,10 @@ public void StartLogging(string logFilePath, LogLevel logLevel)
$" Name: {this.hostDetails.Name}" + newLine +
$" ProfileId: {this.hostDetails.ProfileId}" + newLine +
$" Version: {this.hostDetails.Version}" + newLine +
#if !CoreCLR
$" Arch: {processArchitecture}" + newLine + newLine +
" Operating system details:" + newLine + newLine +
$" Version: {osVersionString}" + newLine +
$" Arch: {osArchitecture}"));
#else
""));
#endif
}

/// <summary>
Expand Down Expand Up @@ -441,19 +427,13 @@ private void ProtocolEndpoint_UnhandledException(object sender, Exception e)
this.serverCompletedTask.SetException(e);
}

#if !CoreCLR
private void CurrentDomain_UnhandledException(
object sender,
UnhandledExceptionEventArgs e)
{
// Log the exception
this.logger.Write(
LogLevel.Error,
string.Format(
"FATAL UNHANDLED EXCEPTION:\r\n\r\n{0}",
e.ExceptionObject.ToString()));
this.logger.Write(LogLevel.Error, $"FATAL UNHANDLED EXCEPTION: {e.ExceptionObject}");
}
#endif
private IServerListener CreateServiceListener(MessageProtocolType protocol, EditorServiceTransportConfig config)
{
switch (config.TransportType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,18 @@
<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>netstandard2.0</TargetFrameworks>
<AssemblyName>Microsoft.PowerShell.EditorServices.Host</AssemblyName>
</PropertyGroup>

<!--<PropertyGroup>
<WarningsAsErrors>1591,1573,1572</WarningsAsErrors>
<DocumentationFile>bin\$(TargetFramework)\$(Configuration)\Microsoft.PowerShell.EditorServices.xml</DocumentationFile>
</PropertyGroup>-->

<ItemGroup>
<ProjectReference Include="..\PowerShellEditorServices\PowerShellEditorServices.csproj" />
<ProjectReference Include="..\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.PowerShell.SDK">
<Version>6.0.0-alpha13</Version>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
Loading