When adding an assembly to Web.config, can you specify any version or range?

In my work, there is a main assembly in the GAC that references many applications. I do not want to change the web configurations of all my production sites every time a new major version is published. Is there a way to specify a range or pattern for assembly versions?

Sort of:

    <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>
+5
source share
1 answer

There is no direct method for specifying a version range in .NET, but the version component of an assembly name is optional. You can delete it to search for all versions of the assembly.

add an assembly item for compilation (ASP.NET settings diagram)

What I have done in the past is the short name of the assembly, in other words:

<add assembly="MyCore" />

, ( ) , , . MSBuild web.config , .

+6

All Articles