diff --git a/.spelling b/.spelling
index 8428d878a9..728e7bdfae 100644
--- a/.spelling
+++ b/.spelling
@@ -832,4 +832,7 @@ CorePsAssemblyLoadContext.cs
sample-dotnet1
NTLM-based
Kerberos-based
+preview1-002106-00
+sample-dotnet2
+0-powershell
post-6
diff --git a/docs/host-powershell/README.md b/docs/host-powershell/README.md
index d7dd6b55ed..e90f4cbfa5 100644
--- a/docs/host-powershell/README.md
+++ b/docs/host-powershell/README.md
@@ -2,6 +2,13 @@
> This documentation is based on PowerShell Core packages built against .NET Core 1.1 and prior.
> Things may change after we move to .NET Core 2.0.
+>
+> **Note** PowerShell v6.0.0-beta.1 has been released, which is on top of .NET Core 2.0 ([preview1-002106-00][netcoreapp20-preview1]).
+> The existing design of `PowerShell AssemblyLoadContext` is not changed in `beta.1` release,
+> so the way to host PowerShell `beta.1` is the same as before from the C# code perspective.
+> However, you will need the 2.0 preview version of .NET Core SDK (the version `2.0.0-preview1-005952` is currently used to build PowerShell Core),
+> and the `.csproj` file will need to be updated.
+> A .NET Core 2.0 version of the sample application project `"MyApp"` can be found under [sample-dotnet2.0-powershell.beta.1](./sample-dotnet2.0-powershell.beta.1) for your reference.
## PowerShell Core targeting .NET Core 1.1 and Prior
@@ -153,6 +160,7 @@ PowerShell Core builds separately for Windows and Unix, so the assemblies are di
Unfortunately, all PowerShell NuGet packages that have been published so far only contain PowerShell assemblies built specifically for Windows.
The issue [#3417](https://github.com/PowerShell/PowerShell/issues/3417) was opened to track publishing PowerShell NuGet packages for Unix platforms.
+[netcoreapp20-preview1]: https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NETCore.App/2.0.0-preview1-002106-00
[CorePsAssemblyLoadContext.cs]: https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs
[Resolving]: https://github.com/dotnet/corefx/blob/ec2a6190efa743ab600317f44d757433e44e859b/src/System.Runtime.Loader/ref/System.Runtime.Loader.cs#L35
[bootstrapping]: https://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cs#L27
\ No newline at end of file
diff --git a/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/Logic.csproj b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/Logic.csproj
new file mode 100644
index 0000000000..0d32ce0bbf
--- /dev/null
+++ b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/Logic.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netcoreapp2.0
+ Logic
+ win10-x64
+
+
+
+
+
+
+
+
+
diff --git a/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/UseRunspace.cs b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/UseRunspace.cs
new file mode 100644
index 0000000000..b13a08c244
--- /dev/null
+++ b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/Logic/UseRunspace.cs
@@ -0,0 +1,35 @@
+/********************************************************************++
+Copyright (c) Microsoft Corporation. All rights reserved.
+--********************************************************************/
+using System;
+using System.Management.Automation;
+using System.Management.Automation.Runspaces;
+
+namespace Application.Test
+{
+ public sealed class Logic
+ {
+ ///
+ /// Start the actual logic
+ ///
+ public static int Start(string[] args)
+ {
+ using (PowerShell ps = PowerShell.Create())
+ {
+ Console.WriteLine("\nEvaluating 'Get-Command Write-Output' in PS Core Runspace\n");
+ var results = ps.AddScript("Get-Command Write-Output").Invoke();
+ Console.WriteLine(results[0].ToString());
+
+ ps.Commands.Clear();
+
+ Console.WriteLine("\nEvaluating '([S.M.A.ActionPreference], [S.M.A.AliasAttribute]).FullName' in PS Core Runspace\n");
+ results = ps.AddScript("([System.Management.Automation.ActionPreference], [System.Management.Automation.AliasAttribute]).FullName").Invoke();
+ foreach (dynamic result in results)
+ {
+ Console.WriteLine(result.ToString());
+ }
+ }
+ return 0;
+ }
+ }
+}
diff --git a/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/MyApp.csproj b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/MyApp.csproj
new file mode 100644
index 0000000000..6bdba82519
--- /dev/null
+++ b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/MyApp.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netcoreapp2.0
+ MyApp
+ Exe
+ win10-x64
+
+
+
+
+
+
+
+
diff --git a/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/Program.cs b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/Program.cs
new file mode 100644
index 0000000000..f0fa6b5fed
--- /dev/null
+++ b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/MyApp/Program.cs
@@ -0,0 +1,32 @@
+/********************************************************************++
+Copyright (c) Microsoft Corporation. All rights reserved.
+--********************************************************************/
+
+using System.Management.Automation;
+using System.Reflection;
+
+namespace Application.Test
+{
+ public class Program
+ {
+ ///
+ /// Managed entry point shim, which starts the actual program
+ ///
+ public static int Main(string[] args)
+ {
+ // Application needs to use PowerShell AssemblyLoadContext if it needs to create powershell runspace
+ // PowerShell engine depends on PS ALC to provide the necessary assembly loading/searching support that is missing from .NET Core
+ string appBase = System.IO.Path.GetDirectoryName(typeof(Program).GetTypeInfo().Assembly.Location);
+ System.Console.WriteLine("\nappBase: {0}", appBase);
+
+ // Initialize the PS ALC and let it load 'Logic.dll' and start the execution
+ return (int)PowerShellAssemblyLoadContextInitializer.
+ InitializeAndCallEntryMethod(
+ appBase,
+ new AssemblyName("Logic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"),
+ "Application.Test.Logic",
+ "Start",
+ new object[] { args });
+ }
+ }
+}
diff --git a/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/NuGet.config b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/NuGet.config
new file mode 100644
index 0000000000..58f8d2c9b6
--- /dev/null
+++ b/docs/host-powershell/sample-dotnet2.0-powershell.beta.1/NuGet.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+