Monday, 4 March 2013

The geek that I am ...

Just in case you were wondering ... if you try to put  <david></david> in your blog title, it's not going to work. To fix that just put in the HTML equivalent :) i.e. & g t ; and  & l t ;

Also, if you planned to post XML in your blog, think again,  you'll have to switch to HTML and replace all your less thans and greater thans to their HTML equivalents. I find it strange that in my 3 year absence, blogger has changed very very little!

So that's my first real return blog :)

Guess who's back?

Hello there, it's been awhile. A while back I had changed jobs and never actually updated this blog any longer. Going to repurpose this blog to my current tech interests, i.e. web security, product management, android stuff and whatever the heck else I stumble upon ...

Tuesday, 24 November 2009

Debugging SmartPart User Controls

Ok, so you are faced with this situation

1. You are using SmartPart because its easier for your .NET developers to write UserControls, rather than WebParts (thank god for SharePoint 2010 where developing webparts will be easier at last).

2. Using SharePoint functions such as using SPContext and local debugging (i.e. using a normal web application for testing rather than SharePoint) present a headache, since the context is not available when you are debugging locally.

3. You need the best of both worlds, i.e. easy and quick debugging, but using SmartPart and user controls.

Here's the way to do it:

1. Create post build events which copy your User Control dll to the SharePoint folder, and your user controls to the UserControls folder

e.g. copy c:\develpment\xxx.dll c:\inetpub\wwwroot\80\wss\...



2. On the Web Application project properties, rather than using the Visual Studio web server for debugging, use the IIS webserver and specify the web application where your user controls are getting deployed.




3. Press F5 and voila, your dlls, and User Controls files are copied to SharePoint, and SharePoint is loaded and attached to the debugger.

This will now allow you to step into your User Control's code whilst having all SharePoint functions still available! :)