How do I add Mysql.data.dll into uwp with c++?

柔情痞子 提交于 2019-12-12 04:02:50

问题


I have been to try to use Mysql with c++ in UWP for 2 days...but I could not do so.

I already installed Mysql.data and Mysql.ConnectorNet.Data through Nuget.

However when I tried to use Mysql obejct, I couldn't find anything. Intelligence does not work too so I tried to add Mysql.data.dll directly, but I couldn't do too. I just got a error message. It said that "could not add a reference to "my path" as it is not of a type or version current proejct can use."

Does anyone know how to solve it?


回答1:


Mysql doesn't provide a dll which can be directly used by C++/CX in its official site. The dll you mentioned "Mysql.data.dll" is actually a Dll for winrt .net which can not be directly used in C++/CX.

See MSDN docs:How to: Use Existing C++ Code in a Universal Windows Platform App

You will find this:"Do not add a reference in the References node in Solution Explorer. That mechanism only works for Windows Runtime Components." So actually you can test by create a new simple Windows Runtime Component to see what it is.

Possible ways to start are

  1. Read the above msdn doc and use native C++ mysql library which is located under C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\lib\opt(After installed the native C++ Connector you can find it). ( I haven't worked out when using static library yet.)
  2. Or Directly use the code from it's github to create a C++ winrt version dll.

As this may need lots of time when investigating I think it's better for you to think about using some exist database technology. Like UWP suggested sqlite database.



来源:https://stackoverflow.com/questions/44643438/how-do-i-add-mysql-data-dll-into-uwp-with-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!