SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the current project, the solution is already existing, the solution has like 5 features and each feature deploys different things.

The current development never used feature versions. So I suppose version is for all features.

I already made a logic change in one of the .ascx.cs files. I want to upgrade that change only.

I cant retract and redeploy the solution, that will delete lists data, etc.

I suppose I can add a version to the feature.xml that holds that file and put version Then create a feature upgrading event receiver and just call Feature.Upgrade?

How else would you do it?


share|improve this question
up vote 4 down vote accepted


The .CS code is compiled into the assembly. The actual .cs file is never deployed to SharePoint, so the only thing you would need to do is rebuild the WSP solution and upgrade it. This will update the assembly, recycle the app pool, and deploy your change to any web application.

Beyond that, Ashish is right that removing a solution will not remove created artefacts, but if you're using featuredeactivating or featureuninstalling event receivers, these will fire if you remove the solution, so it's better to upgrade when you are in fact upgrading.

Keep in mind that you cannot add new files to a solution when upgrading a WSP, but that this does not apply to .cs files because these are all compiled into one assembly in any case. So, you cannot add new features to an upgraded WSP, but you can add new class files because these will be compiled into the existing .dll.


share|improve this answer
so, in this case, if I execute the Upgrade-SpSolution powershell, it will be enough? – Esteban V Feb 26 '12 at 0:00
should be enough. probably recycling app pool requires; but I would do it on testing environment first – Ivan Padabed Feb 26 '12 at 0:53
the good thing is that I have a dev environment also, so I can try it there first. So in summary, update-spsolution only works if there is no new files added to the features, it updates the dlls on the gac, so my change will be reflected, however if I add new content types, lists, etc, then another approach needs to be taken. – Esteban V Feb 26 '12 at 13:50
Esteban, upgrades won't work if you add new files, but you can add new content to existing files. So, if you add a new content type to an existing elements file, you can get away with simply reactivating that feature after upgrading. – Bjørn Furuknap Feb 29 '12 at 21:25

When you retract the solution, it will not delete the list data. For similar changes (update code behind), I have redeployed the solution many times without any issue.

share|improve this answer
its strange, at the beginning I was trying to do deploy using visual studio, and then the list data is empty. – Esteban V Feb 26 '12 at 0:00
visual studio clean all stuff; PS/stsadm don't; but we assumed that you don't use VS on production environment :) – Ivan Padabed Feb 26 '12 at 0:50

Your Answer


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.