xspydr
xspydr

Reputation: 3060

Web Part Deployed To GAC Not Working

So, I inherited a VS project that has a bunch of web parts in it. The project had a key file with a password that no one knows what the password is. So, i created a new key file which obviously changes the PublicKeyToken...

I thought deploying the new assembly to the GAC and replacing the old PublicKeyToken with the new one on the SafeControl references in the web.config would do the trick. However, when I go to the site none of the web controls work. They all say "Web Part Error..."

Here's an example of the old web.config safecontrol reference...

Here's the new one...

I got the new token by right-clicking and viewing the properties of the assembly from the "c:\windows\assembly" gac...

What am I doing wrong..?

Upvotes: 2

Views: 3878

Answers (7)

Eric Herlitz
Eric Herlitz

Reputation: 26307

What class does your webparts inherit?

Stuff might break if you use the SharePoint.WebPartPages classes

public class yourWebPartClass : Microsoft.SharePoint.WebPartPages.WebPartPage

Instead, use the WebControls class in System.Web.UI

public class yourWebPartClass : System.Web.UI.WebControls.WebParts.WebPart

/ Cheers :)

Upvotes: 0

jaloplo
jaloplo

Reputation: 951

Change the strong name of an assembly means it changes for the system, in this case, SharePoint. So, the previous webpart are part of the assembly with the snk with unknown password. You have to reconfigure every page that contains an old webpart and put the new webpart.

Upvotes: 1

Øyvind Skaar
Øyvind Skaar

Reputation: 1840

It is common problem in WSS that the template information is duplicated and embedded in the data in the database. One example of this is the definitions in the onet.xml file which is duplicated into each web instance. Another is when webparts are added to the page by the user. To change the strong name usually means you have to recreate every site where the web part has been used.

Upvotes: 0

Muad'Dib
Muad'Dib

Reputation: 29256

There are a couple of things you should check....

Unless you have a compelling reason, webparts should not deployed to the GAC, instead they should be in the bin folder of your webapp. This is where stsadm will put them for you. You should make sure that you don't have assemblies for your webpart in the bin folder if yo deploy to the GAC, sharepoint will get confused on which version to use--the GAC or the bin.

You should make sure it is registered as safecontrol in your webapp config file You should make sure to do an IISReset when you deploy ANYTHING to the GAC.

Upvotes: 0

IrishChieftain
IrishChieftain

Reputation: 15253

Download and use the VSeWSS 1.3 extensions. It will do all of this automatically for you, including the deployment :-)

https://connect.microsoft.com/Downloads/Downloads.aspx?SiteID=428&wa=wsignin1.0

Upvotes: 0

Bravax
Bravax

Reputation: 10493

It sounds like you made the correct changes, so maybe it's something else.
Have you checked the event logs and the sharepoint logs for errors?

Upvotes: 0

Paul-Jan
Paul-Jan

Reputation: 17278

The safecontrol references don't show up, but as a first sanity check: you did remember to restart IIS (necessary when deploying to the GAC)?

Upvotes: 1

Related Questions