Wednesday, 2 July 2014

How to install EPiServer Add-Ons as part of the MSBuild process

If you're developing EPiServer 7 Add-Ons, you'll most likely want the ability to test them in a test site during development and debug them too.

One way to get this happening is to have your Add-Ons as seperate projects in the same solution as your test site. Then as part of the build script for each Add-On, install the Add-On into the target site.

The goal of this post is to show you how to do that.

It assumes you have setup your development environment as per my previous post XXX.

  1. Unload the Add-On project so you can edit the .csproj file
  2. Add the following 'AfterBuild' Target element:
    • NOTE: The above is for a PROTECTED Add-On. 
    • If you're installing a PUBLIC Add-On you'll need to set the DestinationFolder to: $(DevelopmentSitePath)\modules\$(AddOnName)\Views\%(RecursiveDir)

  3. Reload the project and build it in Release mode (just need to do Release mode once in order to create the NuGet package and have it added to the EPiServer Modules repository)
  4. If this is the first Add-On installed in your target site, you'll need to do a couple extra things:

    1. Create a new folder called 'ModulesRepository' in '\App_Data'
    2. Add a file called 'repositories.config' to the 'ModulesRepository' and put the following in it:
    3. Add a file called 'packages.config' to '\modules\_protected' and put the following in it:

  5. Amend the '\modules\_protected\packages.config' file and add a new 'package' element with the details of your Add-On.
    e.g.   <package id="AwesomeWidget" version="" />
    • This is necessary in order to have your package show up in the list of the 'Installed Add-Ons' in the EPiServer GUI - which is handy if/when you want to Uninstall the package via the GUI.

No comments:

Post a Comment