Proxy Versioning Options for Project Templates

A common question is how to use versioning for the proxy assembly in add-ins.  There are basically three different options.  (Download Sample)

1)    No Versioning:

Only the name of the assembly is used in the project template and the first assembly in the GAC matching this name will be used.  This is how ProjectGen references the proxy in the project template file.
Pros:  Will load any proxy present.
Cons:  No control over which version of the proxy is loaded.  When the intended version is present, but not first in the GAC, it will not load and the project may not build.


2)    Tight Versioning:

The name and version of the proxy assembly is used in the project template with the option specific version set to true.

Pros:  Correct version will always load if present. 
Cons:  If correct version is not present, but a compatible version is, the project will not load the compatible version and build.


3)    Loose Versioning:

A name and version of the proxy assembly is used in the project template with the option specific version set to false or not set.

Pros:  Correct version will load if present.  If correct version is not present the first assembly with a matching name in the GAC will load.
Cons:  No control over which version is loaded if the correct version is not present. 



Here’s some examples which illustrate the differences in versioning.

Assumption- three proxies are in the GAC corresponding to three different versions of the same host:

  1. ShapeAppCSharp Version 1.0.0.0 from VSTA v 1 SDK sample.  Using Host v 1.0.0.0.
  2. ShapeAppCSharp Version 2.0.0.0 from VSTA v 2 SDK sample with version of proxy assembly changed to 2.0.0.0.  Using Host v 2.0.0.0.
  3. ShapeAppCSharp Version 2.1.0.0 from VSTA v 2 SDK sample with a method added to the Application class (Application.DrawingHasShapes) and the version of the proxy assembly changed to 2.1.0.0.  Using Host v 2.1.0.0.  The proxy v 2.1.0.0 is compatible v 2.0.0.0 projects.


Test 1:  Open a VSTA v 2 project for Host v 2.1.0.0 using the method added (Application.DrawingHasShapes) with the above assemblies in the GAC.

No Versioning-  Fail. Project will load the ShapeAppCSharp Version 1.0.0.0 project and not build because this assembly is for the v 1.0.0.0 host which uses VSTA v 1. 

Tight Versioning-  Pass.  Project will load the correct proxy.

Loose Versioning-  Pass.  Project will load the correct proxy.  *Note: if the host which loads this add-in is v 2.0.0.0 the add-in will fail during execution because the method added to v 2.1.0.0 is not present in the host.


Test 2:  Open a VSTA v 2 project for Host v 2.0.0.0 with only the v 2.1.0.0 assemblies in the GAC.

No Versioning-  Pass. Only proxy present will load and the project will build because the v 2.1.0.0 proxy is compatible with v 2.0.0.0 projects.  *Note: if the v1 proxy was still in the GAC this may fail.

Tight Versioning-  Fail.  The specific version of the proxy is not present, so no proxy assembly will be loaded.  *Note by setting the Specific Reference attribute to false in the properties window (in the Project Explorer) the project will change to Loose Versioning and pass.

Loose Versioning-  Pass.  The compatible v 2.0.0.0 will load.  *Note: if the v1 proxy was still in the GAC this may fail.


We offer a sample which shows how to implement Tight Versioning- click here.


Posted Aug 15 2008, 12:35 PM by Melody
Copyright Summit Software Company, 2008. All rights reserved.