How to: Update Deployed Office Documents That Use Managed Code Extensions (2003 System)
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
If a solution document, template, or workbook has been deployed to each end user and the solution assembly is in a network location, the document cannot easily be updated automatically. However, you can use the procedures outlined in this topic to provide automatic notification to end users that the current Office document is outdated, and that they must get a newer version.
The basic steps are:
Create a new Microsoft Office Word 2003 or Microsoft Office Excel 2003 application project based on the document that has been updated. The assembly from this project will be used to provide notification to users that they must get the updated document.
Move the assembly that is currently in use to a new location, and put the notification assembly in the original location.
Point the updated document to the new project assembly location.
If you do not want to completely prevent users from working with the outdated solution, you can call the notification using the Startup event of your existing solution. This reminds users to update every time they open the document.
To create a new project based on an updated document
Make the required revisions to a copy of the existing document, template, or workbook.
In Visual Studio, create a new Word or Excel application project of the same type as your existing solution.
You will use the assembly in this project as a notification assembly, to replace the project assembly that the outdated Office document points to.
In the Visual Studio Tools for Office Project Wizard, select Copy an existing document.
Next to the Path to the existing document box, click Browse and navigate to the updated document.
Select the document, and then click Open.
Click Finish to create the project based on the updated document.
To create a notification assembly
In the Startup method of the new assembly (the notification assembly), write code to show a message box that contains the information that the user needs to get the updated document. The following code shows an example.
Change the output name for the notification assembly by using the project properties so that it has the same name as the project assembly used in your solution. Ensure that the notification assembly has the necessary evidence to be trusted by your deployed solution, such as the correct certificate.
To replace the project assembly with the notification assembly
Copy the project assembly that your solution uses to a new location, and grant it trust at the new location. For more information, see How to: Grant Permissions to Folders and Assemblies (2003 System).
Put the updated Office document in the new location, and copy the deployment and application manifests to the new location.
Edit the new application manifest so that it points to the new deployment manifest and assembly. For more information, see Application Manifests for Office Solutions (2003 System).
Increase the version of the application manifest.
Edit the new deployment manifest so that it points to the new application manifest. For more information, see Deployment Manifests for Office Solutions (2003 System).
Increase the version of the new deployment manifest.
Update the application manifest that is embedded in the document to point to the new deployment manifest location. For more information, see How to: Change the Path to the Deployment Manifest Programmatically (2003 System).
Now the updated document and the assembly that it points to are ready to be used, as soon as the end users know where to get the updated document.
Deploy the notification assembly to the old assembly location and remove the project assembly. The next time a user opens the outdated Office document, the notification assembly runs, and the user sees the message box that contains information about how to get the latest document version.