Home | Shorter Path | About Me
Home
About Me

Archive

2004

01

02

03

04

05

06

07

08

09

10

11

12

 

2005

01

02

03

04

05

06

07

08

09

10

11

12

 

2006

01

02

03

04

05

06

07

08

09

10

11

12


Strong-named assemblies and AssemblyVersion

Monday, May 17, 2004 05:25 PM

You can create strong-named assemblies in Delphi 8 by setting the AssemblyKeyFile attribute to your key file (created by the sn.exe utility). If you do, however, remember to set the AssemblyVersion attribute. By default, Delphi adds the following attribute to a new assembly (package or library):

[assembly: AssemblyVersion('1.0.*')]

This causes the compiler to assign automatic release and build numbers each time the assembly is compiled. The problem here is that if any other assembly references the strong-named assembly, the reference will be broken. Strong-naming is based on being able to uniquely identify an assembly based on four attributes: a file name, a version number, a culture identifier, and a public key token. Unless you explicitly set the AssemblyVersion attribute to a full version number, each compilation would produce a different strong-named assembly. Only change any part of the version number when working on a new version that will actually be deployed.

Note that an assembly can include other version attributes, such as AssemblyFileVersion and AssemblyInformationalVersionAttribute, but those are purely informational and are not used by the CLR.

By the way, Visual Studio .NET has the same problem. The AssemblyInfo.cs created with a new project contains the same incorrect setting for the AssemblyVersion attribute.

Copyright 2004 Yorai Aminov