This sample illustrates how to use
Tight Versioning to specify which version of the proxy a project template should use.
Goal:
load add-ins which use a proxy from a previous OM after changing the OM.
OM version changes (using same VSTA version):
Example- ShapeAppBasicCSharp from
VSTA v 2
Object Model Changes
|
Version 2.1
|
Version 2.2
|
|
SDK Sample from VSTA v 2
|
SDK Sample from VSTA v 2 with new method added: Application.ActiveDrawingHasShapes
|
Instructions to run sample:
1)
Build the Versioning Sample\ShapeAppCSharp v 2.1
sample.
2)
Run the Versioning Sample\ShapeAppCSharp v 2.1
setup file.
3)
Build the Versioning Sample\ShapeAppCSharp v 2.1
sample add-in. Add-in hooks into the document
created event, creates a document and adds a shape.
4)
Run the Versioning Sample\ShapeAppCSharp v 2.1
sample host- verify that the add-in loaded and correctly executed.
5)
Build the Versioning Sample\ShapeAppBasicCSharp
v 2.2sample.
6)
Run the Versioning Sample\ShapeAppBasicCSharp v 2.2
setup file.
7)
Build the Versioning Sample\ShapeAppBasicCSharp
v 2.2 sample add-in. Add-in hooks into
the document created event, creates a document and adds a shape if none are
present in the current drawing.
8)
Run the Versioning Sample\ShapeAppBasicCSharp v 2.2-
verify that both v2.1 and v2.2 add-ins load and correctly execute.
9)
Run the Versioning Sample \ShapeAppCSharp v 2.1
sample host- verify that the v2.1 loads and executes correctly; however, the v2.2
add-ins will load but not execute because it uses an OM feature not supported
by the v2.1 host.
In the Versioning
Sample\MyDocuments folder the AppAddins folder contains the assemblies for the
v2.1 and v2.2 add-ins. The AppAddins
folder can be placed in %MyDocuments%\ShapeAppCSharp_Versioning instead of
building the sample add-ins.
Instructions to Implement:
1)
Version the host exe. (see doc in zip file for screenshots)
2)
Version the proxy assemblies. (see doc in zip file for screenshots)
3) In the project templates, use version specific
proxy references. (see doc in zip file for screenshots)
4)
So that add-ins will run the current exe, use a
registry instead of literal location to specify the host exe. (see doc in zip file for screenshots)
5)
Installation:
To run and build
add-ins, the version of the proxy that the add-in uses must be installed on the
end users machine.
|
Required Proxy Assembly to build and
run add-ins
|
Add-in v 2.1
|
Add-in v 2.2
|
Add-ins v 2.1 & 2.2
|
|
Host v 2.1
|
Proxy 2.1
|
Proxy 2.2*
|
Proxy 2.1 & 2.2*
|
|
Host v 2.2
|
Proxy 2.1
|
Proxy 2.2
|
Proxy 2.1 & 2.2
|
Examples:
·
For users who have the 2.1 and/or the 2.2 version
of the host, to build and run only v 2.1 add-ins only the v 2.1 proxy is
required.
·
For users who have the 2.1 and/or 2.2 version of
the host, to build and run only v 2.2 add-ins only the v 2.2 proxy is required.*
·
For users who have the 2.1 and/or 2.2 version of
the host, to build and run both v 2.1 and v 2.2. add-ins, both the v 2.1 and v
2.2. proxies are required.*
*Note: The host v 2.1 can load and execute v 2.2
add-ins, unless the v 2.2 add-in uses OM features that were not present in v
2.1. For example, the v2.1 host loading
a v2.2 add-in calling Application.ActiveDrawingHasShapes will fail.