Download presentation
Presentation is loading. Please wait.
Published byPeter Hancock Modified over 9 years ago
1
DEV343.NET Application and Library Versioning Juval Löwy www.idesign.net
2
Software architect Former corporate architect of a Fortune 500 company Consults on.NET migration and design MS Regional Director for the Silicon Valley Participates in.NET design reviews Authored Programming.NET Components (2003, O’Reilly) COM and.NET Component Services (2001, O’Reilly) Contributing editor and columnist to several magazines Contact at www.idesign.net About Juval Löwy
3
Outline Sharing and versioning Side-by-side execution Custom version policies CLR versioning
4
Shared Assemblies Assemblies can be private or shared A private assembly resides in the app directory A shared assembly is in a known location, called the global assembly cache (GAC) Shared assembly used for: Sharing Side-by-side execution
5
Shared Assemblies Shared assemblies must have a unique name Called Strong Name Strong name authenticates assembly’s origin and identity Shared assembly implies trust Strong name cannot be generated by a party other than the original publisher Strong name is based on public/private keys pair
6
Shared Assemblies Digitally signs the assembly to verify origin Encrypt manifest using the private key Append signature to manifest Incorporated public key into the assembly To verify authenticity.NET loader generates the hash Decrypts the manifest-stored hash Compare Can only call signed assembly from within signed assemblies
7
[assembly: AssemblyKeyFile("MyAssembly.snk")] Shared Assemblies To generate keys pair: sn.exe –k MyAssembly.snk Add the snk file to assembly info file: Installing in the GAC Drag and drop.NET configuration tool gacutil –i MyAssembly.dll
8
Shared Assemblies You need to reference assembly to build the client But not to deploy it
9
Shared Assemblies Disable client local copy of a shared assembly Set to False automatically if in the GAC already, and not added using the Projects tab Side-by-Side Demo
10
Versioning Assemblies are not necessarily backward- compatible Each client assembly records in manifest exact version of ot5her server assemblies.NET resolves compatibility at runtime Version number is the product of: Major,Minor,Build,Revision Recorded as assembly attribute [assembly: AssemblyVersion("2.1.1524.1")] Major Minor Build Revision
11
Either explicitly specify version numbers, or rely on compiler What is not specified is zeroed If you provide major & minor, can * build and revision Build is number of days since January 1, 2000, LIMA Revision is half number of seconds since midnight, LIMA [assembly: AssemblyVersion("2")] [assembly: AssemblyVersion("2.1")] [assembly: AssemblyVersion("2.1.*")]//best [assembly: AssemblyVersion("2.1.1524")] [assembly: AssemblyVersion("2.1.1524.*")] Versioning
12
Resolving Version When trying to use a shared assembly Possible many versions of the same assembly in the GAC Client always gets assembly with exact version match Can provide custom policy Developers must be disciplined Release procedures
13
Resolving Version Private assembly can be strongly named.NET ignores version of private assemblies with friendly name only.NET enforces version compatibility of private assembly with strong name
14
Resolving Version Conclusions Private assemblies with only friendly names must be backward compatible Private assemblies with strong name may not be backward compatible Even if a private assemblies with strong name is backward compatible (content wise), if the version number is not compatible, it may result in an exception Private assembly deployment model is really intended to work with friendly names only
15
Custom Version Policy Application can provide version binding policy Override default policy For shared and private assemblies Can deploy machine-wide policy.NET configuration tool MMC snap-in
16
Custom Version Binding Binding policy:
17
Custom Version Binding Codebase policy: Redirect to new location
18
CLR Versioning.NET rigorous version computability enforcement makes CLR versioning an interesting problem Different set of ground rules for CLR versioning CLR version used depends on: What the app is built with Available.NET versions Application CLR versioning policy
19
CLR Versioning CLR and application frameworks assemblies treated as one versioning unit Avoid mix-and-match Intend to be backward compatible, but not forward Developers must test and certify support for each CLR version
20
CLR Versioning CLR Side-By Side execution Multiple CLR versions on same machine Can install and uninstall versions separately
21
CLR Versioning Version unification Host process uses single CLR version.NET always runs unified stack of framework assemblies EXE application assembly and class libraries it loads use same CLR version Application select CLR and application frameworks version Class libraries have no say
22
CLR Versioning Default CLR version resolution.NET detects version app compiled with Loads latest compatible CLR version on machine Compatibility list maintained in Registry Can lead to undetermined results
23
CLR Versioning Applications that rely on default typically mainstream applications Use subset of types and services supported by all CLR versions Implicitly stating any compatible CLR version is allowed
24
Specifying supported CLR versions in config file For deterministic results In order of priority CLR Versioning
25
If no supported version is found,.NET refuses to load CLR Versioning
26
Can specify supported runtime at project setting
27
CLR Versioning Can specify supported runtime at project setting
28
More at TechEd C# Best Practices Day July 01 Distributed Security Practices Day July 02 Building High-Performance Applications with Visual Studio.NET Day July 03 Application and Library Versioning Day July 03 Software Legends Friday July 04
29
Resources Programming.NET components By Juval Lowy, O'Reilly April 2003 www.idesign.net.NET Master Class 3-4 annually Upcoming events on www.idesign.net www.idesign.net
30
Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx
31
evaluations evaluations
32
SOFTWARE LEGEND Juval Lowy THURSDAY 3rd JULY at 16.15-16.45 hrs Meet the Author’s Book signing
33
© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.