forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (29 loc) · 1.44 KB
/
Copy pathProgram.cs
File metadata and controls
32 lines (29 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System.Management.Automation;
using System.Reflection;
namespace Application.Test
{
public class Program
{
/// <summary>
/// Managed entry point shim, which starts the actual program
/// </summary>
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 });
}
}
}