Developing on Community Server

Community Server

Group for Content about my AlexCrome.CS addon package for Community Server 2008

Developing on Community Server

  • Comments 10

 When you come to developing on top of Community Server, you’ve first got to decide whether or not you should use the SDK (which you probably shouldn’t).  You’ve then got to set up your initial project so you can best take advantage of Community Server.  This blog post will guide you through deciding (hopefully against) using the SDK and setting up Community Server to develop on top of it.

What is the SDK

To all intents and purposes the SDK is the source code for core of Community Server – that is it includes the source for the various CS applications (forums, blogs, etc.), controls and components.  It does not however include source code for the Enterprise Addons (e.g. Single Sign On, Mail Gateway), nor the Telligent assemblies. 

Why should I avoid the SDK like the plague?

Maybe I'm being a little over the top here, but I strongly reccomend you don't use the SDK for a live project.  By all means have a copy of the SDK to hand for reference purposes, but please avoid using the SDK when you don't need to.  There are a number of reasons for this

  • If you build directly on the SDK, every time you build your project you'll need to build the whole CS solution which takes time.  Whilst one build doesn’t take that long – maybe 10 seconds to a minute depending on your machine,that time adds up over the course of a day.
  • With the SDK in front of you, you're tempted to modify the core Community Server source code (or accidently make changes).  Doing this has two problems
    1. If you encounter a bug, it's difficult to determine whether there's an underlying issue in Community Server, or the issue is with your changes.
    2. When it comes to upgrading you need to make sure copying the source files doesn't overwrite the changes you've made so you need to spend a lot of time carefully reviewing changes made in the newer version to ensure you don't lose any of your customisations.

Generally there is no reason to need to touch the SDK.  It only causes issues later down the lines (see above).  It is very easy to plug into the Community Server Pipeline when you need to extend it (such as CSModules, custom Data Providers and subclassing existing controls) and custom features can be built in seperate projects and then referenced from within your Community Server theme.  If you are not sure of how you can achieve your goal without modifying the SDK, pose the question to some other developers on the Community Server forums.

 

Building on Community Server without using the SDK

