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 have a webpart project built in visual studio 2010 and it has been deployed successfully to my production environment. I recently had to make some changes to the webpart and also needed to add a new supporting webpart to the project (based on the nature of the webparts and their relationship to each other it, I thought it would make sense to keep both in the same project and therefore part of the same feature).

Anyway, after making the changes I deployed to the server using the command 'update-spsolution'. However, while the changes I made to the already existing webpart were immediately visible on any pages where the webpart was deployed, I am not able to deploy the newly created webpart that was part of the feature, in fact I couldn't even find it in the web part gallery.

It was only afterwards when I removed the new webpart from the existing project and created a brand new project, a brand new wsp file and deploying the new solution and then activating the new feature that i was able to deploy the new webpart.

I'm wondering, is there something I'm doing wrong when running the 'update-spsolution' command that results in my newly added webpart not being available?

share|improve this question
add comment

5 Answers

up vote 4 down vote accepted

You will need to re-activate the feature that you updated. Upon re-activation, the web part should show in the gallery.

share|improve this answer
    
that was simple enough, thanks. –  Felipe Kettle May 29 '12 at 16:00
    
Current .webpart files are not re-provisioned if they already exist, and new ones are not pushed unless you re-activate the feature. It's tricky when you don't know that tip. –  Louis May 29 '12 at 20:54
add comment

If you wanted to do it the "right" way then you should have used Feature Upgrading.

It's unfortunately not simple but gives you a lot of control of what happens when you deploy a new version of a feature.

In your case it would have involved:

  • Add the elements.xml files for the new web parts inside <ApplyElementManifests> inside <UpgradeActions> in the feature.xml
  • update solution using update-spsolution as you did
  • upgrade the features (can be done using SharePoint 2010 Feature Upgrade Kit)

For more information about to Feature upgrade see Chris O'Briens series starting with Feature upgrade (part 1) - fundamentals

Even though it may seem as overkill for a simple project I still think it's the right thing to due for the following reasons:

  • It's a good practise to get into and you should always think upgrading into your features
  • If your feature is doing something when activated/deactivated like adding data or cleaning up then activate/deactivate may not be an option
  • It may be a lot easier to find all the places to upgrade a feature (build in) than to loop though and look for where feature is activated and then deactivate/activate
share|improve this answer
    
For a simple webpart, this is overkill. There is no XML to really update. –  Louis May 29 '12 at 20:55
    
@Louis I've added why I think it's a good thing to the answer –  Per Jakobsen May 30 '12 at 6:59
add comment

I've found updating wsp's can be a little tricky sometimes. Sometimes doing a full Uninstall-SPSolution/Remove-SPSolution will help if you are experiencing strange behavior.

In my experience deploying form visual studio usually goes off without a hitch. Because of this, I will try to match it's deploy process as closely as possible if I am having a deploy problem. Below is a description of the "Default" deploy configuration for a SharePoint project in visual studio:

... packages the WSP file, recycles the application pool, retracts the previous version of the solution, adds the solution, activates all features, and runs the post-deployment command line.

share|improve this answer
    
This would have worked as well, since mimicking the steps visual studio contains would have included deactivating the feature and reactivating as well –  Felipe Kettle May 29 '12 at 16:01
add comment

You will need to re-activate the web parts from web part Gallery go to site Actions> Site settings under Galleries > Web parts in the Web parts Gallery documents >new document you will fine the new web parts select the new web parts and click Populate Gallery in the new web part Edit Properties Change the group to Custom and click save after that you will fine the new web parts in the custom web parts

share|improve this answer
add comment

Upon deactivate and then activate and finally recycle application pool solve my problem.Now the web part is shown in gallery.

share|improve this answer
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.