mysql - Visual Studio 2015 未在 NuGet 中安装 Mysql.data

标签 mysql azure visual-studio-2015 uwp mysql.data

UWP 应用程序无法与 MySql 配合使用

我在 UWP 中制作了一个应用程序,我想使用 MySql,而不是使用 SQLLite(这似乎是 Visual Studio 2015 的标准)。我已经通过“服务器资源管理器”将我的 Azure mysql 数据库连接到 Visual Studio。

我正在使用 MySQL Workbench 从 Azure 连接的数据库中更新我的表,但实际上我无法编写任何代码来访问我的表,因为每当我尝试在 NuGet 包管理器中安装 MySql.data/.entity/etc 时,我就无法编写任何代码来访问我的表。出现错误。

nuget error

我尝试下载 Mysql 安装程序、Ado 和 ODBC 的 Mysql 驱动程序。我什至尝试下载 MySql for Visual Studio 选项,因为我发现 Visual Studio 与 MySql 不兼容,而是需要下载 MySql for Visual Studio,但每当我尝试在代码中使用 MySql 时,我仍然会遇到错误,因为我需要程序集引用,但我没有运气能够得到一个不出错的。

有人知道我如何在 Visual Studio 2015 中实际使用 MySql 吗?

这是我一直使用的指南,但在安装时我似乎无法克服 Mysql.data 错误。

http://web3.codeproject.com/Articles/1074242/Designig-your-Azure-MySQL-DB-with-a-UWP-Demo

我见过很多人谈论这个问题,但没有一个简单的修复方法(我已经尝试了很多修复方法,其中一个特别是使用 Vs13 在 Nuget 包管理器中安装 Mysql,然后它应该在 VS15 内更新,但由于我的应用程序是 UWP,VS13 实际上并未加载/读取它,因此这个想法对我来说不好,但可能对其他人有帮助)

最佳答案

从 6.7 开始,Connector/Net 完全支持构建 Windows 应用商店应用程序。但使用 Connector/Net RT 并不是通过安装 Nuget 包,它只是根据 MySQL Connector/Net Developer Guide 引用 MySql.Data.RT.dll 程序集。 :

Using Connector/Net RT is easy. Simply create a Windows Store application using Visual Studio and then reference the MySql.Data.RT.dll assembly in your project. The code you write should be exactly the same as for normal Connector/Net (including using same namespace MySql.Data.MySqlClient) except for the differences listed above.

如果您安装了连接器,您可以在 C:\Program Files (x86)\MySQL\Connector.NET 6.79\Assemblies\RT 找到此 dll。您还可以下载mysql-connector-net-6.7.9-noinstall.zip在文件夹中找到该文件。我之前也有一个MySql UWP示例,并且有dll here 。右键单击您的项目并添加对此的引用,它将起作用。

更多详情请引用this sample

关于mysql - Visual Studio 2015 未在 NuGet 中安装 Mysql.data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41653038/

相关文章:

c# - MySQL 如果不存在则插入/忽略

mysql - CompositeKey 作为 peewee 与 mysql 的外键

azure - 使用脚本操作在HDInsight上安装Giraph

c++ - 大小小于 int 的位域是否应该作为整体提升的主题?

asp.net-core - Visual Studio 2015 中的 Aurelia 项目设置和文件夹结构 : what goes in wwwroot?

php - 嵌套的 foreach 循环,使用 php 和 laravel

php - 验证 HABTM 关系中其他模型的多个字段

powershell - 列出属于特定子网的所有 azure vm

azure - Microsoft BizSpark 和 Azure - 免费提供哪些类型的实例?

visual-studio-2015 - 无法在 Visual Studio 2015 中运行代码分析分析器