2

We're working on custom module (Information Management System) for SharePoint. The project file of this module is a Class Library which contains User Controls. The User Controls was based upon Smart Part and AJAX Extension Toolkit. The module has a separate database which has tables/views/stored procedure.

On development environment, we deploy the module in following steps:

  • Restore the backup copy of the module database on the pre-production or test environment
  • Install AJAX Extension Toolkit
  • Modify web.config of web application for connection string, safecontrol entry of AJAX Extension, enablesessionstate set to true of pages, add AJAX Extension tag entry, and uncomment the following line:

    <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

  • Create a UserControls folder in web application root and copy all User Controls there. As Smart Part will (can only, I assume) locate User Controls

This is how we do. I'm sure, this is not a good practice and there should be ways to do this in much better way.

One of my question is can we create a separate web.config file which will have all required tags and settings there so we won't need to change web application web.config? Just guessing!

As all WSPBuilder users are aware of this, that you cannot modify the manifest.xml file and no good integration with web application folder. I don't why Smart Part pick the web application root folder to locate User Controls. Is it possible that Smart Part can start picking User Controls from 12-Hive's TEMPLATE\CONTROLTEMPLATES folder?

We are looking for a more appropriate way of doing this. And for me, specific to this case, a good practice would be eliminate all the manual configuration/setup steps. The module user doesn't even need to do a single manual setup to make this thing up and running. I am sure there are many ways of doing this much better than this but what would be the best way to handle it.

Also, I would like to have suggestions on Custom Module development on SharePoint good (or best) practices.

We are using a set of tools like WSPBuilder, Visual Studio Extension for WSS, STSDEV, SPVisualDev, SharePoint Content Deployment Wizard, SharePoint Administration Tools, SharePoint Installer.

2 Answers 2

1

I havent worked alot with smartpart, but i think you can set the path for the user control in the webpart xml manifest. Also since the code is on codeplex, you should be able to create your own version of the smartpart that suits your needs. On a related note read Eli Robillard's blog post on pros/cons with smartpart here.

Regarding web.config changes these should if at all possible be handled automatically. You can use SPWebConfigModification class to deploy web.config modifications consistently across both environments and web frontend servers. This class can be very tricky and unforgiving, so i recommend that you never apply more than one modification at the time (if you deploy using batch or powershell collect all web.config modifications in one bulk update). Also read up on the pitfalls of this class here, here and here (note some of the pitfalls mentioned was solved in SP2). Setting up Ajax in web.config should definately also be done using this technique.

From reading your question i cant really tell if you are using solutions and features for deployment. If not, this is very much a best practice for consistent deployment.

1
  • The source of SmartPart available on codeplex is for 1.1 not for Return of SmartPart which is updated. Right?
    – Anonymous
    Commented Feb 17, 2010 at 9:03
0

I have never used smart part myself. However, I use the VseWss 1.3 tools and can create my own webparts just fine. I can also put my .ascx files in a subfolder of the controltemplates folder. I have created several webparts this way. The .ascx file contains the html and controls and the class file does all the work. There are examples on the internet on using VseWss to create webparts. This also allows me to use solutions and features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.