Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've developed a custom CoreResultsWebPart which does some stuff with the search results returned in the Search Center. To test it, I just created a new search site collection and edited the search results page, deleting the old CoreResultsWebPart and adding my custom one.

What is the correct way of doing this when deploying to a production server? Do I have to deploy a .wsp, then create a new site collection, then make the same manual edit, or is there a better way?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

to get around the manual stuff you need to create a feature! when you activate the feature it deploys and adds it for you.

http://www.sharepointnutsandbolts.com/2007/05/deploying-web-parts-as-feature.html

http://www.astaticstate.com/2009/06/deploy-web-part-as-feature-with-cas.html

or just use wsp builder to build the feature for you

To create a new web part feature with WSPBuilder:

1.Right-click on the name of your WSPBuilder project in Visual Studioand click Add, New Item.

2.Select WSPBuilder from the tree on the left and choose Web Part Feature from the list on the right of the dialog.

3.Enter the title of the web part feature and click OK.

4.In the dialog that appears enter the title, description and scope and click OK.

http://stackoverflow.com/questions/1100348/using-wspbuilder-to-build-a-solution-for-a-web-part-i-developed

Customising the page is manual, if you want to change the page programmatically than that is somthing extra that you will need to performe (find page, edit page, remove webpart, add custom webpart) this can be done in the feature handler that wspbuild makes for you... i think it creates a new folder within the project named FeatureCode and inside that is a .cs class, open it and youll see a class that inherits from SPFeatureReceiver it will contain 4 methods: FeatureActivated , FeatureDeactivating , FeatureInstalled and FeatureUninstalling. You need to add the code within the FeatureActivated event to performe that manual stuff programmatically ;)

thats is just how i would do it, otherwise how you did would be the same on production. If your doing it once that manual is fine.. to more than one site I would do it programmatically

share|improve this answer
    
Thanks, SPFeatureReceiver is exactly what I was looking for. –  Ciaran Mar 22 '13 at 14:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.