So we can include an install/uninstall powershell scripts in a NuGet package. I tried, but my install.ps1 does not work. Is there any possibility to find out why? Debugging,
You might call Start-Transcript
at the beginning of install script and Stop-Transcript
at the end. You would probably wrap the install code like this:
try {
$ErrorActionPreference = 'stop' # stop on error
Start-Transcript c:\a.txt
...
}
catch {
write-host $_
}
finally {
Stop-Transcript
}
Also $ErrorActionPreference = 'inquire'
(instead of stop) could possibly work. However, no chance to try it now. See http://tasteofpowershell.blogspot.com/2008/07/handling-errors-in-powershell.html