Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Share Application Files Across Versions

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

When you publish an application with Visual Studio or Mage, each application version gets a complete copy of all the files the application is composed of in that version's own subfolder. The advantage of this is that you only need to look in one folder to see all the files that are needed for deployment of that version. It has the disadvantage that if you are supporting more than one version of an application at a time, or if multiple applications use the same libraries, you will have multiple copies of some files that you have to keep synchronized if you make changes to those files.

The application manifest contains the list of files that an application is composed of. That list contains the relative path for each file that is part of the application. However, that relative path must be within the same folder or be a subfolder of the folder where the application manifest resides. As a result, you are constrained in terms of the folder structure that you can use if you want to share files across multiple applications or versions.

As an example, consider two applications, named AppA and AppB, that each have some files that are unique to that application, as well as some files that they share across both applications. If you wanted to avoid duplicating the shared files in both applications' publish folders, you could use a folder structure like the one shown in Figure 1.

Ff650087.03-ClickOnce-shared(en-us,PandP.10).png

Figure 1
Sharing files across published applications

In Figure 1, each application has its own subfolder for its unique files. There is a SharedFiles subfolder under the root publish folder that contains the files shared across both applications. In the root folder, you will have to place the deployment manifest, application manifest, and the .exe.deploy file for the entry point of the application (the shell application executable file) because of path restrictions on where application files can reside relative to those files.

To establish this kind of a folder structure, you will have to use the Manifest Manager Utility or another custom tool. Neither Visual Studio nor Mage support adding files from multiple folders.

To share files across multiple versions of an application or across multiple applications

  1. Publish the first version/application from Visual Studio to its own publish location.
  2. Publish the second version/application from Visual Studio to its own publish location.
  3. Copy the deployment manifests for both applications into a single common publish folder.
  4. Copy the application manifests and entry point .exe.deploy files for each application into the common publish folder.
  5. Create the subfolder where you want common files to reside.
  6. Create the subfolders for each of the application's unique files.
  7. For each application, update the application manifest file list to point to all the application's files where they now reside.
  8. Save and sign the application manifests.
  9. For each application, update the deployment manifest application reference to the new location of the application manifest, and then update the deployment provider URL to the new location of the deployment manifest.
  10. Save and sign the deployment manifests.

ClickOnce isolates each installed application on a client computer. As a result, even if files come from a shared folder on the server, each installation on the client computer will get its own copy of the file by default. The only exception to this is if the shared files are managed assemblies and you strong name those assemblies. When you do this, ClickOnce places the files in a separate location in the ClickOnce cache under the user's profile and creates only a single copy of a strong named assembly that multiple applications can use.

For more information about sharing files across applications, see Automated: Share Application Files Across Versions.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.