![](/img/trans.png)
[英]Why am I getting: The type 'IThirdParty' is defined in an assembly that is not referenced. You must add a reference to assembly 'ThirdPartyAssembly'?
[英]The type 'DbConnection' is defined in an assembly that is not referenced. I cannot add the reference?
在Visual Studio(2013和2015版中相同的问题)中,构建项目时出现此错误:
The type 'DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0
我这样做是因为我想使用MySQL.Data
包,但它似乎需要System.Data
。
但是,在我的项目中无法将System.Data
添加到我的引用中,它不在引用列表中,因此我无法“选择”它以将其添加到项目中。 这是Xamarin C#
解决方案,未列出System.Data
的项目是PCL。
这会影响包装吗? 如果是这样,是否有某种方法可以解决此问题或使MySQL.Data在没有此情况的情况下工作?
我认为更好的方法是不将应用程序直接连接到数据库( 2-tier
),而是定义要使用的Web service
,并且该Web服务将连接到数据库( 3-tier
)。
因此, Xamarin C#
不需要引用System.Data。 一种选择是使用JSON
作为通信的数据格式。
这里讨论有关此问题的更多详细信息。
我知道这是一个老问题,但是我通过将项目.Net Framework升级到4.5来解决了。
在使用至少需要此框架版本的Postgres驱动程序(Npgsql)时遇到此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.