S
Stingray
Hi all,
I'm looking for some advice regarding assembly versioning. This is a long
one so please bear with me...
I am doing a lot of new development--all .NET (C#) and running on
Windows2000 servers. I am using Visual Studio and have the version
attribute on all assemblies set to automatically change the revision (last
digit) on each build. I have several assemblies that are shared by multiple
applications. Since these use COM+ they are strong named and live in the
GAC. I am using installers to install everything. Since this is a lot of
new development, there are continuous fixes and enhancements. One of our
components is a Queued Component (using MSMQ). This is the main reason we
chose COM+ over simple assemblies and remoting. Because of this queued
component, every assembly it references must also be strong named and GAC'd.
Now, as we all know, it is possible to keep multiple versions of assemblies
in the GAC. The installers know which versions to install (and uninstall)
and everything is happy. Of course the GAC will fill up with multiple
versions, but who cares. After all, it's only disk space. Since the
installers keep track of everything its ok to be messy. The problem is the
QC. In order to instantiate this component I use the code:
string moniker = "queue:/new:MyNamespace.MyObject";
IMyObject obj = (IMyObject) Marshal.BindToMoniker(moniker);
where MyObject is the queued component. This is the only way I've found to
instantiate a QC. If there's a cleaner .NET way, pleas let me know. Since
there is no way to explicitly specify a version it is not possible to have
multiple versions of this component. I've found that it always picks the
oldest version. This component references other assemblies. Also, as I
said earlier, several programs and web sites use it. Because of all this,
any change to this QC or any of its dependencies requires everything from
that changed assembly up the chain to be rebuilt. For example: Prog1.exe
and Prog2.exe use QC1.dll. QC1.dll uses Comp1.dll. Comp1.dll uses
Comp2.dll. If I make a change to Comp2.dll I must also rebuild and redeploy
all of these other assemblies. This is a nighmare (my actual dependency
graph is more complicated than this). If it weren't for the QC I would only
rebuild the assemblies that need to make use of the new features and let the
others continue running with the old version for a while. But as it stands
now I must rebuild everything.
Am I doing something fundamentally wrong? One solution I can think of is to
give fixed version numbers to everything to force all components to think
everything is ok. This would leave me asking questions like: "Is that
Tuesday's 1.0.0.0 or Friday's 1.0.0.0?" A better alternative along those
lines is to change the binding policies on all components so anything goes.
But then I'd be lost not knowing which version really requires what! It
would also require a lot of manual work maintaining the version mappings.
I've been trying to find a book or online reference that addresses issues
like this but can't find anything. Are there any "best practices" regarding
versioning? And how do QCs fit into the .NET Framework (if at all)? Would
upgrading to Windows2003 (COM+ 1.5) help in any way? (That's not an option
at this point but I'd just like to know).
Help!
TIA,
John
I'm looking for some advice regarding assembly versioning. This is a long
one so please bear with me...
I am doing a lot of new development--all .NET (C#) and running on
Windows2000 servers. I am using Visual Studio and have the version
attribute on all assemblies set to automatically change the revision (last
digit) on each build. I have several assemblies that are shared by multiple
applications. Since these use COM+ they are strong named and live in the
GAC. I am using installers to install everything. Since this is a lot of
new development, there are continuous fixes and enhancements. One of our
components is a Queued Component (using MSMQ). This is the main reason we
chose COM+ over simple assemblies and remoting. Because of this queued
component, every assembly it references must also be strong named and GAC'd.
Now, as we all know, it is possible to keep multiple versions of assemblies
in the GAC. The installers know which versions to install (and uninstall)
and everything is happy. Of course the GAC will fill up with multiple
versions, but who cares. After all, it's only disk space. Since the
installers keep track of everything its ok to be messy. The problem is the
QC. In order to instantiate this component I use the code:
string moniker = "queue:/new:MyNamespace.MyObject";
IMyObject obj = (IMyObject) Marshal.BindToMoniker(moniker);
where MyObject is the queued component. This is the only way I've found to
instantiate a QC. If there's a cleaner .NET way, pleas let me know. Since
there is no way to explicitly specify a version it is not possible to have
multiple versions of this component. I've found that it always picks the
oldest version. This component references other assemblies. Also, as I
said earlier, several programs and web sites use it. Because of all this,
any change to this QC or any of its dependencies requires everything from
that changed assembly up the chain to be rebuilt. For example: Prog1.exe
and Prog2.exe use QC1.dll. QC1.dll uses Comp1.dll. Comp1.dll uses
Comp2.dll. If I make a change to Comp2.dll I must also rebuild and redeploy
all of these other assemblies. This is a nighmare (my actual dependency
graph is more complicated than this). If it weren't for the QC I would only
rebuild the assemblies that need to make use of the new features and let the
others continue running with the old version for a while. But as it stands
now I must rebuild everything.
Am I doing something fundamentally wrong? One solution I can think of is to
give fixed version numbers to everything to force all components to think
everything is ok. This would leave me asking questions like: "Is that
Tuesday's 1.0.0.0 or Friday's 1.0.0.0?" A better alternative along those
lines is to change the binding policies on all components so anything goes.
But then I'd be lost not knowing which version really requires what! It
would also require a lot of manual work maintaining the version mappings.
I've been trying to find a book or online reference that addresses issues
like this but can't find anything. Are there any "best practices" regarding
versioning? And how do QCs fit into the .NET Framework (if at all)? Would
upgrading to Windows2003 (COM+ 1.5) help in any way? (That's not an option
at this point but I'd just like to know).
Help!
TIA,
John