SharePoint功能:如何使用通配符集版本?通配符、如何使用、版本、功能

2023-09-02 01:46:28 作者:为你倾城一笑 。

我觉得这很可能是一个普通的.NET程序集加载的问题,但在我的具体情况,我希望我的SharePoint功能,以点带组件的版本与正确的SVN版本号相关联。

I think this is likely to be a generic .NET assembly loading question, but in my specific case, I want my SharePoint Features to point to an assembly whose versioning is associated with the correct SVN revision number.

我的组件现在版本中提到的这篇文章。我希望能够只配置我的SharePoint功能使用的大会,是在海关总署的最新版本。

My assemblies are now versioned as mentioned in this article. I'd like to be able to just configure my SharePoint features to use the latest version of the assembly that's in the GAC.

<Feature Id="7b5d86e8-17dc-4943-8f4e-ad1068daf4f9" 
         Title="My happy feature" 
         Scope="Web" 
         Version="1.0.0.0" 
         Hidden="FALSE" 
         DefaultResourceFile="core" 
         ReceiverAssembly="HappyFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d772fbab82fe6896"
         ReceiverClass="HappyFeature.Receivers.HappyItemEventReceiver"
         xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>

当我这样做时,SharePoint,当然找不到程序集,因为强名称不与此处描述的版本1.0.0.0匹配。我现在的版本在我的组装是1.0.4479.26553,所以我想我的功能,能够自动地来寻找类似的标号集版本。我怎样才能做到这一点?

When I do this, SharePoint of course cannot find the assembly because the strong name doesn't match up with the 1.0.0.0 version described in here. My current version in my assembly is 1.0.4479.26553, so I'd like my features to be able to automagically find similarly numbered assembly versions. How can I do this?

我有点天真地想是这样的:

I somewhat naively tried something like this:

ReceiverAssembly="HappyFeature, Version=1.0.*, Culture=neutral, PublicKeyToken=d772fbab82fe6896"

ReceiverAssembly="HappyFeature, Version=1.0.*.*, Culture=neutral, PublicKeyToken=d772fbab82fe6896"

但是,当我尝试部署我的解决办法,因此,它似乎仍然在寻找与1.0.0.0版本的文件:

But when I try to deploy my solution as such, it still seems to be looking for a file with the 1.0.0.0 version:

功能   7b5d86e8-17dc-4943-8f4e-ad1068daf4f9   无法安装,因为   装载事件接收器组件的   HappyFeature,版本为1.0。的 的,   文化=中立,   公钥= d772fbab82fe6896   失败:   System.IO.FileNotFoundException:找不到能   无法加载文件或程序集   HappyFeature,版本= 1.0.0.0,   文化=中立,   公钥= d772fbab82fe6896或   它的一个依赖。系统   找不到指定的文件。文件   名称:HappyFeature,版本= 1.0.0.0,   文化=中立,   公钥= d772fbab82fe6896

Feature '7b5d86e8-17dc-4943-8f4e-ad1068daf4f9' could not be installed because the loading of event receiver assembly "HappyFeature, Version=1.0.., Culture=neutral, PublicKeyToken=d772fbab82fe6896" failed: System.IO.FileNotFoundException: Could not load file or assembly 'HappyFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d772fbab82fe6896' or one of its dependencies. The system cannot find the file specified. File name: 'HappyFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d772fbab82fe6896'

什么是正确的方式来要挟框架加载我的递增版本的功能组件?

What's the proper way to coerce the framework to load my incremented-version feature assemblies?

编辑:所以,虽然我并没有真正解决的具体问题,我问,瑞安的建议解决我的实际只能够与SVN相关的信息标签我的组件,同时保持成功加载我的程序集的能力问题在SharePoint FeatureReceiver世界。

So, while I didn't actually solve the specific question I'd asked, Ryan's suggestion solved my practical problem of just being able to tag my assemblies with SVN-related information while retaining the ability to successfully load my assemblies in the SharePoint FeatureReceiver world.

推荐答案

你可以做的就是保持的AssemblyVersion相同的(至少同时它是一个兼容的大版本),但用同样的方法把SVN版本号到AssemblyFileVersion属性。

What you could do is keep the AssemblyVersion the same (at least whilst its a 'compatible major version') but use the same technique to put the SVN revision number into the AssemblyFileVersion property.

然后,你就不必不断更新发布政策文件。

Then you won't have to keep updating Publisher Policy files.

KB556041 - 如何使用程序集版本和程序集文件版本

假设你正在构建一个框架组件,为您的项目是在构建应用程序组件所使用的很多开发者。如果你释放组件的新版本非常频繁...如果程序集是强命名,开发人员将在每次发布新的装配时间更改参考......在这样的封闭组和波动情景更好的选择是将固定程序集版本,改变只有大会文件版本。的

SO - 什么是的AssemblyVersion之间的差异AssemblyFileVersion