AddIn Post-Build Event v2


When building add-ins it's helpful to copy the compiled DLLs to the RightNow dev mode folder so that they're ready for development testing. If you then automatically create ZIPs of the output then you're ready for production deployment without any additional effort. (This is assuming you publish your add-ins as ZIPs and not DLLs.)

There is a problem though, Windows historically hasn’t had any way to create a ZIP from the command prompt. To get around this I created a little app called ZipTheseFiles that does pretty much what it sounds like. The problem with it is that you have to have the exe on your machine otherwise the build fails. This is massively confusing for other resources who are trying to build and deploy updates.

With Windows 10 (and probably 8) you can now run PowerShell commands from within a standard command shell. This removes the need to have a secondary app and results in code that can easily be distributed to other resources. Simply put the following commands into your project’s Post-Build event and the Add-In files will be exported and then zipped.

mkdir "%USERPROFILE%\RightNowDev"
mkdir "%USERPROFILE%\RightNowDev\AddIns"
mkdir "%USERPROFILE%\RightNowDev\AddIns\$(TargetName)"
xcopy "$(TargetDir)$(TargetName).*" "%USERPROFILE%\RightNowDev\AddIns\$(TargetName)\" /S /Y

powershell -command "Compress-Archive -Path '%USERPROFILE%\RightNowDev\AddIns\$(TargetName)\*' -DestinationPath '%USERPROFILE%\RightNowDev\AddIns\$(TargetName).zip' -Force"

If you have other files required by your project you may need to include additional xcopy lines, but the process to compress them will remain unchanged.

Zircon - This is a contributing Drupal Theme
Design by WeebPal.