使用.Net framework 4.0创建安装程序,在Visual Studio 2010中使用数据库创建MySql [英] Setup Creation with .Net framework 4.0, MySql with Database in Visual Studio 2010

查看:107
本文介绍了使用.Net framework 4.0创建安装程序,在Visual Studio 2010中使用数据库创建MySql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要创建一个安装文件,其中包括.Net framework 4.0,MySql Odbc Connector,带数据库的MySql Server和Windows应用程序。当客户端在他的系统中单击此设置时,它需要在系统中静默安装以上四个组件,即无需手动安装所有4个组件,它需要按顺序安装所有这些组件。



请帮我解决这个问题。我对这个概念很新,所以请逐步解释。

Hi Everyone,

I need to create a setup file which includes .Net framework 4.0, MySql Odbc Connector, MySql Server with Database, and Windows application. When client clicks this setup in his system, it needs to install all above four components in the system silently i.e without manually installing all 4 components, it needs install all these in order.

Please help me to how to do this. I am very new to this concept, so please explain step by step.

推荐答案

首先,您需要在当前解决方案中添加一个新的安装项目。 参考此 $>


要求:

1。 DotNet Framework - VS中的设置项目 - >右键 - >属性 - >点击先决条件 - >检查所需的DotNet框架。选择单选按钮从与我的应用程序相同的位置下载先决条件。现在你的设置也包括这个框架。



2。 MySql安装程序 - 将MySql安装文件添加到VS中的安装项目中。它将与您的项目设置一起自动安装。用户必须创建用户才能连接MySql。登录MySql并手动从Sql转储文件导入数据库。或者你可以开发一个小的胜利形式来恢复数据库。创建一个批处理文件,并从WIN表单中将以下代码写入其中。



First, you need to add a new Setup project to the current solution. Refer This

Requirements:
1. DotNet Framework - Setup Project in VS -> Right Click-> Properties-> Click Prerequisites-> Check the required DotNet framework. Select Radio button Download prerequisites from the same location as my application. Now your setup includes this framework too.

2. MySql Setup - Add MySql setup file to the Setup project in VS. It will be automatically installed along with your project setup. User has to create user to connect MySql. Login MySql and Import your database from Sql dump file manually. Or you may develop a small win form to Restore DB. Create a batchfile and write the following code into it from WIN form.

"mysql.exe --host=" + txtHostIP.Text + " --user=" + txtUserName.Text + " --password=" + txtPassword.Text+ " --port=" + txtPort.Text + " --default-character-set=utf8 --comments < " + SqlScriptFile);





使用以下代码执行批处理文件。





Execute the batch file using the following code.

ProcessStartInfo info = new ProcessStartInfo(_installBatchFile);
     info.UseShellExecute = false;
     info.RedirectStandardError = true;
     info.RedirectStandardInput = true;
     info.RedirectStandardOutput = true;
     info.CreateNoWindow = true;
     info.ErrorDialog = false;
     info.WindowStyle = ProcessWindowStyle.Hidden;
     info.WorkingDirectory = GetPathOfMySqlService();//Get MySql.exe(program files) path
     Process process = Process.Start(info);


这篇关于使用.Net framework 4.0创建安装程序,在Visual Studio 2010中使用数据库创建MySql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