码迷,mamicode.com
首页 > 其他好文 > 详细

SharePoint Feature的升级和版本维护

时间:2015-02-27 12:02:14      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:sharepoint   feature upgrade   

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

 

SharePoint Feature的升级和版本维护

标签:sharepoint   feature upgrade   

原文地址:http://blog.csdn.net/spfarm/article/details/43964395

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!