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.