The first step is adding the reference to System.Management.Automation.dll to your solution. Although there are many ways to do this Rasik Bihari answered the best way to do it: Thanks Rasik Bihari for the answer.
System.Management.Automation dll is now published as "System.Management.Automation" nuget package here. Just add a reference to this nuget package from visual studio nuget package manager in your project and get going.
It shows like this in your packages.config file once you have installed the above mentioned nuget package in your project:
<?xml version="1.0" encoding="utf-8"?>Once added, you can follow the recipe on how to run PowerShell Script from C#.
<packages>
<package id="System.Management.Automation.dll" version="10.0.10586.0" targetFramework="net452" />
</packages>
No comments:
Post a Comment