如何在安装Windows Form应用程序时自动安装MySQL dot net连接器 [英] How to automatically install MySQL dot net connector while installing the Windows Form application

查看:72
本文介绍了如何在安装Windows Form应用程序时自动安装MySQL dot net连接器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于C#.net Windows窗体应用程序,我很陌生.我正在构建Windows窗体应用程序,并使用MySql作为后端.

I am quite new to C# .net windows form application. I am building a Windows Form application and using MySql with it as a back end.

现在的问题是,当我构建安装程序时,我希望安装程序检查用户PC中是否安装了MySQL dot net连接器,如果没有,则应自动安装它.

Now the problem is when I build the installed I want my installer to check if MySQL dot net connector is installed in the users PC and if not it should automatically install it.

完成此操作后,我将使用我的应用程序创建数据库.

As soon as this is done I will be creating a database using my application.

推荐答案

在.NET中,除非您尝试将程序集安装到GAC中,否则它们将随应用程序一起部署.除非您必须这样做,否则不要在GAC中放置任何内容,因为它会带来很多挑战,并使应用程序的管理更加困难.

In .NET, unless you are trying to install the assemblies into the GAC, they get deployed with the application. Do not place anything into the GAC unless you have to as it opens up a whole host of challenges and makes managing the app more difficult.

我建议在应用程序中包括MySQL连接器程序集,并将其包含在MSI程序包中.这有两部分-在Deployment项目中,确保明确引用了MySQL库.另外,在您的应用程序项目中,将引用的复制本地"属性设置为True.通过这两个步骤,MySQL连接器将与应用程序一起安装.不必太担心磁盘的大小-如果有内存可用,那么MySQL连接器确实很小.

I suggest including the MySQL connector assemblies with the application and include them in your MSI package. There are two parts to this - in the Deployment project, be sure the MySQL Libraries are referenced explicitly. Also, in your application project, set the Copy Local property of the reference to True. With these two steps, the MySQL Connector will be installed with the application. Don't worry too much about disk size - if memory serves, the MySQL Connectors are really small.

这篇关于如何在安装Windows Form应用程序时自动安装MySQL dot net连接器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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