Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Derik Whittaker

Thoughts on Software Development, .Net, OOP, Design Patterns and all things cool



Sharepoint Web Part Gallery Configuration Gotcha

 In order to add a new web part to Sharepoint 2007 (MOSS) you need to add the assembly information to the <SafeControl> list inside the sites Web.Config file.  When doing so make sure to type carefully.  If you make a mistake when editing the config file, the page will not render correctly. If the page is NOT rendering correctly for you, check the Application Event log for details, this may point you in the right direction.

Pay special attention to the casing for the attributes.  They ARE case sensitive. 

Invalid (namespace is not cased correctly):
<SafeControl Assembly="xxxx, Version=1.0.0.0, Culture=neutral" namespace="xxx" TypeName="*" Safe="True" AllowRemoteDesigner="True" />

Valid (namespace is not cased correctly):
<SafeControl Assembly="xxxx, Version=1.0.0.0, Culture=neutral" Namespace="xxx" TypeName="*" Safe="True" AllowRemoteDesigner="True" />

Just thought I would say my findings/pain with everyone.

Till next time,

 

 

kick it on DotNetKicks.com


Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# August 29, 2007 11:26 AM

Marcin Hoppe said:

That's why it is good to automate Web Part deployment using features. You won't have a chance to make a mistake (or you will make it only once).

Probably it's also good not to use the TypeName="*" construct and specify the type name exactly. The asterisk can bite you when you have an abstract class for a Web Part (it may, for instance, prepare infrastructure for Ajax). It will throw an error in such a case.

# August 29, 2007 11:59 AM

Derik Whittaker said:

@Marcin,

How do i automate this?  Can you point me in the right direction?

# August 29, 2007 12:10 PM

Marcin Hoppe said:

One option is to use Visual Studio Extensions for Windows SharePoint Services (aka VSeWSS). It handles generating the feature description, solution manifest and even the wsp solution file (which is really a CAB file), deploying and undeploying the entire shebang for you. It also restarts IIS on every deployment. It takes quite some time and version 1.0 has not been very stable for me. Now there is a version 1.1 CTP but I haven't tried it yet.

Since VSeWSS is not the best solution in the world (although it is better than doing things manually), I decided to prepare the entire build and deployment scripts myself, using NAnt. It also required preparing feature description files, manifest files etc. by hand but it pays off now when I have to deploy more and more things with my Web Part.

I think there is enough material for a couple of posts on this issue. I'll start with a big picture of basic activities during Web Part development and deployment and then delve deeper into details. I think I will start tomorrow but as on Friday I'm coming back home after spending a month in Belfast in my company's headquarters, it may take a couple of days for me to get back on track on this.

# August 29, 2007 6:21 PM

Derik Whittaker said:

@Marcin,

I actually tried to use the VSeWSS today, but I am not running Server 2003 as my dev enviorment.  I do have a VM running with 2003, but dont really want to develop in my VM.  

Some posts would be great...

Derik

# August 29, 2007 6:28 PM

Marcin Hoppe said:

Well, I am developing on two Virtual PC machines (one for MOSS and the second one for domain controller, each running Windows Server 2003) and it does the trick (although it is a bit slow).

Are you developing on a different machine than your MOSS installation?

# August 29, 2007 6:38 PM

Derik Whittaker said:

@Marcin,

Yea, my development box does not have MOSS.  Right now I am kinda in the POC stages.  I am just trying to get my feet wet and figure out what end is up and where to start.  I really don't want to develop on the MOSS VM but i will if i have to.

# August 29, 2007 6:49 PM

Marcin Hoppe said:

Developing on a VM with MOSS installed is pretty convenient. You can go through the build-deploy-test cycle pretty easily and you can look at your MOSS instance much more easily.

# September 6, 2007 3:57 PM

Didrex. said:

Didrex without a prescription. Buy didrex. Didrex.

# July 30, 2008 8:03 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Derik Whittaker

Derik is a .Net Developer/Architect specializing in WinForms working out the northern suburbs of Chicago. He is also believer and advocate for Agile development including SCRUM, TDD, CI, etc.

When Derik is not writing code he can be found spending time with his wife and young son, climbing on his bouldering wall, watching sports (mostly baseball), and generally vegging out. Check out Devlicio.us!

Our Sponsors

Red-Gate!