SharePoint Feature的升级和版本维护

Introduction:
http://www.c-sharpcorner.com/uploadfile/anavijai/feature-versioning-and-upgrading-in-sharepoint-2010/

在这篇文章里,我们将会讲解SharePoint2010里面feature的版本控制和升级。Feature 版本控制和升级是SharePoint2010里的新功能.Whenever 当在SharePoint里的任何范围内开启了一个feature, feature当前的版本的实例就会被创建出来。如果有一个新的高版本的feature被部署到了SharePoint里, SharePoint 2010就会检测到feature的实例需要升级。我们可以通过使用feature 元素的Version属性来实现版本控制。



FeatureVersioningandUpgrade_0_0_0_0.wsp (Feature Version 0.0.0.0):

FeatureVersioningandUpgrade_0_0_0_0.wsp
是一个沙盒解决方案,会被部署到SharePointSitesolution gallery 里。这个解决方案里有一个feature, 它在被激活的时候,会添加一个custom column(CustomField_0_0_0_0 to the site columns)

FeatureVersioningandUpgrade_1_0_0_0.wsp (Feature Version 1.0.0.0):

这个会包含一个升级版本的feature,会添加 CustomField_0_0_0_0 andCustomField_1_0_0_0.

步骤:

  • 打开 Visual Studio 2010.
  • 点击 File => New => Project.
  • 从模板中选择 "Empty SharePoint Project"
  • 输入名字: "FeatureVersioningandUpgrade" 然后点击OK.
  • 右键点击解决方案,然后点击 "Add new item".
  • 选择 "Empty Element" 模板并输入一个名字.
  • 点击添加.



  • 双击Elements.xml.
  • 创建一个text类型的custom field,看下面的例子:

     
  • 修改Feature的名字,整个solution显示如下:


     
  • 双击 feature,在属性窗口离,把版本设定为0.0.0.0.


     
  • Feature里面的条目:


     
  • Build 这个解决方案.
  • 右键点击 solution, 点击 "Package".


     
  • 右键点击solution,然后点击"Open folder in Windows explorer".


     
  • 打开Bin => Debug => 重命名 FeatureVersioningandUpgrade.wsp as FeatureVersioningandUpgrade_0_0_0_0.wsp.
  • 打开SharePoint Site => Site Actions => Site Settings => Galleries => Solutions.
  • 在ribbon 上找到Solutions 选项卡 => New group => Upload Document.
  • 上传FeatureVersioningandUpgrade_0_0_0_0.wsp.
  • 在操作列表里, 点击 "Activate".
  • 打开Site Actions => Site Settings => Site Actions => Manage Site Features => 激活"FeatureVersioningAndUpgrade Feature".
  • 打开Site Actions => Site Settings => Galleries => Site Columns.


     

升级feature:

下面我将要升级这个feature。我要添加另外一个custom field feature:CustomField_1_0_0_0 并且把版本号从 0.0.0.0改为 1.0.0.0.

  • 右键点击solution然后点击 "Add new item".
  • 选择"Empty Element"模板并输入一个名字
  • 点击Add.
  • 双击 Elements.xml.
  • 创建一个text类型的custom field:


     
  • 双击feature,在属性窗体里把版本号设置为1.0.0.0.
  • 双击Versioning and Upgrade feature.Template.xml.
  • 添加如下的设置:


     
  • 右键点击解决方案,并点击 "Package".
  • 右键点击解决方案,并点击 "Open folder in Windows explorer".
  • 打开Bin => Debug => 重命名FeatureVersioningandUpgrade.wsp as FeatureVersioningandUpgrade_1_0_0_0.wsp.
  • 打开SharePoint Site => Site Actions => Site Settings => Galleries => Solutions.
  • 在ribbon中找到Solutions选项卡 => New group => Upload Document.
  • 上传the FeatureVersioningandUpgrade_1_0_0_0.wsp.
  • 在操作菜单里,你可以看到一个新的选项"Upgrade".


     
  • 点击 "Upgrade".


     
  • 打开Site Actions => Site Settings => Site Actions => Manage Site Features => 停用feature "FeatureVersioningAndUpgrade Feature"再激活它.
  • 打开Site Actions => Site Settings => Galleries => Site Columns.
  • You could see two custom columns as shown in the following.



Vijai Anand

Vijai Anand has been working in IT industry for over 5years. He holds Bachelor's degree in Electronics and Communication Engineering.Vijai write articles and blogs related to SharePoint 2013, SharePoint2010, Silv... Read more

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值