我的功能部件的Template.xml文件的1.0.0.0版本如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<Properties>
<Property Key="AvailableWebTemplates" Value="MPS#0;MPS#1;MPS#2;MPS#3;MPS#4" />
</Properties>
</Feature>新版本1.1.0.0如下:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<UpgradeActions>
<VersionRange BeginVersion="1.0.0.0" EndVersion="1.1.0.0">
<CustomUpgradeAction Name="UpgradeTo1v1"/>
</VersionRange>
</UpgradeActions>
<Properties>
<Property Key="AvailableWebTemplates" Value="MPS#0;MPS#1;MPS#2;MPS#3;MPS#4;STS#2" />
</Properties>
</Feature>当以下代码在FeatureUpgrading中运行时,templates的值仍为MPS#0;MPS#1;MPS#2;MPS#3;MPS#4:
SPFeatureProperty property = properties.Feature.Properties["AvailableWebTemplates"];
string templates = property.Value;为什么我得不到更新后的属性值?这就是它应该是的样子吗?
发布于 2011-01-31 22:45:16
这确实是它应该是的方式:一个特征有1个定义和n个实例。FeatureUpgrading中的代码用于升级实例。
xml中的属性将更新功能定义,而不是正在运行的实例。
properties.Feature.Properties["MyProp"]获取正在运行的实例的属性值,properties.Definition.Properties["MyProp"]获取特征定义中的属性值。
https://stackoverflow.com/questions/4808014
复制相似问题