How to: Include a Data File in a ClickOnce Appl...
.NET Framework Developer's Guide
How to: Include a Data File in a ClickOnce Application

Each ClickOnce application you install is assigned a data directory on the destination computer's local disk where the application can manage its own data. Data files can include files of any type: text files, XML files, or even Microsoft Access database (.mdb) files. The following procedures show you how to add a data file of any type into your ClickOnce application.

To include a data file by using Mage.exe

  1. Add the data file to your application directory with the rest of your application's files.

    Typically, your application directory will be a directory labeled with the deployment's current version—for example, v1.0.0.0.

  2. Update your application manifest to list the data file.

    mage -u v1.0.0.0\Application.manifest -FromDirectory v1.0.0.0

    Performing this task re-creates the list of files in your application manifest and also automatically generates the hash signatures.

  3. Open the application manifest in your preferred text or XML editor and find the file element for your recently added file.

    If you added an XML file named Data.xml, the file will look similar to the following code example.

<file name="Data.xml" hash="23454C18A2DC1D23E5B391FEE299B1F235067C59" hashalg="SHA1" asmv2:size="39500" />

  1. Add the attribute type to this element, and supply it with a value of data.

<file name="Data.xml" writeableType="applicationData" hash="23454C18A2DC1D23E5B391FEE299B1F235067C59" hashalg="SHA1" asmv2:size="39500" />

  1. Re-sign your application manifest by using your key pair or certificate, and then re-sign your deployment manifest.

    You must re-sign your deployment manifest because its hash of the application manifest has changed.

    mage -s app manifest -cf cert_file -pwd password

    mage -u deployment manifest -appm app manifest

    mage -s deployment manifest -cf certfile -pwd password

To include a data file by using MageUI.exe

  1. Add the data file to your application directory with the rest of your application's files.

  2. Typically, your application directory will be a directory labeled with the deployment's current version—for example, v1.0.0.0.

  3. On the File menu, click Open to open your application manifest.

  4. Select the Files tab.

  5. In the text box at the top of the tab, enter the directory that contains your application's files, and then click Populate.

    Your data file will appear in the grid.

  6. Set the File Type value of the data file to Data.

  7. Save the application manifest, and then re-sign the file.

    MageUI.exe will prompt you to re-sign the file.

  8. Re-sign your deployment manifest

    You must re-sign your deployment manifest because its hash of the application manifest has changed.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Forcing Data Files To Be Placed In The Application Directory Using No Touch Deployment      pearlriverrat   |   Edit   |   Show History

Whenever I published my project, XML files would always be placed in the data directory. Right click on the project, click properties. Click the Publish tab on the properties screen. Click the Application Files button. Change the Publish Status from Data File to Include. The data files will now be copied to the application directory.

Flag as ContentBug
What about in a VSTO application?      DBounce   |   Edit   |   Show History
In a VSTO application you do not have a <Application FIles> button, so that solution does not work. More importantly the solution put forward in the main post also does not work. When you follow the above steps, Mage generates the following error:

Files page - No entry point specified

I have tried one by one to select every file in my application as an entry point, without success.

Any ideas?
Tags What's this?: Add a tag
Flag as ContentBug
Processing
Page view tracker