`
wanjianfei
  • 浏览: 325811 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

安装与部署(from MSDN)

阅读更多
VisualStudio

Walkthrough: Deploying a Windows Application

<!--NONSCROLLING BANNER END-->
<!-- Topic Status -->

This walkthrough demonstrates the process of creating an installer for a Windows application that launches Notepad. In this walkthrough, you will create the Windows application, then create an installer that sets up shortcuts and file associations, adds an entry to the registry, displays custom dialogs, and checks the version of Internet Explorer during installation.

NoteWhen creating your own installers, not all of these steps are necessary. This walkthrough is intended to introduce you to some of the optional capabilities of deployment that you may find useful. To create a basic installer, complete the first four sets of procedures.

To create a Windows application

  1. On the File menu, point to New, and choose Project.
  2. In the New Project dialog box, select Visual Basic Projects in the Project Types pane, and then choose Windows Application in the Templates pane. In the Name box, type My Notepad.
  3. Click OK to close the dialog box.

    The project is added to Solution Explorer, and the Windows Forms Designer opens.

  4. Select the Windows Forms tab in the Toolbox and drag a Button control onto the form.
  5. Double-click the Button control to add an event handler for the button. In the event handler, add the following code:
    Shell("Notepad.exe", AppWinStyle.NormalFocus)

    This will launch Notepad.exe and give it focus.

  6. On the Build menu, choose Build My Notepad to build the application.

To create a deployment project

  1. On the File menu, point to Add Project, and choose New Project.
  2. In the Add New Project dialog box, select Setup and Deployment Projects in the Project Types pane, and then choose Setup Project in the Templates pane. In the Name box, type My Notepad Installer.
  3. Click OK to close the dialog box.

    The project is added to Solution Explorer, and the File System Editor opens.

  4. Select the My Notepad Installer project in Solution Explorer. In the Properties window, select the ProductName property and type My Notepad.
    NoteThe ProductName property determines the name that will be displayed for the application in folder names and in the Add/Remove Programs dialog box.

To add the Windows application to the installer

  1. Select the My Notepad Installer project in Solution Explorer. In the File System Editor, select the Application Folder node.
  2. On the Action menu, choose Add, Project Output.
  3. In the Add Project Output Group dialog box, choose My Notepad from the Project drop-down list. Click OK to close the dialog box.
  4. Select the Primary Output group from the list, then click OK.
  5. On the Build menu, choose Build My Notepad Installer.

To deploy the application (basic installer)

This step can be skipped if you are following the complete walkthrough.

  • Select the My Notepad Installer project in Solution Explorer. On the Project menu, choose Install.

    This will run the installer and install My Notepad on your development computer.

    NoteYou must have install permissions on the computer in order to run the installer.

Optional Deployment Capabilities

The remaining steps demonstrate optional deployment capabilities.

Creating a Shortcut

This step creates a shortcut to your application that will be placed on the desktop of a target computer during installation.

To create shortcuts for the Windows application

  1. Select the My Notepad Installer project in Solution Explorer.
  2. In the File System Editor, select the Primary output from My Notepad node.
  3. On the Action menu, choose Create Shortcut to Primary Output from My Notepad.

    This will add a Shortcut to Primary output from My Notepad node.

  4. Rename the shortcut Shortcut to My NOTEPAD.
  5. Select Shortcut to My NOTEPAD and drag it to the User's Desktop folder in the left pane.

Creating a File Association

This step adds a file association for My Notepad so that double-clicking .vbn files will launch the My Notepad application.

To create file associations for the Windows application

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and choose File Types.
  2. Select the File Types on Target Machine node in the File Types Editor. On the Action menu, choose Add File Type.

    A New Document Type #1 node is added and opened for renaming.

  3. Rename New Document Type #1 as Vbn.doc.
  4. In the Properties window, set the Extension property of the file type to vbn.
  5. Select the Command property and click the Ellipsis () button. In the Select item in project dialog box, navigate to the Application Folder, and select Primary output from My Notepad.
  6. Click OK to close the dialog box.

Adding a Registry Entry

This step adds a registry key and value to the registry. You could reference this registry key from your application's code to retrieve per-user information at run time.

To add a registry entry for the Windows application

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and choose Registry.
  2. Select the HKEY_CURRENT_USER node and expand it, then expand the Software node and select the [Manufacturer] node.
    NoteThe Manufacturer node is surrounded by brackets to denote that it is a property. It will be replaced by the value entered for the Manufacturer property for the deployment project.
  3. On the Action menu, choose New, Key.
  4. Rename the key UserChoice.
  5. Select the UserChoice key.
  6. On the Action menu, point to New, then click String Value.
  7. Rename the value TextColor.
  8. In the Properties window, select the Value property and enter Black.

Adding a Custom Installation Dialog Box

This step adds and configures a custom user interface dialog box that will be displayed during installation.

To add a custom installation dialog box

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and choose User Interface.
  2. In the User Interface Editor, select the Start node under the Install node.
  3. On the Action menu, choose Add Dialog.
  4. In the Add Dialog dialog box, choose Checkboxes (A).
  5. Click OK to close the dialog box.
  6. On the Action menu, choose Move Up twice to position the Checkboxes (A) dialog box above the Installation Folder dialog box.
  7. In the Properties window, set the BannerText property to Samples.
  8. Set the BodyText property to The Install Samples check box controls whether or not the sample files are installed. If left unselected, the samples will not be installed.
  9. Set the CheckBox1Label property to Install samples?
  10. Set the properties Checkbox2Visible, Checkbox3Visible, and Checkbox4Visible to false. This will hide the additional check boxes.

Working with Samples

This step creates a Samples subfolder that will be installed beneath the Application folder.

To add a Samples folder

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and choose File System. The Application Folder should still be selected.
  2. From the Action menu, point to Add, and choose Folder.
  3. Rename "New Folder #1" as Samples.

This step creates two sample text files that will be installed if the user chooses the Install samples option in the custom dialog.

To create sample files for the application

  1. Using Notepad or another text editor, create a text file containing the text This is rules.vbn. Save it as Rules.vbn.
    NoteTo prevent Notepad from automatically adding a .txt extension, choose All Files in the Files of type drop-down list.
  2. Create another text file containing the text This is memo.vbn. Save it as Memo.vbn.

This step adds the sample files to the Samples folder, and sets a condition that determines whether to install the files.

To add the samples to the installer

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, choose File System, and select the Samples folder.
  2. From the Action menu, point to Add, and choose File. Add the Rules.vbn and Memo.vbn files to the Samples folder.
  3. Select the file Rules.vbn in the File System Editor.
  4. In the Properties window, set the Condition property to CHECKBOXA1=1. When the installer is run, the file Rules.vbn will only be installed if the custom check box is selected.
  5. Select the file Memo.vbn in the File System Editor.
  6. In the Properties window, set the Condition property to CHECKBOXA1=1. When the installer is run, the file Memo.vbn will only be installed if the custom check box is selected.

Adding Launch Conditions

This step checks to see if Internet Explorer 5.0 or higher is installed on a target computer, and halts installation if it is not installed.

To add a launch condition to check the Internet Explorer version

NoteThis step is intended to demonstrate the concept of launch conditions; the My Notepad application has no actual dependency on Internet Explorer.
  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and choose Launch Conditions.
  2. In the Launch Conditions Editor, select the Requirements on Target Machine node.
  3. On the Action menu, choose Add File Launch Condition.

    A Search for File1 node is added beneath the Search Target Machine node, and a Condition1 node is added beneath the Launch Conditions node.

  4. Rename Search for File1 to Search for Internet Explorer.
  5. In the Properties window, set the FileName property to Iexplore.exe, the Folder property to [ProgramFilesFolder], the Depth property to 2, and the MinVersion property to 5.00.
  6. Select the Condition1 node.
  7. Set the Message property to This program requires Microsoft Internet Explorer 5.0 or higher. Please install Internet Explorer and rerun the Notepad installer.

Setting Optional Properties

This step sets a property to automatically install the Windows Installer bootstrapping application files if the correct version of Windows Installer is not present on the target computer.

To set optional properties for the deployment project

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, choose Property Pages.
  2. On the My Notepad Installer property page, select the Bootstrapper drop-down list, and choose Windows Installer Bootstrapper.
  3. On the Build menu, choose Build My Notepad Installer.

Installing on Your Development Computer

This step will run the installer and install My Notepad on your development computer.

To install My Notepad on your development computer

  • Select the My Notepad Installer project in Solution Explorer. On the Project menu, choose Install.
    NoteYou must have install permissions on the computer in order to run the installer.

Deploying to Another Computer

This step will run the installer and install My Notepad on another computer.

To deploy My Notepad to another computer

  1. In Windows Explorer, navigate to your project directory and find the built installer. The default path will be \documents and settings\yourloginname\My Notepad Installer\project configuration\My Notepad Installer.msi. The default project configuration is Debug.
  2. Copy the My Notepad Installer.msi file and all other files and subdirectories in the directory to another computer.
    NoteTo install on a computer that is not on a network, copy the files to traditional media such as CD-ROM.
  3. On the target computer, double-click the Setup.exe file to run the installer.
    NoteYou must have install permissions on the computer in order to run the installer.

Testing

This step will test starting the installer from a desktop shortcut and uninstalling.

To test the installation

  1. Verify that the shortcut is installed on the desktop and that it correctly launches the My Notepad application.
  2. Uninstall the application using the Add/Remove Programs tool in Control Panel.
    TipTo uninstall from your development computer, on the Project menu, choose Uninstall.

See Also

Creating or Adding Deployment Projects | Adding Items to a Deployment Project | File Installation Management in Deployment | Registry Settings Management in Deployment | File Types Management in Deployment | User Interface Management in Deployment | Launch Condition Management in Deployment

<!-- End Content -->
分享到:
评论

相关推荐

    VS2010安装msdn

    需要注意的是,VS2010所附带的MSDN是基于Web的形式,这意味着它的界面和体验与传统的离线版MSDN略有不同。一些开发者可能更喜欢传统的离线版,因为它提供了更快的搜索速度和更好的离线阅读体验。尽管如此,Web版MSDN...

    移动应用程序的安装与部署(PPT)

    本讲座基于MSDN Webcast,旨在详细阐述移动应用如何在不同平台上进行安装和部署。 一、移动应用的安装流程 1. 应用下载:移动应用通常通过应用商店(如Apple App Store、Google Play)或开发者官方网站进行下载。...

    MSDN Library - October 2001安装镜像及安装步骤

    MSDN Library - October 2001安装镜像及安装步骤 安装镜像在本人分享的百度网盘链接中 安装步骤和备注在记事本Lynsey.txt中 链接:https://pan.baidu.com/s/1Z9kdfQu70N-1tcWQ9lh9rw?pwd=7777 提取码:7777

    Vc++6.0和MSDN的安装

    《VC++6.0与MSDN的安装指南》 Visual C++ 6.0(简称VC++6.0)是一款由微软公司推出的经典C++编程工具,它在软件开发领域有着广泛的应用。而MSDN(Microsoft Developer Network)是微软为开发者提供的一个全方位的...

    vs2010 msdn 安装 管理帮助设置

    MSDN还提供了在线社区和论坛,开发者可以在其中与其他开发者交流经验和分享知识。 MSDN的安装方法 MSDN的安装方法可以参考以下链接:&lt;http://www.cnblogs.com/lyj/archive/2010/06/01/vs2010-setup-zh-cn-msdn....

    MSDN快乐安装软件v1.19.5.1免费绿色版

    MSDN快乐安装工具是一款实用的MSDN安装工具。这款工具操作简单,无需任何技术即可完成整个系统重装。支持系统备份还原,支持智能检测当前电脑配置信息,自动分析适合电脑配置的最佳重装系统版本。功能非常丰富实用,...

    Visual Studio 2008 中的 MSDN Library 安装问题

    针对这个问题,提供的文件列表"nslist.hxl"、"西西下载.txt"和"西西下载.url"似乎与MSDN Library的安装问题直接关联性不大。"nslist.hxl"可能是一个文件列表或索引文件,而"西西下载.txt"和"西西下载.url"可能是下载...

    英文VS2010安装中文版MSDN文档方法

    英文VS2010安装中文版MSDN文档方法 本文介绍了在英文VS2010环境中安装中文版MSDN文档的方法,该方法适用于MSDN中文版没提供下载之前的情况。 知识点1: 安装Help Library Manager中文语言包 在安装中文版MSDN文档...

    vs MSDN安装不了

    2).nslist.hxl 损坏导致 MSDN for Visual Studio 2008 安装失败的解决方案。 在 NSList.hxl 文件已损坏时会出现此错误。 NSList.hxl 文件是使用许多 Microsoft 应用程序的常见的帮助数据文件. Here come's my ...

    MSDN_1.5 精简安装版.z04

    【压缩包子文件的文件名称列表】中的"MSDN_1.5 ╛½╝≥░▓╫░░µ"和"MSDN_1.5 精简安装版"可能是压缩包内的文件名或者由于字符编码问题显示不正常,正常情况下,它们应该是与MSDN 1.5相关的文件,可能是安装程序...

    MSDN_1.5 精简安装版.z02

    MSDN_1.5 精简安装版.z01 MSDN_1.5 精简安装版.z02 MSDN_1.5 精简安装版.z03 MSDN_1.5 精简安装版.z04下载后放入同一个文件夹中最好用好压解压自动合并

    MSDN安装教程

    MSDN安装教程,C++入门必备工具MSDN安装

    MSDN安装,帮助大家解决安装问题

    1. **下载MSDN安装文件**:在压缩包子文件的文件列表中,我们看到有一个名为"MSDN安装.exe"的文件,这通常是MSDN的安装执行程序。首先,你需要下载这个文件到你的计算机上。 2. **运行安装程序**:找到下载好的...

    移动应用程序的安装与部署(Video)

    移动应用程序的安装与部署是现代IT领域中的关键环节,尤其在智能手机和平板电脑普及的今天。这个主题涵盖了一系列技术和流程,旨在确保应用能在各种移动设备上顺畅运行。在这个MSDN Webcast的视频教程中,专家深入浅...

    安装MSDN,帮助编程学习

    安装MSDN,帮助编程学习

    MSDN安装步骤

    VC6.0下:MSDN单独安装的步骤: VC++ msdn 大家都懂的

    VB帮助文件MSDN绿色安装

    VB帮助文件MSDN绿色安装 可直接选择安装路径,可在桌面生成快捷方式,方便学习使用。 注:此文件是安装MSDN后把安装的文件夹做的一个自解压文件,可以像安装软件一样安装,也可以自已用解压软件打开查看,解压到...

    VC 6.和MSDN6.0安装.7z

    **VC 6.0与MSDN 6.0安装指南** 在编程的世界里,学习语言确实需要大量的实践,而编写代码则离不开一个合适的开发环境。Visual C++ 6.0(简称VC 6.0)是一款经典的Microsoft开发工具,特别适合初学者用于学习C++编程...

    MSDN.For.VB6.0

    MSDN.For.VB6.0.zip 安装版本,可用; ...本安装可能会与新版MSDN冲突,如果您有新版MSDN,就别安装本文件!!! 建议使用:MSDN for VB 6.0 版本,安装后运行VB编译环境,按F1既可弹出MSDN的帮助;

    VB_MSDN帮助文件安装程序

    《VB_MSDN帮助文件安装程序》是一款专为Visual Basic开发者设计的工具,它包含了丰富的MSDN(Microsoft Developer Network)帮助文档,旨在提供全面、详细的技术支持和学习资源。MSDN是微软公司为开发者提供的一个...

Global site tag (gtag.js) - Google Analytics