diff --git a/debug.sh b/debug.sh index 57b09b66c8..6699d0dbdd 100755 --- a/debug.sh +++ b/debug.sh @@ -1,2 +1 @@ -export CORE_ROOT=$(pwd)/bin -lldb-3.6 -o "plugin load ./bin/libsosplugin.so" -- ./powershell $@ +lldb-3.6 -o "plugin load ./bin/libsosplugin.so" -- ./bin/Microsoft.PowerShell.Linux.Host $@ diff --git a/pester.sh b/pester.sh index 6e7102f388..78db7d2daa 100755 --- a/pester.sh +++ b/pester.sh @@ -1,5 +1,4 @@ -export CORE_ROOT=$(pwd)/bin -./powershell -c "Invoke-Pester src/pester-tests/$1 -OutputFile pester-tests.xml -OutputFormat NUnitXml" +./bin/Microsoft.PowerShell.Linux.Host -c "Invoke-Pester src/pester-tests/$1 -OutputFile pester-tests.xml -OutputFormat NUnitXml" # XML files are not executable chmod -x pester-tests.xml # Fix tty due to possible bug in .NET diff --git a/powershell b/powershell deleted file mode 120000 index 3efba138a3..0000000000 --- a/powershell +++ /dev/null @@ -1 +0,0 @@ -src/monad-native/host/powershell \ No newline at end of file diff --git a/run.sh b/run.sh index 597a39195b..05ac417c29 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,3 @@ -export CORE_ROOT=$(pwd)/bin -./powershell $@ +./bin/Microsoft.PowerShell.Linux.Host $@ # Fix tty due to possible bug in .NET stty echo diff --git a/src/Microsoft.PowerShell.Linux.Host/main.cs b/src/Microsoft.PowerShell.Linux.Host/main.cs index e79a0ccc48..77a56ac777 100644 --- a/src/Microsoft.PowerShell.Linux.Host/main.cs +++ b/src/Microsoft.PowerShell.Linux.Host/main.cs @@ -18,6 +18,12 @@ namespace Microsoft.PowerShell.Linux.Host /// public static void Main(string[] args) { + // Setup the Assembly Load Context, which Core PowerShell uses to + // analyze the libraries for types, functions, cmdlets, etc. and + // provide the ability to load assemblies by file path. Doing this + // here eliminates the need for a custom native host. + PowerShellAssemblyLoadContextInitializer.SetPowerShellAssemblyLoadContext(AppContext.BaseDirectory); + // Custom argument parsing string initialScript = null; if (args.Length > 0)