The questions is: How to setup my Visual Studio in order to debug CmdLet during development.
We will use Visual Studio 2013 for this. All setup is in project properties.
If we are creating PSSnapin we can add following line in Build Events - Post-build event command line
C:\windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "$(TargetDir)$(TargetFileName)"
and in Debug - Start Action - Start external program
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
and in Start Options - Command line arguments
-noexit -command add-pssnapin SnapinName
This setup will automatically install snapin and load it into workspace when we hit F5.
If we are developing module we don't need Post-build event setup and we need to change Start-Options Command line arguments to
-noexit -command import-module ModulePath
We will use Visual Studio 2013 for this. All setup is in project properties.
If we are creating PSSnapin we can add following line in Build Events - Post-build event command line
C:\windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "$(TargetDir)$(TargetFileName)"
and in Debug - Start Action - Start external program
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
and in Start Options - Command line arguments
-noexit -command add-pssnapin SnapinName
This setup will automatically install snapin and load it into workspace when we hit F5.
If we are developing module we don't need Post-build event setup and we need to change Start-Options Command line arguments to
-noexit -command import-module ModulePath
No comments:
Post a Comment