Udostępnij za pośrednictwem


How to: Specify an Alternate Location for Deployment Updates

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can install your ClickOnce application initially from a CD or a file share, but the application must check for periodic updates on the Web. You can specify an alternate location for updates in your deployment manifest so that your application can update itself from the Web after its initial installation.

Note

Your application must be configured to install locally to use this feature. For more information, see Walkthrough: Manually Deploying a ClickOnce Application. In addition, if you install a ClickOnce application from the network, setting an alternate location causes ClickOnce to use that location for both the initial installation and all subsequent updates. If you install your application locally (for example, from a CD), the initial installation is performed using the original media, and all subsequent updates will use the alternate location.

Specifying an alternate location for updates by using MageUI.exe (Windows Forms-based utility)

  1. Open a .NET Framework command prompt and type:

    mageui.exe

  2. On the File menu, choose Open to open your application's deployment manifest.

  3. Select the Deployment Options tab.

  4. In the text box named Launch Location, enter the URL to the directory that will contain the deployment manifest for application updates.

  5. Save the deployment manifest.

Specifying an alternate location for updates by using Mage.exe

  1. Open a .NET Framework command prompt.

  2. Set the update location using the following command. In this example, HelloWorld.exe.application is the path to your ClickOnce application manifest, which always has the .application extension, and http://adatum.com/Update/Path is the URL that ClickOnce will check for application updates.

    Mage -Update HelloWorld.exe.application -ProviderUrl http://adatum.com/Update/Path

  3. Save the file.

    Note

    You now need to re-sign the file with Mage.exe. For more information, see Walkthrough: Manually Deploying a ClickOnce Application.

.NET Framework Security

If you install your application from an offline medium such as a CD, and the computer is online, ClickOnce first checks the URL specified by the <deploymentProvider> tag in the deployment manifest to determine if the update location contains a more recent version of the application. If it does, ClickOnce installs the application directly from there, instead of from the initial installation directory, and the common language runtime (CLR) determines your application's trust level using <deploymentProvider>. If the computer is offline, or <deploymentProvider> is unreachable, ClickOnce installs from the CD, and the CLR grants trust based on the installation point; for a CD install, this means your application receives full trust. All subsequent updates will inherit that trust level.

All ClickOnce applications that use <deploymentProvider> should explicitly declare the permissions they need in their application manifest, so that the application does not receive different levels of trust on different computers.

See Also

Walkthrough: Manually Deploying a ClickOnce Application
ClickOnce Deployment Manifest
Securing ClickOnce Applications
Choosing a ClickOnce Update Strategy