tag:blogger.com,1999:blog-4126985520350746834.post5256600713800850051..comments2024-03-28T07:00:21.554+00:00Comments on Chris O'Brien: Feature upgrade (part 1) - fundamentalsChris O'Brienhttp://www.blogger.com/profile/10022906552670607366noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-4126985520350746834.post-71471029748828529702015-02-12T16:45:27.172+00:002015-02-12T16:45:27.172+00:00@Kannabiran,
Yes, the Feature upgrade framework i...@Kannabiran,<br /><br />Yes, the Feature upgrade framework is the same in SP2013 as SP2010. <br /><br />Cheers,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-8474642914783448272015-02-11T00:52:43.267+00:002015-02-11T00:52:43.267+00:00Hi Chris, does this article still holds good for S...Hi Chris, does this article still holds good for SharePoint 2013 on-premise?Kannabiranhttps://www.blogger.com/profile/12230203078046597991noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-60675087538473018162013-06-12T21:23:03.427+01:002013-06-12T21:23:03.427+01:00How do i handle cases where only code changes in a...How do i handle cases where only code changes in a feature. For example, i have a class with some helper methods in a feature which is used by many other features. There are now two scenarios i can imagine. I added a new helper method. In this case i would only change the AssemblyFileVersion, not the AssemblyVersion. Do i just have to Update-SPSolution with the new feature file to replace the file in the GAC? I think i don´t habe to call feature.upgrade for any instance in this case.<br /><br />Second scenario is that some existing functionality is changed but features depending on this feature should still work. In this case i need to have two versions of the assembly in the GAC. I think this is a case where the Mapfile directive will help me?Anonymoushttps://www.blogger.com/profile/17634396717757239560noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-75827598939003352502012-07-26T22:06:46.735+01:002012-07-26T22:06:46.735+01:00@Sam,
Maybe one thing to try would be to reinstal...@Sam,<br /><br />Maybe one thing to try would be to reinstall/activate the Feauture in dev to start from a clean state. It would be interesting to see if you hit the same issue again. <br /><br />Otherwise I can't say I've seen this before I'm afraid.<br /><br />All the best,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-64287113928924696452012-07-25T13:09:31.509+01:002012-07-25T13:09:31.509+01:00Thank you for getting back to me.
Yes, after I do...Thank you for getting back to me.<br /><br />Yes, after I do the Update-SPSolution via PowerShell I can see that the feature shows its ready for an upgrade (both by doing QueryFeatures() and using your "Manage Feature Upgrades" in your SPFeatureUpgrade kit). <br /><br />In my FeatureUpgrading event I am just removing the ReadOnly off my content type (something simple to test). <br /><br />My initial version is 1.0.0.0 and so I increment it to version 2.0.0.0 with is within the VersionRange in my UpgradeActions.<br /><br />I upgrade using your "Manage Feature Upgrades". I can see the system does the upgrade because I run a PowerShell script to show me the version before the upgrade and the version after the upgrade and I can see it increments from 1.0.0.0 to 2.0.0.0. But when I add a debug breakpoint to the FeatureUpgrading event it never gets hit. And when I turn up the diagnostic logging I don't see the event get triggered in the SharePoint logs (I do see other events get triggered such as FeatureInstalling and FeatureActivated).<br /><br />As I had stated, it was working at first. Then I added more to my CustomUpgrades to add more columns. After that I an unable to get the event to trigger again. So this led me to think that maybe I am hitting an issue or bug in SharePoint. Very odd.Samnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-9859291732564242952012-07-24T23:44:25.517+01:002012-07-24T23:44:25.517+01:00@Sam,
Hmm, I'm not aware of any changes. When...@Sam,<br /><br />Hmm, I'm not aware of any changes. When you use one of the QueryFeatures() methods to test for Feature instances requiring upgrade, does your Feature get listed? If not, are you doing anything differently with incrementing the version number and deploying the WSPs?<br /><br />Thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-11480950157050449042012-07-24T23:27:43.654+01:002012-07-24T23:27:43.654+01:00Excellent post Chris.
I have ran into an issue ...Excellent post Chris. <br /><br />I have ran into an issue I am not sure how to resolve. My project was upgrading just fine at first after following your post. Then recently I am running into where it wont fire the FeatureUpgrading event anymore no matter what I do. My farm is patched to SP1, do you know of any bugs that get fixed with the FeatureUpgrading in CU's after SP1?<br /><br />Thank youSamnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-1796357960086537012012-04-03T16:08:33.691+01:002012-04-03T16:08:33.691+01:00@jkps,
Yes you're right, it's missing a c...@jkps,<br /><br />Yes you're right, it's missing a closing </UpgradeActions> element. Sorry about that, well spotted :)<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-66135859594720222882012-04-03T10:11:13.475+01:002012-04-03T10:11:13.475+01:00In the first feature code should there be a closin...In the first feature code should there be a closing last but one line?Johnhttps://www.blogger.com/profile/14032902893310768751noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-32842245675950736662012-01-19T21:47:27.103+00:002012-01-19T21:47:27.103+00:00@mrmorodo,
Yes I read that too. In any case, appr...@mrmorodo,<br /><br />Yes I read that too. In any case, appreciate the comment.<br /><br />Cheers,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-87796051995163114112012-01-19T20:43:13.203+00:002012-01-19T20:43:13.203+00:00Hi Chris,
I have been reading up on SharePoint fe...Hi Chris,<br /><br />I have been reading up on SharePoint feature updating best practice and have found your series very helpful. <br />I thought you might like a bit of feedback regarding MapFile. I haven't used it personally but found the following information in an MS intial publication:<br /><br />'MapFile — Allows you to map an uncustomised file to a different location on the front-end Web server. You can use the FromPath and ToPath attributes to rename a file in a Feature (for example, , but you can also use MapFile to move a file. In this case, the FromPath and ToPath attributes specify paths that are relative to the TEMPLATE directory. For example, if a Feature named "MyFeature" has .gif files installed in a "Gifs" directory (such as, %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES\MyFeature\Gifs\basketball.gif), and in version 2 you want to rename the directory from “Gifs” to “Images”, then can be used to move the files.'<br /><br />see: <br />http://msdn.microsoft.com/en-us/library/ie/ee537575.aspx<br /><br />Regards,<br />Gareth.mrmorodohttps://www.blogger.com/profile/13571652197858914298noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-67583301442967652352011-08-26T13:10:04.826+01:002011-08-26T13:10:04.826+01:00@Anonymous,
In adding a web part (visual or not),...@Anonymous,<br /><br />In adding a web part (visual or not), you've changed the scope of the WSP from global to web application-scoped. You cannot upgrade WSPs to deploy this change, it must be retracted and redeployed.<br /><br />Take care to ensure you know effect this will have. For example, will any Features be automatically activated causing undesirable side-effects? I often snapshot my dev environment during this process.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-61978701492544766412011-08-25T20:17:10.676+01:002011-08-25T20:17:10.676+01:00Chris,
Working through the upgrade process. Is i...Chris,<br /><br />Working through the upgrade process. Is it possible to add a visual web part to the feature? I am getting an error of The solution file located at "" does not appear to be a valid upgrade for solution "". the two solutions must have the same resource types (global or Web-Application scoped). It is a Site feature that originally was globally deployed. I was able to run custom actions but as soon as I add the web part I can no longer upgrade. Thank You.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-47452828700892781952011-08-08T08:03:49.088+01:002011-08-08T08:03:49.088+01:00Hi Chris,
Thanks for the answer and sorry for my ...Hi Chris,<br /><br />Thanks for the answer and sorry for my bad English. Excessive is of course not the right word, it should have been extensive (or a better soutable word) of course :-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-80038370417837894292011-08-04T18:37:28.828+01:002011-08-04T18:37:28.828+01:00@Maarten,
It's a good question, and it came u...@Maarten,<br /><br />It's a good question, and it came up as a question on part 3 of this series too. For convenience, here's what I said to that commenter:<br /><br /><i>That's a great question - you do indeed need to test *multiple* Feature upgrade iterations as you develop your Feature upgrade XML/code. You cannot specifically "rollback" an upgrade as such, but by reverting back the version number to the real one you want to use (e.g. 1.0.0.1) and *reinstalling* the Feature (i.e. by retracting/redeploying the WSP rather than upgrading), the end result is that the Feature is installed at that version with the current Feature contents. You can then use this as the version of your Feature to take forward to other environments. In other words, SharePoint does not maintain historic versions of a Feature's state.</i><br /><br />Hope that makes sense.<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-5742158761266564892011-08-04T15:24:19.937+01:002011-08-04T15:24:19.937+01:00Hi Chris,
Thanks for this excessive series, it&...Hi Chris,<br /><br /><br /><br />Thanks for this excessive series, it's all very clear to me.<br /><br /><br /><br />While playing with some feature upgrades, I stumbled upon the following problem: <br /><br />I've got a feature with version 1.0.0.0. I created an upgrade to 2.0.0,0 and updated the package via STSADM. Then I called the .Upgrade method. However, there was an error in the upgrade process so the upgrade failed. <br />I corrected the error in Visual Studio, updated the package on the server and tried to upgrade the feature again but then discovered that the feature already has version 2.0.0.0.<br /><br />Is there a method to completely revert feature upgrade after an upgrade failure?<br /><br />Thanks in advance for your reply!<br /><br />Best regards,<br /><br />MaartenAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-81923377982742632962011-05-08T22:55:39.490+01:002011-05-08T22:55:39.490+01:00@Jonathan,
Good question. I actually think there&...@Jonathan,<br /><br />Good question. I actually think there's nothing stopping you using the AddContentTypeField with a content type provisioned by a Feature you do not own. Remember that all you're doing is specifying the ID of the content type and the ID of the field to add.<br /><br />If I'm wrong, the fallback would be to use the imperative option (i.e. write code in the FeatureUpgrading event) and add the field that way.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-53080274794605861842011-05-07T09:13:54.345+01:002011-05-07T09:13:54.345+01:00Best post about upgrades so far. Thanks a lot! Hav...Best post about upgrades so far. Thanks a lot! Have a question please: What if I just want to add a new site column to an existing content type that was defined in a feature I do not own? In this case, I cannot upgrade the feature, since I don't own it.Jonathan B.noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-64473812156857439892011-04-27T23:18:50.744+01:002011-04-27T23:18:50.744+01:00Fantastic .. such an elegant style of writing. Tha...Fantastic .. such an elegant style of writing. Thanks ChrisA.Ragabnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-17759479597048475502011-03-14T22:02:29.138+00:002011-03-14T22:02:29.138+00:00@Luke,
Yes, this was a typo and you were absolute...@Luke,<br /><br />Yes, this was a typo and you were absolutely right, I meant the FeatureUpgrading event. I actually noticed this the other day too but forgot to correct it.<br /><br />Text now updated. MANY THANKS!<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-63213857712286443112011-03-14T18:04:59.670+00:002011-03-14T18:04:59.670+00:00Chris,
Sorry, in my previous comment I mis-spoke ...Chris,<br /><br />Sorry, in my previous comment I mis-spoke about the location of my confusion. The question I have is about the bullet point named CustomUpgradeAction element which is right above the code for FeatureUpgrading. You say "the code will always be the FeatureActivating method in the receiver." This is the part that is confusing me. Shouldn't this be the FeatureUpgrading method?Lukehttp://www.grindahl.netnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-39485775397914162012011-03-14T17:51:13.140+00:002011-03-14T17:51:13.140+00:00In the paragraph at the bottom of the "When w...In the paragraph at the bottom of the "When would I use Feature upgrade?" section you mention FeatureActivating. Is this correct? I was under the impression the code would execute under FeatureUpgrading? You mention it twice so I just want to clarify if it actually runs under activating or upgrading.<br /><br />Thanks,Lukehttp://www.grindahl.netnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-77624510456347573322010-11-07T13:40:08.945+00:002010-11-07T13:40:08.945+00:00@Ram,
I'm not 100% clear what you're aski...@Ram,<br /><br />I'm not 100% clear what you're asking, but the first thing to say is that the Feature upgrade framework is part of SharePoint 2010, not 2007. However, it is still possible to upgrade artifacts like those you list on 2007, it's just not as convenient or obvious how to do it. Some artifacts can just be overwritten on the filesystem (e.g. master pages/layouts which were deployed as a Feature) - others require code to upgrade (e.g. content types). <br /><br />I covered this in detail (for nearly all of the artifacts you list) in my ALM presentation at the SharePoint Evolutions conference, my deck is available here at <a href="http://www.sharepointnutsandbolts.com/2010/05/sharepoint-2010-alm-my-slide-decks-from.html" rel="nofollow">http://www.sharepointnutsandbolts.com/2010/05/sharepoint-2010-alm-my-slide-decks-from.html</a><br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-62951898767112241772010-11-07T02:14:52.098+00:002010-11-07T02:14:52.098+00:00hi Chris,
Let me if this works, the same on Moss 2...hi Chris,<br />Let me if this works, the same on Moss 2007, we have been working on Enterprise deployments for Sharepoint specifically with WCM based projects. <br /><br />Our project is divided into phases, wherein in Phase I, we have some features going live and Phase II the balance features. I would need to understand if while doing fixes and enhancements for Phase I features, can we use the same framework.<br />I would need some guidance as how do i upgrade <br />master pages, <br />layout pages, <br />site columns, <br />content types, <br />workflow and workflow associations, <br />Infopath forms, <br />sharepoint lists, libraries,<br />application pages (deployed within layout folder), <br />Custom CSS, <br />javascript files, <br />control templates (for user controls), <br />custom field types, <br />web parts (OOTB and Custom), <br />site definitions, <br />Custom XSL in style libraries specific to CQWP, <br />Layout images, <br />preview images for master pages, <br />multiple additions of webparts on pages, <br />webparts added to existing pages.<br /><br />all the above upgrades, changes and fresh deployments.<br /><br />ramStartup Cohortshttps://www.blogger.com/profile/05714627633978029594noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-32503866936890715842010-08-12T22:03:18.045+01:002010-08-12T22:03:18.045+01:00@Elgolfin,
Well sure, we can do anything with any...@Elgolfin,<br /><br />Well sure, we can do anything with any .Net API in PowerShell :)<br /><br />However, without the abstraction that cmdlets can provide, this gets messy for scenarios which are perhaps more real-life than your example of upgrading a single site-scoped Feature instance in a single site collection. If we wanted to upgrade all Feature instances which can be upgraded, we'd then need extra script to run QueryFeatures() etc. etc. So I definitely think there's a need to upgrade Features using PS in a "one script command" way.<br /><br />If we took your point to it's logical conclusion, does that mean there was no point in Microsoft writing the 500+ PS cmdlets they supplied? :)<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.com