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

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 0.0.0.0 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 2.0.0.0 Then create a feature upgrading event receiver and just call Feature.Upgrade?

How else would you do it?

Thanks

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Esteban,

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.

.b

share|improve this answer
    
so, in this case, if I execute the Upgrade-SpSolution powershell, it will be enough? –  L.V. Sharepoint Architect 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. –  L.V. Sharepoint Architect 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
add comment

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. –  L.V. Sharepoint Architect 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
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.