AnyoneÂ building a plugin for Alchemy4Tridion is familiar with the repeated steps of: Â Building the project, alt-tabbing to the CME Alchemy page,Â uninstalling the plugin, alt tabbing to your build directory, moving your hand to the mouse, dragging the *.a4t toÂ the plugin window, yaawwwwnnn, ctrl-tabbing to the CME Content Explorer, F5ing the content. After the billionth time ofÂ doing this you yearn for something quicker!
Jan Horsman posted an excellent PowerShell script for uploading *.a4t plugins to Tridion after building them (He’s also improvedÂ theÂ upload scripts used here). The nextÂ step is to get this script running as part of the VS build process.Â The problem here though is that the packaging of the plugin is done after the VS post build action so it’s not as simple as addingÂ the powershell commands to your project’s post build action.
To automate the upload you will need toÂ do a fewÂ things:
Get Jan’s PowerShell Script
SaveÂ Jan’s PowerShell scriptÂ to your project’s root directory (The sameÂ directory in which your *.csproj lives).
Create TheÂ Batch Script
Save this batch script to your project’s root directory.Â Update the values inÂ square bracketsÂ forÂ your environment.
Set PowerShell’s Remote Execution Policy to Unrestricted
Setting the remote execution policy of PowerShell to “Unrestricted” allows you to triggerÂ the PowerShell install script from Visual Studio.Â Open the “WindowÂ PowerShell (x86)” and execute this command:
Modify your project’s *.csproj
Open your project’s *.csproj file and add the following element beneath theÂ <Import> node for theÂ Alchemy4Tridion Plugin around line 94. Gist with the Target element.
Â <Target Name="A4TPostBuildEvents" AfterTargets="Build"> <Exec Command="Install-A4T-Plugin.bat $(OutDir)$(TargetName).a4t" /> </Target>
Build your ProjectÂ and thank the anti-RSI gods!
Thanks to Alex Klock for the helpÂ and pointers on this set up.