ClickOnce Background Update Technology Sample
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
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:
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
At the command prompt, navigate to the location where you saved the uncompressed sample files.
Navigate to the CS directory under the BackgroundUpdate directory.
Type msbuild to build the sample using the solution (.sln) file provided.
To build the sample using Visual Studio
In Windows Explorer, navigate to the location where you saved the uncompressed sample files.
Navigate to the CS subdirectory under the BackgroundUpdate directory.
Double-click the solution (.sln) file to open it in Visual Studio.
On the Build menu, click Build Solution.
The application will be built in the default bin\Debug directory.
To run the sample
Run the MageUI.exe (Manifest Generation and Editing Tool, Graphical Client) 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.
Click the link on the Web page that the tool generates.
To use this sample, the application must be deployed through ClickOnce. You can do this using the Publish Solution menu option or the MageUI.exe (Manifest Generation and Editing Tool, Graphical Client) 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.