Friday, August 24, 2018

super painful to try to run PowerShell scripts form C# on Windows 7

At: Tools > NuGet Package Manager > Manage NuGet Packages for Solution... ...in Visual Studio 2017, I searched for "System.Management.Automation" and referenced a .dll in the NuGet package pulled down only to see this error:

Could not load file or assembly 'System.Management.Automation' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

 
 

I get the impression that I do not have something I can't install on my work laptop. That's preventing me from doing something like:

using (PowerShell PowerShellInstance = PowerShell.Create())
{

 
 

...in code which should be legit per this. I had hoped to run a script like this one, but I am talking myself out of that now and betting that it is better to just tackle the problem from the C# side like this.

No comments:

Post a Comment