Книга: C# 2008 Programmer

Under the Hood: Application and Deployment Manifests

Under the Hood: Application and Deployment Manifests

When you use the Publish Wizard to publish your application using ClickOnce, Visual Studio 2008 publishes your application to the URL that you have indicated. For example, if you specified http://localhost/PhotoViwer/ as the publishing directory and your web publishing directory is C:Inetpubwwwroot, then the virtual directory PhotoViewer will be mapped to the local path C:InetpubwwwrootPhotoViewer.

Two types of files will be created under the C:InetpubwwwrootPhotoViewer directory:

? Application Manifest

? Deployment Manifest

The next two sections take a closer look at these two types of files.

Application Manifest

When you publish your application, three files and a folder are created in the publishing directory (see Figure 16-30):

Application Files — Folder containing the deployment files.

A publish.htm web page — This contains instructions on how to install the application. 

Application manifestPhotoViewer.application. This is the file that is referenced by the publish.htm file. An application manifest is an XML file that contains detailed information about the current application as well as its version number. Chapter 15 has more about application manifests.

? setup.exe — A setup application that installs the application onto the target computer.

Figure 16-30

The Application Files folder contains the various versions of the application that have been published (see Figure 16-31).

Figure 16-31

When you republish your application using ClickOnce, the content of PhotoViewer.application, publish.htm, and setup.exe are modified, and one new application manifest is created inside a new folder (for instance, PhotoViewer_1_0_0_6; located within the Application Files folder), containing the new version of deployment files, will be created.

As mentioned, the PhotoViewer.application application manifest is an XML file that contains detailed information about the current application as well as its version number. It allows the client to know if he needs to update his application.

Deployment Manifest

The deployment manifest — PhotoViewer.exe.manifest, in this example — is located in the C:InetpubwwwrootPhotoViewerApplication FilesPhotoViewer_1_0_0_6 directory (assuming that the latest version published is; see Figure 16-32). It contains detailed information about the application (such as dependencies and attached files).

Figure 16-32

The PhotoViewer.exe.deploy file is the executable of your application. Other files in the same directory may include files/databases used by your application. During installation these files will be deployed (downloaded) onto the user's machine.

Where Are the Files Installed Locally?

When the user installs an application onto his computer via ClickOnce, he does not have a choice of where to store the application. In fact, the application is stored on a per-user basis, and different versions of the application are stored in different folders. For example, when I installed the example application on my computer, the application files were stored in:

C:Documents and SettingsWei-Meng LeeLocal SettingsApps2.0JGEG6REQ.YQKC2N9O65K.16Dphot..tion_4f46313378dcdeb5_0001.0000_ff3a6bf346a40e4d

Generally, application files are stored in subdirectories under the C:Documents and Settings<User Name>Local SettingsApps2.0 folder. To find this directory programmatically during runtime, use the following code snippet:

//---ExecutablePath includes the executable name---
string path = Application.ExecutablePath;
//---Strip away the executable name---
path = path.Substring(0, path.LastIndexOf(@""));

Оглавление книги

Генерация: 1.173. Запросов К БД/Cache: 3 / 1
Вверх Вниз