Share via


ClickOnce Deployment

This example explains how to perform a ClickOnce deployment using Commerce Server 2009 R2 Marketing Manager as the example. For more information about ClickOnce deployments, see https://go.microsoft.com/fwlink/?LinkId=21067.

Preparation

The first step in configuring the ClickOnce deployment is to prepare the folders and files.

To prepare the folders and files

  1. Create a directory to store the files you will need to deploy. For example, a folder named "Marketing Manager”.

  2. Open a .NET Framework SDK Command Prompt and change to the directory named "Marketing Manager".

  3. Create a subdirectory beneath "Marketing Manager" named after the current version of your deployment. For example, if this is the first time that you are deploying the application, name the folder "1.0.0.0".

  4. Add the following files to the new directory. These files can be found in the Commerce Server product image.

    • MarketingManager.exe

    • MarketingManager.exe.config

    • MarketingManager.resources.dll

    • Microsoft.CommerceServer.BusinessUIMessages.dll

    • Microsoft.CommerceServer.UI.ControlLibrary.dll

    • Microsoft.CommerceServer.UI.DisplayPropertyLabels.dll

    • Microsoft.CommerceServer.UI.UIProcess.dll

    • CSUIReferenceClient.chm

Creating the Application Manifest

You must create an application manifest, which is an XML file that describes an application that is deployed using ClickOnce.

To create the application manifest file

  1. Start the Manifest Generation and Editing UI tool MageUI.exe from the Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin folder.

  2. In the Manifest Generation and Editing UI tool menu, click File, click New, and then click Application Manifest to create a new application manifest.

  3. In the Mage window, in the Navigation Pane, click Name. In the General section, in the Name field, type MarketingApplication and in the Version field, type the version number of this deployment, for example 1.0.0.0.

  4. In the Mage window, in the Navigation Pane, click Files. In the File Population section, click the ellipsis button […], click the folder that contains your application files, for example the folder "Marketing Manager", and then click OK.

  5. Check the check box labeled When populating add the .deploy extension to any file that does not have it, and then click the Populate button. All your application files are then added to the file list. If your application contains more than one executable file, mark the main executable file for this deployment as the startup application by clicking the file and clicking Entry Point from the File Type drop-down list. If your application only contains one executable file, MageUI.exe will mark it for you.

  6. In the Mage window, in the Navigation Pane, click Permissions Required. Make sure that the Permission set type drop-down box is set to FullTrust.

  7. In the Mage window, click File, and then click Save. The Signing Options dialog appears.

  8. In the Signing Options dialog box, if you have a certificate stored as a file on your file system, click Sign with certificate file option and browse for the certificate file by using the ellipsis button [...], and then click OK.

  9. Alternatively, if your certificate is in a certificate store available from your computer, click Sign with stored certificate, click the certificate from the list provided, and then click OK.

  10. Alternatively, if you do not want to sign your file, click Don't Sign.

  11. The Save As dialog appears.

  12. In the Save As dialog box, save the application manifest with the name MarketingManager.exe.manifest under the 1.0.0.0 folder.

Creating the Deployment Manifest

You must create a deployment manifest, which is an XML file that describes a ClickOnce deployment and identifies the current ClickOnce application version to deploy.

To create the deployment manifest file

  1. Start the Manifest Generation and Editing UI tool: MageUI.exe.

  2. In the Manifest Generation and Editing UI tool menu, click File, click New, and then click Deployment Manifest to create a new deployment manifest.

  3. In the Mage window, in the Navigation Pane, click Name. In the General section, in the Name field, type MarketingManager and in the Version field, type the version number of this deployment, for example 1.0.0.0.

  4. In the Mage window, in the Navigation Pane, click Description. Type values for the Publisher and Product fields. Product is the name given your application on the Windows Start menu when you install your application locally.

  5. In the Mage window, in the Navigation Pane, click Deployment Options. From the Application type drop-down box, click Install Locally. In the Start Location field, type the path of your application, for example https://localhost/MarketingManager/MarketingManager.application. Check the Use .deploy file name extension check box.

  6. In the Mage window, in the Navigation Pane, click Update Options. If your application uses the ClickOnce Deployment API to check for updates itself, clear the check box labeled This application should check for updates. In the Update check frequency section, specify how frequently you want this application to check for updates.

  7. In the Mage window, in the Navigation Pane, click Application Reference. Click Select Manifest button and then click the application manifest you created in previous steps. This pre-populates all the values on this window.

  8. In the Mage window, click File, and then click Save. The Signing Options dialog appears.

  9. In the Signing Options dialog box, if you have a certificate stored as a file on your file system, click Sign with certificate file option and browse for the certificate file by using the ellipsis button [...], and then click OK.

  10. Alternatively, if your certificate is in a certificate store available from your computer, click Sign with stored certificate, click the certificate from the list provided, and then click OK.

  11. Alternatively, if you do not want to sign your file, click Don't Sign.

  12. The Save As dialog appears.

  13. In the Save As dialog box, save the application manifest with the name MarketingManager.application under the Marketing Manager folder and then click OK.

Publish Files

As soon as the configuration is complete, you must publish the files.

To create the deployment manifest file

  1. Copy all the files under your Marketing Manager folder to a Web server location, for example C:\inetput\wwwroot.

  2. In Internet Information Services (IIS), create a new virtual directory named Marketing Manager and specify the path of the virtual directory as c:\inetpub\wwwroot\Marketing Manager, for example.

  3. Instruct your users to download and open the application from the URL that is specified in the Deployment Options section of the deployment manifest: https://localhost/MarketingManager/MarketingManager.application.

Updating the Application

There are additional steps to perform when you need to deploy a new version of the application.

To deploy a new version of the application

  1. Create a new folder under your Marketing Manager folder that is named after the new version, for example 1.1.0.0, and move the new application files into the new folder.

  2. Use MageUI.exe to create a new application manifest file as described in the previous steps.

  3. Use MageUI.exe to open the deployment manifest named MarketingManager.application.

  4. In the Mage window, in the Navigation Pane, click Application Reference. Click the Select Manifest button select the new manifest and then click OK.

  5. After updating the application manifest reference, you must re-sign the deployment manifest, because changing a manifest in any way invalidates the digital signature.

Limitations

After a ClickOnce deployment, the application will create an event source if it does not already exist when the application attempts to write an event to the Event log. If the user is not an administrator, the attempt fails and the application will not log any events. In this case, you can create the event source manually.

To create the event source manually

  1. Paste the following code into a new .reg file. Replace the C:\WINDOWS path with the value of your %WINDIR% environment variable if it is different.

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\Commerce Server Business UI]
    "EventMessageFile"="C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\EventLogMessages.dll"
    
  2. Deploy and run the .reg file using administrator privileges on the target computer where the Business Management Applications are installed.

Security

Anything less than "FullTrust" permissions will cause ClickOnce deployment to fail when a client tries to run the package. The user is prompted with a security warning window and must accept the dialog before installation is possible. You can avoid this prompt by installing the publisher's certificate into the client's Trusted Publisher's store. For more information about how to configure ClickOnce Trusted Publishers, see https://go.microsoft.com/fwlink/?LinkId=7390.

See Also

Other Resources

Developing with the Desktop Business Tools Extensibility Kit