Closed youcefnb closed 4 years ago
@findyoucef This is just a reference library. It's intended mainly for binary modules as PowerShell's real assemblies will already be loaded into the process.
If you're looking to host PowerShell in an netcoreapp application, you'll need to reference Microsoft.PowerShell.SDK instead.
@findyoucef This is just a reference library. It's intended mainly for binary modules as PowerShell's real assemblies will already be loaded into the process.
If you're looking to host PowerShell in an netcoreapp application, you'll need to reference Microsoft.PowerShell.SDK instead.
Thanks for the reply. I'm building a .netstandard library that needs to have some powershell functionality. I need the library to be .netstandard because I need to be able to leverage with .netcore, and .netframework 4.7.2, but Microsoft.PowerShell.SDK doesn't support .netstandard
Though I'm still confused about why this code works in in .net 4.7.2, but not .netcore??
Thanks for your help
Youcef
Thanks for the reply. I'm building a .netstandard library that needs to have some powershell functionality. I need the library to be .netstandard because I need to be able to leverage with .netcore, and .netframework 4.7.2, but Microsoft.PowerShell.SDK doesn't support .netstandard
How are you testing the library? What do you expect it to be loaded in? If you're loading it outside of a PowerShell process (or anything that already has the PowerShell assemblies loaded) then you'll get an empty implementation. If you look at the source in this repo, all of the implementations look like public string PropertyName => default
.
Though I'm still confused about why this code works in in .net 4.7.2, but not .netcore??
In 4.7.2 it's probably pulling from the GAC instead of the assembly you're shipping with. Core doesn't look in the GAC, so it's loading the reference library instead.
Thanks for the reply. I'm building a .netstandard library that needs to have some powershell functionality. I need the library to be .netstandard because I need to be able to leverage with .netcore, and .netframework 4.7.2, but Microsoft.PowerShell.SDK doesn't support .netstandard
How are you testing the library? What do you expect it to be loaded in? If you're loading it outside of a PowerShell process (or anything that already has the PowerShell assemblies loaded) then you'll get an empty implementation. If you look at the source in this repo, all of the implementations look like
public string PropertyName => default
.Though I'm still confused about why this code works in in .net 4.7.2, but not .netcore??
In 4.7.2 it's probably pulling from the GAC instead of the assembly you're shipping with. Core doesn't look in the GAC, so it's loading the reference library instead.
Thanks! This helped. I got everything up and running.
give PSCredential a username and secure string via "PSCredential creds = new PSCredential("username",secureString);" is not working. When the code runs, the object that is returned shows the username and password as nulls. This is not a problem when running this code in .net 4.7.2. This issue is present with .netcore and maybe .netstandard.
You can reproduce this issue with the following code. Please run in .netcore.