问题描述
我正在使用.Net 3.5(C#,WPF)构建软件,我的软件需要用户安装.Net 3.5和Media Player11.我想构建一个安装程序,在用户安装主要软件时会自动安装这两个组件.我该如何解决?该组件:
I'm building a software using .Net 3.5 (c#, WPF), My software need to user install .Net 3.5 and Media Player 11. I want to build an installer that automatically install this two component while user install main software. How i can fix that?this components:
1- .Net 3.5
1- .Net 3.5
2- Media Player 11
2- Media Player 11
推荐答案
使用Visual Studio创建安装程序包指令 (更新的链接).对于vs2010:
Create a setup package using visual studios instructions (Updated Link). for vs2010:
- 在文件"菜单上,指向添加",然后单击新建项目".
- 在出现的添加新项目"对话框中的项目类型"中窗格,打开其他项目类型"节点,打开设置和部署"项目,然后选择Visual Studio安装程序.
- 在模板"窗格中,选择安装项目"以进行标准安装,或者Web应用程序的Web安装项目.
- On the File menu, point to Add, then click New Project.
- In the resulting Add New Project dialog box, in the Project Typespane, open the Other Project Types node, open Setup and DeploymentProjects, and select Visual Studio Installer.
- In the Templates pane, choose Setup Project for a standard setup, orWeb Setup Project for a Web application.
我通常在我想要安装程序的解决方案中执行此操作.您将创建一个类似以下的项目:
I usually do this inside the solution i want an installer for. You will create a project like:
请注意检测到的依赖文件夹.在这里,请确保您具有相关的.net框架和媒体播放器模块.构建此文件将生成一个.msi和.exe,还将输出该框架以及其他组件和程序集的安装程序.当用户运行exe时,将提示他们安装必需的依赖项.
Note the detected dependancies folder. In here, make sure you have the relevant .net framework and media player modules. Building this wil produce a .msi and a .exe, and will also output an installer for the framework plus other compnents and assemblies. When the user runs the exe, they will be prompted to install the necessary dependencies.
Ofcousre还有其他安装程序包,但这是集成的Visual Studio,我发现它在许多方面都非常有用.
Ofcousre there are other installer packages, but this one is visual studios integrated and i find it works great for many purposes.
添加依赖项:右键单击安装程序项目->属性->先决条件,选择所需的.net框架.
Adding dependencies:Right click the installer project -> properties - > prerequisites, select the .net framework desired.
对于所有其他依赖项,请右键单击安装程序项目->添加->程序集,然后浏览至所需的程序集,如果它是.net,则从列表中选择它.
for all other dependencies right click the installer project -> add -> assemblies and either browse to the assembly you want or if it is .net, select it from the list
这篇关于用户安装软件(.Net)时自动安装依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!