473,385 Members | 2,069 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,385 software developers and data experts.

how much of this is still true (assembly versioning & the gac)


orig ref here
http://groups.google.com/group/micro...db5b7e3da283b9
I have pasted the part I'm interested in below. My company doesn't use
versioning or the gac and I'd like to. We're on vs.net 2005 & .net 2., is
this still true or has it changed since then?

thanks
That article is not entirely accurate. As long as you don't make a change
that causes the assembly hash value to change, you can update a new version
of the assembly in the GAC and the ASP.NET application will automatically
use the new version without changing anything. (It should be noted that
you do still have to reload the app domain.)
What changes the hash value? If you change the assembly name, the major or
minor version, the public key token, or the culture, the hash value will
change. As long as you don't modify any one of these, you would use the
following procedure to update the assembly in the GAC.
1. Run sn to create a new verification entry for the new version. Do that
as
follows:
sn -Vr <assembly>
2. Run Gacutil to reinstall the assembly as follows:
gacutil /nologo /if <assembly>
Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your
application will use the new assembly.
If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases where
you can't redirect the assembly binding in a configuration file is to use a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.
Here is an example of doing this. In this example, my assembly is called
jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.
1. Change code in version 1.0.0.0 of the assembly.
2. Change version number in assemblyinfo.cs to reflect new version.
3. Rebuild assembly.
4. Create publisher policy file in any text editor. You will need to
replace "<public_key>" with the public key for your version 1.0 assembly.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="jcGAC"
publicKeyToken="<public_key>"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
5. Use al to create the publisher policy assembly. The publisher policy
assembly MUST have the following file format:
policy.major_ver.minor_ver.assembly.dll
The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is
an example of the command entered to create the publisher policy assembly
for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.
al /link:pub.config /out:policy.1.0.jcGAC.dll /keyfile:jcgac.snk
6. Install publisher policy assembly into the GAC.
gacutil /i policy.2.0.jcGAC.dll
7. Install version 2.0.0.0 of your assembly into the GAC.
gacutil /i jcGAC.dll
8. Restart the app domains by either saving a change to the machine.config
or by resetting IIS.
9. Run the ASP.NET app.
After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps
explain a bit.
Jim Cheshire, MCSE, MCSD [MSFT]

Mar 16 '07 #1
1 2225
A couple new questions, (assuming this is uptodate which I think it is)

in one week I have this
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
then next week I have a new major version, do I do this
<bindingRedirect oldVersion="1.0.0.0"
newVersion="3.0.0.0"/>
or this
<bindingRedirect oldVersion="2.0.0.0"
newVersion="3.0.0.0"/>

and second ,

if we're currently not using versioning at all meaning there is no
assemblyinfo file set up with any version (which I think means we're always
at 1.0.0.0.) , how much work would it be to implement this. Could I just
version the new version of the component (aka add the assemblyinfo file and
set it to 1.1.0.0 or 1.0.0.1) and add the versioning policy assembly and not
have to recompile the 20 something apps that are using it . Assuming the
function params don't change?
Thanks


"Coaster" <Co*****@Coaster.netwrote in message
news:eJ**************@TK2MSFTNGP06.phx.gbl...
>
orig ref here
http://groups.google.com/group/micro...db5b7e3da283b9
I have pasted the part I'm interested in below. My company doesn't use
versioning or the gac and I'd like to. We're on vs.net 2005 & .net 2., is
this still true or has it changed since then?

thanks
That article is not entirely accurate. As long as you don't make a change
that causes the assembly hash value to change, you can update a new
version
of the assembly in the GAC and the ASP.NET application will automatically
use the new version without changing anything. (It should be noted that
you do still have to reload the app domain.)
What changes the hash value? If you change the assembly name, the major
or
minor version, the public key token, or the culture, the hash value will
change. As long as you don't modify any one of these, you would use the
following procedure to update the assembly in the GAC.
1. Run sn to create a new verification entry for the new version. Do
that
as
follows:
sn -Vr <assembly>
2. Run Gacutil to reinstall the assembly as follows:
gacutil /nologo /if <assembly>
Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your
application will use the new assembly.
If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases
where
you can't redirect the assembly binding in a configuration file is to use
a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.
Here is an example of doing this. In this example, my assembly is called
jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.
1. Change code in version 1.0.0.0 of the assembly.
2. Change version number in assemblyinfo.cs to reflect new version.
3. Rebuild assembly.
4. Create publisher policy file in any text editor. You will need to
replace "<public_key>" with the public key for your version 1.0 assembly.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="jcGAC"
publicKeyToken="<public_key>"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
5. Use al to create the publisher policy assembly. The publisher policy
assembly MUST have the following file format:
policy.major_ver.minor_ver.assembly.dll
The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is
an example of the command entered to create the publisher policy assembly
for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.
al /link:pub.config /out:policy.1.0.jcGAC.dll /keyfile:jcgac.snk
6. Install publisher policy assembly into the GAC.
gacutil /i policy.2.0.jcGAC.dll
7. Install version 2.0.0.0 of your assembly into the GAC.
gacutil /i jcGAC.dll
8. Restart the app domains by either saving a change to the
machine.config
or by resetting IIS.
9. Run the ASP.NET app.
After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps
explain a bit.
Jim Cheshire, MCSE, MCSD [MSFT]

Mar 16 '07 #2

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

Similar topics

0
by: Ken Durden | last post by:
I'm working on a client-server application where the client is controlling two devices (aka servers) which both implement the same interface contract. We have a set of about 4 assemblies which...
10
by: Simon Wallis | last post by:
I know the general purpose for the GAC is to share a component among many applications. But even when you add something to the GAC, you still have to manually create a reference to the DLL in your...
3
by: RickN | last post by:
We have a C# remoting application that runs thru the web. Assemblies appear to be loaded from the download cache. Is there any way to have them automatically copied to the GAC and be loaded from...
2
by: Ily | last post by:
Hi I have several versions of an assembly in the GAC My problem is that I want my clients (windows + web clients) to use a specific version of an assembly I can get this to work by using...
11
by: Just Me | last post by:
I have a solution containing many usercontrol projects. When I wish to reference a usercontrol in another project I can select either the project or the assembly. Does it make a difference which...
6
by: Nak | last post by:
Hi there, I was wondering if anyone knew of a way to maintain compatability with assemblies providing the interfaces remains the same? At the moment if I re-compile an assembly without actually...
2
by: jtyner | last post by:
I am trying to get QFE (Quick Fix Engineering) working with an assembly installed in the GAC. I have two books that claim if two different version of the assembly are installed in the GAC -AND-...
1
by: jtyner | last post by:
I am trying to get QFE (Quick Fix Engineering) working with an assembly installed in the GAC. I have two books that claim if two different versions of the assembly are installed in the GAC -AND-...
6
by: Ben | last post by:
Hi all, First i have to state this is my first entry ever in a forum. So please be forgiving... I am a newbe to dotnet versioning... The Situation is the following: Our application is using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.