How do I debug a Windows PowerShell module in Visual Studio?

后端 未结 2 885
一向
一向 2021-02-05 20:07

I\'m trying to write a PowerShell module as a VB.NET project with Visual Studio 2015. I\'ve been able to put a few commands together, compile the class library into a DLL, impo

2条回答
  •  情书的邮戳
    2021-02-05 20:54

    It's possible to debug your cmdlet directly without needing a separate project. Open the properties of your class library project and configure the Debug tab as follows (assuming Windows is installed to C:):

    • Start Action
      • Start external program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • Start Options
      • Command line arguments: -NoLogo -Command "Import-Module '.\MyModule.dll'; Get-TestCommand;"

提交回复
热议问题