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.
See Question&Answers more detail:
os