简体   繁体   English

如何制作包含C#应用程序和sql server的安装文件

[英]How To make setup file that contains C# application and sql server

I want to build a setup file that contain windows form application that is connected to sql server how can I do that? 我想构建一个包含连接到SQL Server的Windows窗体应用程序的安装文件,我该怎么办? I want to put the .net framework and sql server in the setup package how can I do that? 我想把.net框架和sql server放在安装程序包中我该怎么办? do I need sql server or sql express in this case? 在这种情况下我需要sql server或sql express吗? I want to create the database in the installation process how can I do this? 我想在安装过程中创建数据库,我该怎么做? I want to check If the requirements are already installed how can I do this? 我想检查如果已经安装了要求,我该怎么办? hw can I improve the security of the program from stealing?? 我可以通过偷窃来提高程序的安全性吗? please help thanks 请帮助谢谢

note my English language not good enough Smile | 请注意我的英语不够好微笑| :) :)

That is a lot more than one question, and not easy to answer all at once. 这不仅仅是一个问题,而且不容易立即回答所有问题。 Anyway, assuming you're using Visual Studio 2012, you can try creating a new Install Shield project (below). 无论如何,假设您使用的是Visual Studio 2012,您可以尝试创建一个新的Install Shield项目(如下所示)。

(It might be easier to help you once you've tried something, and have got a more specific question/problem) (一旦你尝试了一些东西,可能会更容易帮助你,并且有更具体的问题/问题)

在此输入图像描述

For my projects I use Inno Setup . 对于我的项目,我使用Inno Setup It lets you customize all aspects of the installer - add/remove different screens, set conditions for installing different files, for example you can check out whether SQL server is installed and install it only if it is not through scripting. 它允许您自定义安装程序的所有方面 - 添加/删除不同的屏幕,设置安装不同文件的条件,例如,您可以检查是否已安装SQL服务器,并且只有在不通过脚本编写时才安装它。 Take a look at the FAQ page for more information about the features this tool offers. 有关此工具提供的功能的详细信息,请查看常见问题解答页面

There's also a sample Inno Setup file at CodePlex , that should get the job done. CodePlex上还有一个Inno Setup文件样本 ,可以完成工作。 I haven't tried it though, so I cannot guarantee whether it works fine or not. 我没有尝试过,所以我不能保证它是否正常工作。

If you want to have installer for tomorrow, than good choice will be WIX ( http://wix.sourceforge.net/ ). 如果你想明天有安装程序,那么好的选择将是WIX( http://wix.sourceforge.net/ )。 It is easy to understand and have a possibility of checking installed frameworks and OS version. 它很容易理解,并且有可能检查已安装的框架和操作系统版本。

If you wish to have Framework msi installer inside yours, than you can check Wix Bootsrapper. 如果您希望在您的内部安装Framework msi安装程序,那么您可以检查Wix Bootsrapper。 But as far as I know it has poor flexibility to setup install steps. 但据我所知,设置安装步骤的灵活性较差。 For this propose you can combine Wix with other for example NSIS. 对于此提议,您可以将Wix与其他例如NSIS结合使用。 You can create application installer by using Wix and Bootsrapper application, which will contains your application MSI and Framework MSI, by using NSIS. 您可以使用WIS和Bootsrapper应用程序创建应用程序安装程序,该应用程序将使用NSIS包含您的应用程序MSI和Framework MSI。

To create database during installation you also can use WIX. 要在安装期间创建数据库,您还可以使用WIX。 You need to create database generation plan, which will contain queries for creating database. 您需要创建数据库生成计划,该计划将包含用于创建数据库的查询。 This generation plan can be executed as part of the installation process ( http://wix.tramontana.co.hu/tutorial/sql/creating-a-database ). 此生成计划可以作为安装过程的一部分执行( http://wix.tramontana.co.hu/tutorial/sql/creating-a-database )。 It is good choice wile you don't need additional information from user. 您不需要用户提供额外信息,这是一个不错的选择。 In other case you will need to create custom UI. 在其他情况下,您将需要创建自定义UI。

From my experience with built in Visual Studio install tools, they're all horrible. 根据我使用内置Visual Studio安装工具的经验,它们都非常糟糕。

I highly recommend Advanced Installer . 我强烈推荐Advanced Installer It's a very powerful tool to create installers and patches for your software. 它是为您的软件创建安装程序和补丁程序的一个非常强大的工具。 It should have all the features you need in the free version, including checking for prerequisites such as .NET Framework on the user's machine, and installing things when needed. 它应该具有免费版本中所需的所有功能,包括在用户的计算机上检查诸如.NET Framework之类的先决条件,以及在需要时安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM