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.
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>
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"
and
ReceiverAssembly="HappyFeature, Version=1.0.*.*, Culture=neutral, PublicKeyToken=d772fbab82fe6896"
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:
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?
EDIT: 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.
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 - How to use Assembly Version and Assembly File Version
Suppose you are building a framework assembly for your project which is used by lot of developers while building the application assemblies. If you release new version of assembly very frequently ... and if assemblies are strong named, Developers will have to change the reference every time you release new assembly ... A better option in such closed group and volatile scenarios would be to fix the 'Assembly Version' and change only the 'Assembly File Version'.
SO - What are the differences between AssemblyVersion and AssemblyFileVersion
You can use a publisher policy to redirect to the new version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With