Wednesday, March 22, 2006

SharePoint and .Net 2.0

I ran into a couple of problems with Sharepoint and the 2.0 Framework the other day. None of the custom web parts I have written were working properly. in fact they wern't working at all. In the past i did all of my testing with the 2.0 Framework on a Virtual Sharepoint server, which just had a default install of Sharepoint. Our corporate Intranet is very heavily customised and includes several custom web parts [server controls actually] (written by yours truely) that were added to the template files. The biggest offender was my "TopNav" control (which renders a dynamic drop down, tabbed control based on the portal layout of the site). The TopNav was killing the portal. This didnt surprise me overmuch since its one of the more complex controls.
With the TopNav removed, the portal would render, but every other control spit out a "Object not set to an instance of an Object" error. So far, the only way I have seen to get around this is to open the projects in VS 2005 and re-compile the projects. This of course up-sizes the code to 2.0. Thats not really a bad thing, but then you are committing yourself to 2.0 at that point. Well, I guess you already did that when you installed the framework on your server. Oh well.

Tuesday, March 14, 2006

HOWTO: Install a .Net 2.0 WebPart in Sharepoint 2003

Yes, you too can write all your web parts in VS 2005 and host them on your existing Sharepoint 2003 install. Its kind of tricky thou so I'll try and explain the steps.

1. Download and install "Son of SmartPart" from here

2. Follow the installation Guide included in the ZIP file you just downloaded.

3. **IMPORTANT** You MUST change the root web site to run as ASP.Net 2.0xx. If you do not do this your site will not function properly.

3a. Also, you need to make the Web.Config changes found here or your hosed. Dont run the stsadm command like the article, it won't work (or it didn't for me anyway). Just make the changes that it says the command will make.

4. Remember to add your user control to the UserControls folder and the assembly for it to the BIN folder.

5. Done! Thats it, you can now run a User Control developed in .Net 2.0 Framework on your Sharepoint 2003 portal.

Enjoy!