473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Can application policy bind to latest version of assembly?

Is there a way to set the application binding policy so
that it always binds to the latest version of an
assembly? I'm hoping there is a way to avoid updating the
application's binding configuration every time there is
an update to a shared assembly.

Jul 19 '05 #1
2 8729
SR
Use the BindingRedirect Element in the config file. MSDN
Link : http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpgenref/html/gngrfbindingredirect.asp

<msdn_snip>

..NET Framework General Reference

<bindingRedirect> Element
Redirects one assembly version to another.

<configuration>
<runtime>
<assemblyBinding>
<dependentAssembly>
<bindingRedirect>

<bindingRedirect
oldVersion="old assembly version"
newVersion="new assembly version"/>
Required Attributes
Attribute Description
oldVersion Specifies the version of the assembly that was
originally requested. The format of an assembly version
number is major.minor.build.revision. Valid values for
each part of this version number are 0 to 65535.
You can also specify a range of versions in the following
format:

n.n.n.n - n.n.n.n

newVersion Specifies the version of the assembly to use
instead of the originally requested version in the format:
n.n.n.n

Remarks
When you build a .NET Framework application against a
strong-named assembly, the application uses that version
of the assembly at run time by default, even if a new
version is available. However, you can configure the
application to run against a newer version of the
assembly. For details on how the runtime uses these files
to determine which assembly version to use, see How the
Runtime Locates Assemblies.

You can redirect more than one assembly version by
including multiple <bindingRedirect> elements in a
<dependentAssembly> element.

Explicit assembly binding redirection in an application
configuration file requires a security permission. This
applies to redirection of .NET Framework assemblies and
assemblies from third parties. The permission is granted
by setting the <bindingRedirect> Element flag on the
SecurityPermission Class. For more information, see
Assembly Binding Redirection Security Permission.

Example
The following example shows how to redirect one assembly
version to another.

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-
com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"

publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Configuration File
This element can be used in the application configuration
file, machine configuration file (machine.config), and the
publisher policy file.

See Also
Runtime Settings Schema | Configuration File Schema |
Redirecting Assembly Versions

</msdn_snip>

Hope this helps

regards,

sr
-----Original Message-----
Is there a way to set the application binding policy so
that it always binds to the latest version of an
assembly? I'm hoping there is a way to avoid updating the
application's binding configuration every time there is
an update to a shared assembly.

.

Jul 19 '05 #2
Right. But, this doesn't give you the latest available version - you have
to specify the newVersion, with no wildcards. This is by design, and for
good reason - always using the latest version causes dll hell (see
http://blogs.gotdotnet.com/suzcook/P...3-56c29a59b22d )
..

But, if the problem is that you're changing your assembly version for every
build, you may want to consider keeping them the same, and then only
changing them after each shipping build. See
http://blogs.gotdotnet.com/suzcook/P...8-65f3eac85274
for details.
Suzanne Cook
My .NET CLR Loader blog: http://blogs.gotdotnet.com/suzcook/
--
Please do not respond directly to this alias. This alias is for newsgroup
purposes only. This posting is provided "AS IS" with no warranties, and
confers no rights.

"SR" <rs*****@hotmail.com> wrote in message
news:05****************************@phx.gbl...
Use the BindingRedirect Element in the config file. MSDN
Link : http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpgenref/html/gngrfbindingredirect.asp

<msdn_snip>

.NET Framework General Reference

<bindingRedirect> Element
Redirects one assembly version to another.

<configuration>
<runtime>
<assemblyBinding>
<dependentAssembly>
<bindingRedirect>

<bindingRedirect
oldVersion="old assembly version"
newVersion="new assembly version"/>
Required Attributes
Attribute Description
oldVersion Specifies the version of the assembly that was
originally requested. The format of an assembly version
number is major.minor.build.revision. Valid values for
each part of this version number are 0 to 65535.
You can also specify a range of versions in the following
format:

n.n.n.n - n.n.n.n

newVersion Specifies the version of the assembly to use
instead of the originally requested version in the format:
n.n.n.n

Remarks
When you build a .NET Framework application against a
strong-named assembly, the application uses that version
of the assembly at run time by default, even if a new
version is available. However, you can configure the
application to run against a newer version of the
assembly. For details on how the runtime uses these files
to determine which assembly version to use, see How the
Runtime Locates Assemblies.

You can redirect more than one assembly version by
including multiple <bindingRedirect> elements in a
<dependentAssembly> element.

Explicit assembly binding redirection in an application
configuration file requires a security permission. This
applies to redirection of .NET Framework assemblies and
assemblies from third parties. The permission is granted
by setting the <bindingRedirect> Element flag on the
SecurityPermission Class. For more information, see
Assembly Binding Redirection Security Permission.

Example
The following example shows how to redirect one assembly
version to another.

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-
com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"

publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Configuration File
This element can be used in the application configuration
file, machine configuration file (machine.config), and the
publisher policy file.

See Also
Runtime Settings Schema | Configuration File Schema |
Redirecting Assembly Versions

</msdn_snip>

Hope this helps

regards,

sr
-----Original Message-----
Is there a way to set the application binding policy so
that it always binds to the latest version of an
assembly? I'm hoping there is a way to avoid updating the
application's binding configuration every time there is
an update to a shared assembly.

.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: JohnnySparkles | last post by:
Hi All, I'm working on an application which uses a dll for some of its classes. I build the application and the dll and it runs fine on any machine with Visual Studio .NET installed on it....
3
by: Raveendra | last post by:
Hi! I am trying to create one new Application Domain and calling one Assembly in that created Application Domain. It is working fine with stand alone application. But I need to do the same with...
9
by: Wayne Wengert | last post by:
I built an ASP application and it runs fine on my local IIS. I am trying to move the application to my web service (ISP) out on the internet. I've read several of the help articles but they all...
0
by: john wright | last post by:
I am trying to solve a problem and have been directed here. I am developing a Web App using the 1.1 framework. I am using the Enterprise Application Blocks for this program (espcially the data...
4
by: Terence Shek | last post by:
Is there a way to set the application binding policy so that it always binds to the latest version of an assembly? I'm hoping there is a way to avoid updating the application's binding...
2
by: Tinnu | last post by:
My asp.net application uses a class which needs an unmanaged dll named SSlibrary. When trying to load the page it gives me the folllowing error. === Pre-bind state information === LOG:...
2
by: junkmanuk | last post by:
Hi, This has been posted many times, but no solutions I've found so far have helped! I'm getting this message from my ASP.NET app: The application has been running fine for months, yet at...
2
by: Onur | last post by:
Hi.All I'm working on a TTS application. It runs on my local pc (WindowXP pro) without any error. Microsoft Visual Studio .NET 2003, Microsoft .NET Framework SDK v1.1, Microsoft Speech...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.