views:

490

answers:

8

I've been trying to follow the information from:

Long URL clipped to stop breaking the page

and

http://msdn.microsoft.com/en-us/library/ms415817.aspx

Which more or less have the same instructions. I've been copying the .dll file from the build over to the BIN directory of the Sharepoint site.

When I click the Web Part Gallery and hit new, both articles say that the web part should show up in the list.

I have tried every possible way that I can think, but my web part will not show up in that list. Is there a step that I missed somewhere? Are there permissions that I should be thinking about? How exactly does Sharepoint recognize that there is a new web part. Is it simply from having the assembly placed in the BIN directory, or is it from adding the control in the safe list of web.config?

For the life of me I cannot figure this out.

Thanks, Ryan.

+2  A: 

I believe the minimum you need to have a WP show up in the "New" Part of the webPart Catalog, you need the dll in the "bin" folder (bin in the web dir, not the 12 hive :)) or in the GAC and a safe control entry. I would verify the Safe control entry:
Assembly = name of dll
NameSpace = well... The NameSpace where your WebPart class resides
TypeName = the name of your webPart class

You can wildcard the NameSpace and TypeName just to be sure you are getting there:

... Namespace="*" TypeName="*" ...

I would also recommend signing the assembly and putting in a PublicKeyToken=...

Also, try setting the trust level to WSS_Medium or Full.

If this doesn't work, you can try adding a .webpart file to the wpCatalog folder in your web dir.

Edit: Clarification

AdamBT
A: 

I've added it to the safe controls list. I've tried every different combination that I could think of, but nothing has worked.

Do I need to rename the .DLL assembly to something else?

Thanks.

Ryan Smith
A: 

Thanks for the information..

I tried all those things you suggested. No luck still.

Do you know of any articles that show how to manually create the .webpart file?

All the information that I can find online basically says "The easiest way to do this is to have Share Point do it for you". Which is exactly my problem right now.

Ryan Smith
+1  A: 

Wow, you have me stumped ... I would try deploying some other 3rd party "free" web parts manually and see if you can get those to show up. This site has a few: http://www.sharepointblogs.com/mkruger/archive/2007/06/26/free-sharepoint-web-parts-3rd-party.aspx

Have you made sure that you set: [assembly: AllowPartiallyTrustedCallers] in your AssemblyInfo file?

I am amazed no one else has chimed in on this. I guess next step would be to try to deploy it as a feature/solution.

Is this a simple hello world wp or are you doing something more?

To be honest, I am beginning to believe that it is your wss/moss configuration/settings that is hampering your efforts at the moment. Have you ever successfully deployed a WP to your farm? ... Is this a VPC dev farm or production?

AdamBT
+2  A: 

This has to be a mismatch between your assembly and what has been entered into web.config for the safecontrol entry.

The safecontrol entry is case sensitive - and the smallest of errors will stop is from showing on the 'New' listing of the web part gallery.

Also make sure you are editing the correct web.config! :-) Another common gotcha is that your web part class has to be public.

Hope this helps

Nick Swan

Nick Swan
+2  A: 

Have you tried using the WPPackager tool from Microsoft? I haven't touched SharePoint since v2003, and I know there was a handy tool for WP deployment for that platform. I'd offer a link to it, but 1) I can't remember its name, and 2) I'm not sure if it is a valid installation route for your version of SharePoint.

ZombieSheep
A: 

Thanks everyone for your answers. I never did get it to show up correctly but I have found some hacks around that will allow me to continue with the project.

Hopefully I can come back to this issue when I don't have a hard deadline because I really do need to understand where I'm screwing up.

Ryan Smith
A: 

I've been creating a few web parts over the past 2 weeks, but I have not used the "New Web Parts" section of the Web Part Gallery. Instead, I create a .dwp file (e.g. MyWebPart.dwp), which is more or less an XML file describing the web part, and I manually import it into the gallery.

The format for my .dwp files generally looks like this:

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
  <Title>My Sample Web Part</Title>
  <Description>This web part displays "Hello World" on the page.</Description>
  <Assembly>My.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ed03eac7f647a61</Assembly>
  <TypeName>My.Assembly.MyWebPartClassName</TypeName>
  <!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>

This of course assumes that you've added this assembly as a "Safe Control". After you compile your assembly and move it into the bin/GAC for your SharePoint machine, go back to the web part gallery, click "Upload", and upload your .dwp file. You'll have to specify a few properties after uploading it.

Assuming your web part exists in your .dll, then you should see it added to the gallery list, and you can preview it or add it to a page at that point.

dsteinweg