views:

300

answers:

2

I have created a webpart and want to deploy that in Sharepoint. I want to deploy the web part in bin.

I have not created a strong name for dll (webpart code). Is strong name a must for deploying webpart in bin folder?

I have referred this msdn link to do this.

http://technet.microsoft.com/en-us/library/cc263271.aspx

When I go to WebPart gallery and want to populate a web part, it is not appearing in webpart gallery.

Any help will be appreciated.

+1  A: 

Strong name isn't a must for Sharepoint development, but is your easiest option.

You could also to use WSPBuilder (SharePoint WSP tool) to deploy your webparts

Rubens Farias
I want to deploy the web part in application's bin folder. I dont want to use WSPBuilder. I am coping and pasting files. This copy is not working. I will try WSPBuilder as well.
Ravi Khambhati
You could also give `VSeWSS` a try
Rubens Farias
IMHO, VSeWSS doesn't scale well in a larger SharePoint project
Jon Schoning
A: 

I usually strong name my assemblies because I don't want to discover it later on that my assemblies needs a strong name, just in case the assembly is being used in some other way than I originally intended.

I've also had some problems relating to events in Sharepoint where reflection is used to execute functions based on class and assembly info (probably stored in database), so if you add a strong name later on then you have to update the places where the old event was used (e.g. on lists), otherwise your functions won't get hit. On the other hand if you have a strong name then this is easy bu using web.config assembly redirect

I like your idea though of having the assembly in bin, that way you can use CAS which provides more control for administrators.

To resolve this problem then you could start out by adding the strong name and deploying the asembly to the GAC, then add your .webpart (or .dwp) to the web part gallery. If that works you can try moving the assembly to the bin folder and then remove the strong name.

You might consider deploying the webpart in a feature and add the code neccessary to add the .webpart file to the gallery on the fly so you dont have to worry about the file, this can be accomplished by using code using a feature receiver

using (SPWeb web = site.OpenWeb())
{
    web.AllowUnsafeUpdates = true;
    site.AllowUnsafeUpdates = true;    
    SPList list = web.Lists["Web Part Gallery"];
    SPFolder root = list.RootFolder;
    SPFile spFile = root.Files.Add("ContentEditor.dwp", s);
    spFile.Update();
}

or by using caml xml

<?xml version="1.0" encoding="utf-8"?>
<Feature Id="8425EAF8-6GBE-4698-83C7-831CA8614D6D"
        Title="WebPart" 
        Description="Some description" 
        ImageUrl="GenericFeature.gif"
        Scope="Site" 
        xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
    <ElementManifests>
        <ElementManifest Location="elements.xml" />
    </ElementManifests>
</Feature>

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
    <Module
        Name="WebPart"
        List="113"
        Url="_catalogs/wp"
        RootWebOnly="TRUE">
        <File Url="WebPart.dwp" Type="GhostableInLibrary" />
    </Module>
</Elements>
armannvg