ea5d5c3d05
Instead of using `dotnet publish`, we can use `dotnet build` and the new `netcoreapp1.0` framework with a new dependency on `Microsoft.NETCore.App` to generate output that does not include the runtime, but can be run anywhere (given the installation of the runtime). While we cannot yet adopt a dependency on the shared host until .NET Core RTM, we are forced to switch to this system anyway because the latest RC3 packages and CLI do not support `netstandardapp1.5`. See dotnet/cli#2482. Thus we're in an in-between state where we have to use `netcoreapp1.0`, but cannot use `"Microsoft.NETCore.App": { "type": "platform" }` to utilize the shared host, as we need to continue to ship our host. Without specifying "platform", we retain the status quo with respect to build steps and outputs. Additionally, there is no longer a good reason to use the RC3 packages, and it has been advised we switch to RC2 since the `Microsoft.NETCore.App` is only available for RC2. We must update packages because our current version can no longer be debugged. |
||
---|---|---|
.. | ||
fixture_AssemblyLoadContext.cs | ||
project.json | ||
README.md | ||
test_Binders.cs | ||
test_CorePsExtensions.cs | ||
test_CorePsPlatform.cs | ||
test_ExtensionMethods.cs | ||
test_FileSystemProvider.cs | ||
test_MshSnapinInfo.cs | ||
test_PSVersionInfo.cs | ||
test_Runspace.cs | ||
test_SecuritySupport.cs | ||
test_SessionState.cs | ||
test_Utils.cs |
xUnit Tests
These tests are completely Linux specific.
Every test class must belong to
[Collection("AssemblyLoadContext")]
. This ensures that PowerShell's
AssemblyLoadContext is initialized before any other code is executed.
When this is not the case, late initialization fails with
System.InvalidOperationException : Binding model is already locked for the AppDomain and cannot be reset.
Having every class in the same collection is as close to an xUnit global init hook as can be done.
Running xUnit Tests
Go to the top level of the PowerShell repository and run:
Start-PSxUnit
inside a self-hosted copy of PowerShell.