• 智能部署与更新


    下面我将给大家介绍如何在.net2005中智能部署与更新智能客户端程序

     

    This demonstration shows how to publish a ClickOnce application using the integrated tools in the Visual Studio 2005 IDE and then how to deploy updates to the same application. The demonstration also shows how an installed ClickOnce application is integrated into the Windows shell.

    Task 1: 新建一个工程windows窗体

    Task 2:应用发布向导

    1. Select the Build | Publish ClickOnce_Hello menu command.
    2. This launches the Publish Wizard. This provides the most direct method for configuring and publishing an application for ClickOnce deployment.
    3. Note that the Publish Wizard is also accessible from the context menu in Solution Explorer, as well as from the Publish pane of the Project Designer. Later in this demonstration, you will explore the Publish pane in more detail.
    4. In the Publish Wizard, in the Where do you want to publish the application? page, for Specify the location to publish this application, confirm that the value is "http://localhost/ClickOnce_Hello".
    5. By default, the publish location is based on the name of the main application. Also, by default, the application is published to a Web site. Other location options include an FTP site, a disk location, or network share. You could also publish to a remote Web site. Publishing to a Web site requires that the target IIS is configured to use Front Page Server Extensions.
    6. Click Next.
    7. In the Will the application be available offline? page, explain the two installation mode options. The default setting, Yes, this application is available online or offline, provides that the application will be installed on the user's local machine and will have both a shortcut menu and a presence in the Add or Remove Programs list. Use this default selection.
    8. The other option, No, this application is only available online, provides that the application will launch directly from the publish Web page and will NOT be integrated in the Windows shell.
    9. Choose “Yes, this application is available online or offline.” Click Next.
    10. In the Summary page, note that the text summarizes the location and type of ClickOnce deployment you are publishing.
    11. Click Finish.
    12. The Output window will display the compilation and publication progress step-by-step while the status bar of the Visual Studio 2005 IDE tracks overall progress. The publishing engine creates the necessary files for the deployment: including the application binary files, the deployment and application manifests, a bootstrapper program, and an HTML page: and stores them in a local project directory. When publishing to a Web site for the first time, the publishing engine then creates a new Web application on the target server (if it doesn't already exist) and copies the deployment files from the project directory to the virtual directory. When publishing has completed, the newly created publish.htm page launches automatically in an instance of Internet Explorer.

    Task 3: 安装一次性部署 智能客户端程序

      In Internet Explorer, in the ClickOnce_Hello page, click the Install button. This launches the Application Install dialog box.

    1. The Application Install dialog box notifies the user that the application is from an unknown software publisher. The message also indicates that the application may require unrestricted access to the user's machine. Optionally, you can click More Information to display more information about machine access and publishers.
    2. In the Application Install dialog box, click Install.
    3. The ClickOnce client service installs the application on the local machine and, when complete, launches the newly installed application.

    1. In Hello ClickOnce, the displayed deployment information indicates that this is a ClickOnce-deployed application. The Running version and Updated version numbers specify the version of the deployment. Update location identifies the deployment manifest (identified by the .application file extension).
    2. Select the Help | About menu command.
    3. This demonstrates that the deployment version is different than the version of the application assembly.
    4. Close the application.
    5. Navigate to Start | All Programs | Northwind Traders | ClickOnce_Hello.
    6. This shows that the application has an offline presence.
    7. Close the application.

     

    Task 4: Configure ClickOnce Settings

    1. In Visual Studio, under the ClickOnce_Hello project, double-click the Properties folder.
    2. This opens the Project Designer.
    3. In the Project Designer, click the Publish tab.
    4. In the Publish pane, review the available settings options.
    5. The attributes you specified in the Publish Wizard are available here (Publishing location, Install Mode). Explain that you can specify a documentation URL or an installation URL (if it differs from the publishing location). Explain Publish Version, which controls the version of the deployment and which can be set manually or incremented automatically (the default). (The Publish Version displays in the deployment information control of the demonstration application.)
    6. Click Options.
    7. Review the ClickOnce deployment property settings available in the Publish Options dialog box. The Publish Language value, for example, specifies the language used for the display prompts presented to users when they install a ClickOnce application (not the language of the underlying application or the publish.htm page).
    8. Uncheck “Open deployment web page after publishing.”
    9. This property controls whether or not the publish.htm page opens automatically every time you publish a ClickOnce application from the Visual Studio 2005 IDE. The publish.htm file itself is created only once: the first time the application is published; this means that after this page is created you can use any HTML editor you like to customize the look and feel of the page without running the risk that it will be overwritten when you publish updates to the deployment.
    10. Click OK.
    11. In the Publish pane, click Updates.
    12. The Application Updates dialog box allows you to configure the deployment for different types of update scenarios. This includes whether the application should check for updates before it starts, or while the application is running. You can also control how frequently the application should check for updates, and whether or not updates are mandatory. You can even disable automated update checking entirely by unchecking The application should check for updates; an appropriate choice in a situation where you want to control update checks programmatically.
    13. (Of course, configuring update checking is not available for applications configured to only run online, in which case they always run the most recent version of the application.)
    14. Click OK.
    15. In the Publish pane, click Prerequisites.
    16. In the Prerequisites dialog box, note that the .NET Framework 2.0 component is selected. By default, the publishing engine creates a setup program containing this component. Any other redistribution packages you select in this dialog box are included in the bootstrapper program deployed with the application (you can also add your own redistribution packages to this list). If you are working in a managed network where you know for certain that all of the application prerequisites are already installed on users machines, you can uncheck Create setup program to install prerequisite components to exclude the setup program from the deployment.
    17. You can also use this dialog box to specify a separate download location for prerequisites. This makes sense if you are in a corporate environment where a number of different applications require the same prerequisites; installing them from a common location saves network bandwidth and storage space and makes updating the prerequisite setup program easier to manage.
    18. Click OK.
    19. In the Publish pane, click Application Files.
    20. In the Application Files dialog, review the different files included in the deployment. In this demonstration, this includes both the primary application assembly (ClickOnce_Hello.exe and ClickOnce_Hello.exe.config), but also the application icon file (Earth.ico) and the assembly for the custom user control (SmartClient.controls.dll).
    21. In deployment scenarios that include large files, you can use this dialog box to mark non-essential files as optional (Help files, for example). Do this by creating a new project group and assigning files to the group as necessary. You could then control how and when these files are later downloaded programmatically using the ClickOnce APIs.
    22. You can also explicitly exclude files from the deployment. In this case, you could change the Type of the Hello_ClickOnce.pdb file or SmartClient.controls.pdb file from (Default) to Exclude.
    23. Click OK.

    Task 5: Deploy and Install Updated Application

    1. Optional: alter the appearance of the application.
    2. This will help signify that the application has been changed and needs to have the update published via ClickOnce. This can be as trivial as changing the background color of the main form. However, this is not a requirement for publishing a new version of the deployment.
    3. In the Publish pane, note that the Publish pane has buttons for invoking the Publish Wizard and for publishing directly using Publish Now.
    4. Click Publish Now.
    5. Navigate to Start | All Programs | Northwind Traders | ClickOnce_Hello.
    6. When you start the application, a status dialog displays. This is rendered by the ClickOnce client service (dfsvc.exe, which you can locate as a running process in Task Manager). This dialog appears while this service reads the local copy of the deployment manifest to determine if an update check is necessary. It then communicates with the updated deployment manifest at the publishing location and learns that an update is indeed available. It then displays an Update Available dialog box to the user.
    7. Because in this case the update is not mandatory, users have the option of installing the update or skipping the update. For a mandatory update, the ClickOnce service does not prompt the user and installs the new version automatically.
    8. In the Update Available dialog box, click Ok.
    9. The ClickOnce service installs the new version of the application and then launches it.

    Task 5: Roll the Application Back

    1. Navigate to Start | Control Panel | Add or Remove Programs.
    2. In Add or Remove Programs, select ClickOnce_Hello.
    3. Click Change or Remove.

    In the ClickOnce_Hello Maintenance dialog box, you have the choice of removing the application entirely or rolling it back to the previous version. Note that ClickOnce only supports rollback to the immediately preceding version.

    1. Select Restore the application to its previous state.
    2. Navigate to Start | All Programs | Northwind Traders | ClickOnce_Hello.

    The version will have changed back to its previous version and displays 1.0.0.0.

    Task 7: Uninstall the Application

    1. Navigate to Start | Control Panel | Add or Remove Programs.
    2. In Add or Remove Programs, select Northwind Traders ClickOnce_Hello.
    3. Click Click here for support information.

    The Support Info dialog box displays the version and update location of the application.

    1. Click Close.
    2. Click Change or Remove.
    3. Select Remove the application from this computer and then click OK.
    4. Optional: after uninstall is complete, show that the shortcut to the application has been removed from the start menu.
    5. Close Visual Studio without saving changes.
  • 相关阅读:
    Java实现文件夹下文件实时监控
    JAVA读取文件夹大小
    Java获取Linux上指定文件夹下所有第一级子文件夹
    自定义日志框架实现
    Node爬取简书首页文章
    NodeJS多进程
    NodeJS 连接接MySQL
    NodeJS Web模块
    NodeJS 模块&函数
    NodeJS Stream流
  • 原文地址:https://www.cnblogs.com/daitengfei/p/358485.html
Copyright © 2020-2023  润新知