I have been using the powershell tools for a while now. Things have been going fine until recently my project’s build events stopped working. I don’t get an error or anything, it’s just that my post-build event no longer runs after a succesful build. Sure enough, I checked the version and it had recently auto-upgraded to 2021.9.1. I suspect that this update broke my build events. any idea how I can get it working again?
Hey @jrizzo - Can you let me know which version of VS you are using? We did have a problem with build events prior to 2021.9.1 but that should have actually fixed them.
If you have in a pinch and would like to roll back, you can download previous versions by clicking the Previous Versions link on our downloads page: Downloads - Ironman Software
You’ll have to uninstall the current version and to install the old one.
As for diagnosing your current configuration, you can take a look at the MSBuild target paths to ensure everything was installed correctly.
Within your PSProj file, you will see this line:
<Import Project="$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets" Condition="Exists('$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets')" />
This should expand to the MSBuild directory that contains the PS targets file. On my machine, using VS 2019 Enterprise, I find that here.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\PowerShell Tools for Visual Studio
You should have some files in the directory. It would be helpful if you could share those. I’m suspecting that the targets file is missing for some reason. If this happened, the build would “run” but wouldn’t output anything. I’ll put an issue in for this. The build should fail if files are missing.
I am using VS 2019 Professional. I found that line in the pssproj file and I can see several files in the location that it points to. There are some dll files, a psm1 file and the .targets file is there as well. then, there is an en-US folder and a Wix folder.