开发者

How to get the sharepoint feature version from feature.xml file programmatically?

开发者 https://www.devze.com 2023-03-28 06:03 出处:网络
I have got the the next task recently: increment the version of the sharepoint feature each time when we are building the project. I have completed it successfully using the attribute \"Version\" in f

I have got the the next task recently: increment the version of the sharepoint feature each time when we are building the project. I have completed it successfully using the attribute "Version" in feature.xml file. I change it executing the custom code within MSBuild. So, the feature version in xml file changes, but how can I get it programmaticall开发者_运维知识库y when the feature is working? I use SharePoint Server 2007, Visual studio 2008. I'll appreciate any help. Thank you. P.S. SPFarm.Local.BuildVersion contains another version, which is different from the version in feature.xml file.


Try this:

var spFarm = GetYourSPFarmObject();

System.Version version = spFarm.FeatureDefinitions["YourFeatureNameHere"].Version;

Also, if you're inside the feature event receiver and are trying to get its version, you can do:

System.Version version = properties.Definition.Version;
0

精彩评论

暂无评论...
验证码 换一张
取 消