Share via


ClickOnce Background Update Technology Sample

The following sample demonstrates using the ClickOnce API to download a ClickOnce application update as a background task.

For information about using the samples, see the following topics:

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build the sample using the command prompt

  1. At the command prompt, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to the CS directory under the BackgroundUpdate directory.

  3. Type msbuild to build the sample using the solution (.sln) file provided.

To build the sample using Visual Studio

  1. In Windows Explorer, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to the CS subdirectory under the BackgroundUpdate directory.

  3. Double-click the solution (.sln) file to open it in Visual Studio.

  4. On the Build menu, click Build Solution.

The application will be built in the default bin\Debug directory.

To run the sample

  1. Run the Manifest Generation and Editing Tool, Graphical Client (MageUI.exe) that is included with the Windows Software Development Kit (SDK). This tool generates an application manifest and publishes the project to a Web server you choose. When prompted, enter the path to that Web server.

  2. Click the link on the Web page that the tool generates.

Requirements

.NET Framework Version: 2.0

Remarks

To use this sample, the application must be deployed through ClickOnce. You can do this using the Publish Solution menu option or the Manifest Generation and Editing Tool, Graphical Client (MageUI.exe) that is provided with the Windows SDK. Both will generate manifest files and publish the project to the Web server you choose. To run the application, you can click the link that appears on the generated Web page. For more information, see Walkthrough: Manually Deploying a ClickOnce Application.

Because this sample demonstrates dynamically updating an application, you must publish an update to the application to detect or perform an available update. To accomplish this you can open the deployment manifest using MageUI.exe and choose the version number. This causes ClickOnce to determine that an update is available. You can also modify source code files using Visual Studio, even to make a simple change such as adding a comment, and re-publish the application.

See Also

Reference

ApplicationDeployment

Manifest Generation and Editing Tool, Graphical Client (MageUI.exe)