Now youv'e decided against usign the SDK (If you haven't , I reccomend you read my warnings again and make very sure you can't do this without the SDK) it's time to set up Visual Studio to build on top of Community Server.  Before I detail how to do this, I must thank John Bledsoe of ATGi (A Community Server Partner) for introducing me to this set up.  This is simply step by step instructions on how to use John's technique.

  1. If you don't already have a copy of Visual Studio, download and install Visual Studio Web Developer Express 2008 SP1.   (N.B. if you have a copy of Visual Studio Web Developer Express 2005, or 2008 without SP1, you will need to either upgrade to 2008 SP1 or a full version of Visual Studio in order to use this set up).  If you don't have a copy of SQL Server, you will likely want to install that so you can run Community Server on your computer.  (Unlike Visual Studio Web Developer Express 2005, SQL Server Express 2005 is suitable for this purpose).
  2. Open Visual Studio and go to file > new project and create a new "ASP.Net Web Application"
    image
  3. To your Web Application Project, add a class library project - this will be where you write any custom controls and / or code for your website.  Depending on what you're doing, you may prefer to make a number of class library projects to better separate your custom extensions.
    image
  4. Delete the existing files within the project
    image
  5. Download the latest Community Server Web Installer from http://get.communityserver.com/download/, and paste the contents of the /web/ folder (apart from the /bin/ folder) of the Web Installer into your web project.  (I suggest here you paste into the web project through Visual Studio rather than Windows Explorer)
  6. In Windows Explorer, open the location where you've created your two projects and add a new folder "References"
    image
  7. Into this References folder, copy the contents of /web/bin/ in the Web Installer download.
    image
  8. Now back in visual studio, right click the References folder in the Web Project, and select Add Reference
    image 
    In the Add References Window that opens, select the Browse tab, navigate to the References folder, add references to all the files in this folder (n.b. you don't have to add them one by one, you can select all the files in one go and click OK)
    image
  9. Now open the Add References Window again, and click on the Projects Tab.  Add a reference to the class library project(s) you created.   
    image

image

You have now completed setting up the project in which to extend Community Server without modifying the core code.  All your custom code can go into the class library project(s) you created, and you can use the SDK as a reference for any custom controls or extension you do.  Before you can start using your Community Server site, you will need to build the solution, and then run the web installer to set up the Community Server database.

At this point you may also wish to consider checking your project into a Source Control system so you can keep track of changes made.

 

 

Building on Community Server with the SDK

If you’ve got this far, you’ve ignored all my warnings about avoiding the SDK wherever you can.  For one last time I plea that do evaluate exactly what you want to achieve and whether it can be done without touching the SDK.

I've tried my best to disuade you from using the SDK, however if I've been unsuccessful, I might as well give you some advise on using the SDK.

  • Properly set your project up in source control – Whilst I would suggest that you always check your project into source control, regardless of whether you use the SDK or not, the importance of source control skyrockets when building directly with the SDK.  When it comes to upgrading, if you set your project up properly in source control you can automate a lot of the merge process.  For an idea of the process you’ll need to go through when upgrading CS with the SDK take a look at another blog post by John Bledsoe on Upgrading Community Server.  That post should also give you an idea of how to set your project up in source control.
  • Keep changes to the core SDK to a minimum – You’ve seen all the reasons above for why you should avoid the SDK.  The more you modify the SDK, the harder you make your life.  If you are adding significant new functionality which requires modification of the core code base, always think of whether some of the functionality can be moved into a separate project, and then just add pointerst into the SDK pointing to your custom code.

 

Using Community Server with the Visual Studio Web Server

The CFS (Centralised File System) is not compatible with the Visual Studio Web Server.  Community Server will work find on the Visual Studio Web server, however any uploaded content (e.g. user avatars, media gallery posts etc.) will not work.  To work around this issue, you should do your testing on IIS where possible.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post
  • Thanks for the references Alex. Now that I'm done teaching the "Mastering Community Server" class (as of about 30 minutes ago) I'll probably have some more time to blog again and answer questions on the CS forums.
  • Hi Alex,

    Thanks for the tips, but how to integrate with existing Community server installation?if we run the web installer it wont overide existing installation?

    Thanks

  • @Anand if you already have a database, you just need to modify the connectionstrings to point to your existign database.

  • Thanks for the reply Alex. is that mean we can just replace the compiled dll to existing site's bin directory without changing any other files? (Im new to .net)

  • The whole point of this way of setting up your CS development environment is that you don't replace the compiled dlls Telligent provide.  All your custom code goes in a seperate dll in the /bin/ directory.  If you set it up as I did above, it would be CSExtensions.dll

  • Hi Alex,

    Do you have instructions for how to do this for Telligent Community 5 yet? as It doesn't seemt to work. I get his error after following the steps above and bulding and running in vs2008:

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Exception has been thrown by the target of an invocation.

    Source Error:

    Line 110: <providers>

    Line 111: <clear/>

    Line 112: <add name="CommunityServerSqlProvider" type="CommunityServer.AspNetMemberRole.CSRoleProvider, CommunityServer.AspNetMemberRole" connectionStringName="SiteSqlServer" applicationName="dev" description="Stores and retrieves roles data from the local Microsoft SQL Server database"/>

    Line 113: </providers>

    Line 114: </roleManager>

    Source File: C:\Users\aseabridge\Documents\Visual Studio 2008\Projects\TelligentCommunity5.0\web.config    Line: 112

    Thanks in advance for the help.

    Adam

  • These instructions work perfectly for me on Telligent Community 5 - this is the method I used for this very website.

  • Nice work!

  • Nice, it's almost exactly the same as I've used - the only difference is that since most custom code tends to be shared amongst all websites from the same client, I create my class libraries in \Client1\Shared (next to \Client1\Website1, Client1\Website2, etc), and put a Lib folder inside Shared which contains the assemblies. As long as all the sites use the same version of TC, it works great.

  • Thanks Alex. It is helpful for me.

Page 1 of 1 (10 items)
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post