+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Installing the Template Importer module in Sitefinity

by Grigori Karanikolov
Recently I’ve been receiving requests for help with the installation of the Template Importer module included in the Sitefinity SDK into an existing Sitefinity project. I’ve decided to create a blog post and a  video to record the whole process.

Generally, the steps that I will list below could be followed to attach any module from the SDK to an existing Sitefinity project.

In some cases there is an additional step (including SampleUtilities as an additional project to your solution), but you’ll most probably get this as a prerequisite in the description of the module in the SDK.

So here is what I’m doing in this video:

  1. Start the SDK browser;
  2. Extract the Template Importer project in a folder (it’s going to extract a Sitefinity web application as well, therefore the SDK will prompt you to insert a valid license – trial or commercial);
  3. Copy the extracted TemplateImporter project from the folder we just created to the Projects folder your project manager is creating your Sitefinity websites in;
  4. Open your current Sitefinity project with Visual Studio
  5. Add the template importer as an existing project to the current solution;
  6. Next we have to do some reference substitution. Currently the Template importer contains some dll-s, which are referenced from a source we won’t use anymore. We need to remove them and reference the same dll’s from our project we are plugging in the template importer into. Delete these references:
    1. Telerik.OpenAccess
    2. Telerik.OpenAccess.Runtime
    3. Telerik.OpenAccess.Web
    4. Telerik.Sitefinity
    5. Telerik.Sitefinity.Model
    6. Telerik.Sitefinity.Utilities
    7. Telerik.Web.UI Now “Add References” to the template importer, browsing through the bin folder in your Sitefinity project and choosing the same dll files from there.
    8. Add a reference to the TemplateImporter project from your Sitefinity project. This way a TemplateImporter.dll will appear in the bin folder of your Sitefinity project.
    9. Build your project.

It is possible at this point to run into a couple of exceptions if you are using an older version of the Sitefinity SDK with a newer version of Sitefinity. I will address these at the end of this blog post.

  1. Go to the administrative backend of Sitefinity ->Administration->Settings->Advanced->System->ApplicationModules -> Create new
  2. Fill in the fields like this:
    1. Name: TemplateImporter.TemplateImporterModule
    2. Title: TemplateImporterModule
    3. Description: TemplateImporterModule
    4. Global resource class ID: TemplateImporter.Localization.TemplateImporterResources
    5. Type: TemplateImporter.TemplateImporterModule
    6. StartupType: OnApplicationStart
    7. Save your changes and restart your application or recycle your application pool. At this point the template importer should appear under the Design section and should be ready for use!

N.B. Possible issues that could come up:

  1. During compilation, you might get this error: 'Telerik.Sitefinity.Modules.Libraries.MediaContentExtensions.Images(Telerik.Sitefinity.Libraries.Model.Album)' is a 'method', which is not valid in the given context                in the file TemplateImporter.cs in this line:
  2. var image = album.Images.Where(i => i.Title == Path.GetFileName(imageName) && i.Status == ContentLifecycleStatus.Live).FirstOrDefault();

    The problem is derived from the fact that Images is no longer a member, but a method, so you should add brackets (), like this:

    var image = album.Images().Where(i => i.Title == Path.GetFileName(imageName) && i.Status == ContentLifecycleStatus.Live).FirstOrDefault();

     

  3. When running the Template Importer, you might stumble on a “Wrong Reference Version” error in this file : TemplateImporterControl.ascx If so, open it in your Visual Studio, and locate this line:
  4. <%@ Register Assembly="Telerik.Web.UI, Version=2012.1.215.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    Remove the Version information, like this:

    <%@ Register Assembly="Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


Now build your application. That should do it!

1 comment

Leave a comment
  1. mansooe Aug 14, 2013
    As per above steps , i have tried to add SDK "template importer"  into my sitefinity project solution , then i got error messages in visual studio.

    Error 1 The type or namespace name 'Cloud' does not exist in the namespace 'Telerik.Sitefinity' (are you missing an assembly reference?) C:\Program Files\Telerik\Sitefinity 6.1\Projects\Project3\AzureWebRole.cs 1 26 SitefinityWebApp


    Error 2 The type or namespace name 'AzureWebRoleBase' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Telerik\Sitefinity 6.1\Projects\Project3\AzureWebRole.cs 12 33 SitefinityWebApp

    -mansoor

    Leave a comment