At my work there is a core assembly in the GAC that many applications reference.
I do not want to change the web configs of all my production sites each time a new core version is published. Is there a way to specify a range or a wildcard for assembly versions?
Something like:
<compilation debug="false">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="MyCore,Version=*, Culture=neutral, PublicKeyToken=55b47eca7ec17c50"/> <!-- Does not work -->
<add assembly="*"/>
</assemblies>
</compilation>
There isn’t any method in .NET to directly specify a range of versions, but the “version” component of the assembly name is optional. You should be able to remove it to search for all versions of the assembly.
What I’ve done in the past is use the short name of the assembly, in other words:
That said, sometimes keeping the assembly name (with version) is useful since it prevents old code from being executed if the site is deployed incorrectly. MSBuild can be used to rewrite the web.config files inside of a structured build lab, but it requires a bit of manual configuration.