NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Side by Side

The ability to run multiple versions of the same code simultaneously is referred to as side-by-side execution. Supporting side-by-side is essential to providing robust versioning in the NGWS runtime. Code that is side-by-side capable has more flexibility it terms of providing compatibility with previous versions. For example, code that cannot run side-by-side must remain completely backward compatible with all previous versions because only one version (typically the latest) can be running on the system at the same time. Given a robust versioning system, side-by-side components do not need to maintain strict backwards compatibility. Consider the situation where ClassX supports side-by-side and makes an incompatible change between version 1 and version 2. Callers of ClassX that expressed a dependency on version 1 will always get version 1 regardless of how many later versions of ClassX are installed on the machine. The caller would only get version 2 if it specifically "upgraded" its version policy.

Support for side by side storage and execution of different versions of the same assembly is clearly an integral part of the versioning story and is built into the infrastructure of the NGWS runtime. As mentioned, the compatibility version number is part of an assembly’s identity. As a result, the storage of multiple versions of the same assembly in the global assembly cache and the loading of those assemblies at runtime just works.

Discussions of side-by-side execution often distinguish between running side-by-side on the same machine and running side-by-side in the same process.

Side-by-side on the same machine simply means that multiple versions of the same application can run on the same machine at the same time without interfering with each other. For example, if versions 4 and 5 of IE supported side-by-side on the same machine, a user could run IE 4 and IE 5 on the same machine simultaneously. An application that supports running side-by-side on the same machine must not have specific dependencies on machine-wide state. For example, if an application uses a file at a specific location for a cache it must either handle the case where multiple versions of the application are accessing the file at the same time, or must remove the dependency on the specific location and allow each version to have its own cache file.

Running side-by-side in the same process places more stringent requirements on the developer of the code. To run side-by-side in the same process multiple versions cannot have any strict dependencies on process-wide resources (i.e like using a single name for a memory mapped file, for example). The ability to run side-by-side in the same process provides a great deal of flexibility for hosting environments. As an example, consider the case where a web server is hosting applications from two different vendors that both use a common component like a data access library. If the data access library did not support side-by-side in the same process, the web server would need to ensure that applications with conflicting dependencies such as this were run in separate processes. It is also possible for a single application with a large dependency graph to use multiple versions of the same component. As a further refinement to side by side in the same process, the NGWS runtime also allows multiple versions of the same assembly to run in the same AppDomain. Whether this behavior is useful is still up for debate.