Local Machine Deployment Without a Deployment Manifest


Local Machine Deployment Without a Deployment Manifest

What if you choose to eschew the convenience of having customization assemblies deployed to centralized network locations? Perhaps there is no suitable location, or the number of users who will be using your customized document is sufficiently small that rolling out new assemblies to all their machines is not particularly onerous. You could always stick with the default behavior, where the customization assembly must be in the same directory as the document it customizes.

As discussed at the beginning of this chapter, however, that leads to the inconvenience of having to copy around the associated files every time you move the document itself. The security system imposes an additional inconvenience: If the customization assembly is in the same location as the document, that location must be fully trusted for some reason other than simply being in the local machine zone.

For these reasons, your users may want the convenience of having one location on their local machine for the customization. That way, the customization need not be moved around with the document, and only one location need be explicitly trusted.

If no deployment manifest is listed in the embedded application manifest, clearly, the VSTO runtime will not be able to resolve the codebase relative to the nonexistent deployment manifest location. Instead, the VSTO runtime will resolve the codebase by taking the path relative to the current document location. Of course, having a relative path to the document again makes it difficult to move the document around without moving the assembly as well. Therefore, it is most likely that the assembly codebase will be an absolute path.

A particularly useful feature when setting the application codebase is that the VSTO runtime will expand any environment variables in the installFrom path. You could set the installFrom path to this, for example:

 <asmv2:installFrom codebase= "%ProgramFiles%\ExpenseReport\ExpenseReport.dll" /> 


Then the VSTO runtime would replace the named environment variable with the appropriate path on the user's machine.

But how does one go about editing these paths? The application manifest in question is embedded in the document's data island. Fortunately, the VSTO runtime provides a convenient object model for manipulating embedded application manifests. The ServerDocument object, which you saw used for manipulating a document's cached data in Chapter 18, "Server Data Scenarios," will come in handy again.




Visual Studio Tools for Office(c) Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
ISBN: 0321411757
EAN: 2147483647
Year: N/A
Pages: 221

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net