PowerShell 5.0 SDK Reference Assemblies is available in NuGet. If you are building binary modules you can add the references from Visual Studio just by executing the below command in NPM Console
Install-Package Microsoft.PowerShell.5.ReferenceAssemblies -Verbose
In the NPM UI we can get it in one go – By Clicking Install
Cool, its easy to add the reference to our project and start building the binary module easily. When we build cmdlet we need to run and test the functionality and each time we execute it’s necessary to close the PowerShell Console Host or ISE host if the binary module is loaded and we can’t rebuild the solution. It will end up in Dll in use error. We can easily over come this by following the below steps.
- Right Click the Solution from Solution Explorer.
- Choose Properties and in the Right Pane Select Debug
- Click Select External Program. Navigate to “C:\Windows\System32\WindowsPowerShell\v1.0\”.
- Select PowerShell.exe
- Select the option Enable native code debugging
-NoExit -Command "Import-Module .\PowerShellDemo.dll"