0
的版本1.0.0.0我的特點的Template.xml中文件是這樣的:FeatureUpgrading是否應該使用最新的Property值?
<?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>
的templates
的價值仍然是MPS#0;MPS#1;MPS#2;MPS#3;MPS#4
,當以下代碼在FeatureUpgrading中運行時:
SPFeatureProperty property = properties.Feature.Properties["AvailableWebTemplates"];
string templates = property.Value;
爲什麼我沒有獲取更新的屬性值?這是它應該的方式嗎?
有趣。所以我猜想,因爲這是FeatureUpgrading而不是FeatureUpgraded,這使我有機會將實例與定義進行比較,以查看不同之處。 我最初得到這個工作是爲我的CustomUpgradeAction添加一個參數部分。我還沒有決定我是否喜歡這個。我想如果有多個版本,讓參數中的值將給我一個如何升級功能的歷史。但後來我已經有了源代碼管理,告訴我這一點,所以我想我會把它拿出來,並與properties.Definition一起去。謝謝! – 2011-02-03 22:41:10