Migrate From Community Server 2.1 to BlogEngine.Net

by Syed Aziz ur Rahman 31. December 2011 18:51

Recently I need to migrate my blog (http://weblogs.com.pk/aziz)  which was running on Community Server 2.1 to my new blog here which is running on BlogEngine.Net.  I did not have access to code or database as the blog was hosted on a free blogging site. I was unable to find any direct and easy way in the control panel of Community Server therefore I started looking for other options

Now you may or may not have access to code. Therefore I will discuss both options.

How to export if code is accessible:

Keyvan Nayyeri has developed a user control that you can upload, add it to the syndication page and generate BlogML xml of your blogs. Then you can use the import option in the settings of BlogEngine.Net to migrate the data. Check Step 3 below for details about import to BlogEngine.Net. You can find the details about the converter  here. You can also download the code from BlogML codeplex site here. This link also contains other Community Server version utilities, Wordpress export utility and a RSS to BlogML convertor which we will used if we do not have access to our blog codebase.

Here is a screen shot of how it looks like.


How to export if code is NOT accessible:

The technique is to use the Community Server RSS feed to generate BlogML xml using a tool called RSS2BlogML, then change BlogEngine.Net code to fix on bug and then finally use the import option of BlogEngine.Net to migrate data.

 Step 1: Generation of BlogML Xml from RSS feed

Rss2BlogML , courtesy of  Simone Chiaretta,  is a simple tool that downloads RSS feed, comment RSS (if provided), and then convert everything to BlogML format. You can download the exe as well as the source code from here (Check other available download sections). It was only tested to work with .Text and with the core blog module of DNN and was having few problems with Community Server 1.2 RSS dialects. Hence I added the functionality in the original code. You can download the latest code from here which supports Community Server 2.1.

Here is the screen shot of the updated version. Please read the original post to understand how to use the tool.


Step 2: Fix a minor bug in BlogEngine.Net code.

If any of the blog post has comments in the generated BlogML file and the email address is not there, then BlogEngine.Net code will throw exception. Unfortunately Community Server 2.1 may not always provide email associated with comments. If comments in your blog posts have email addresses then you can skip this step.

Open \BlogEngine\DotNetSlave.BusinessLogic\Providers\DbBlogProvider.cs and go to line:2496.  If you have not changed this file earlier, you will see the code below. Otherwise search for method “UpdateComments” and search the code below.

parms.Add(conn.CreateParameter(FormatParamName("email"), comment.Email ));

and change it to

parms.Add(conn.CreateParameter(FormatParamName("email"), (comment.Email == null ? string.Empty : comment.Email.ToString())));

Compile and upload the dll to your hosting.

Import to BlogEngine.Net

  • Login to your BlogEngine.Net control panel.
  • Click on settings and then on Import & Export.
  • Click on the browse and select your BlogML file.
  • Click on import and done.




Tags: , , ,


Powered by BlogEngine.NET
Original Design by Laptop Geek, Adapted by onesoft