0

First of all, I'm working with Visual Studio 2015 (and can't upgrade VS version) and using a MySQL library. My using directives are

using System;
using System.Data;
using MySql.Data.MySqlClient;

And I'm trying to connect with a MySQL database with

MySqlConnection ms = new MySqlConnection(ConnectionData.ToString());
ms.Open();

The name of the function Open() is autocompleted ok, and I know it works fine on another projects I have been working on, but now I get this compiler error when trying to invoke the Open() function:

Must add an assembly reference 'System.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

I think my System.Data library is quite old, but I can't find a System.Data.dll file in my project (That way I could just replace it), anyone know how to just upgrade that library?

Windgate
  • 365
  • 1
  • 4
  • 14
  • System.Data is a .NET reference. Are you targeting the correct framework? – Zer0 Apr 07 '20 at 11:55
  • That's other of my questions, how to check which .Net Framework I'm targeting from Visual Studio? I can install 4.0, but I don't know how to tell VS about it – Windgate Apr 07 '20 at 11:57
  • It's specified in your project file. You can also change this in the IDE: right click on your project and then properties. – Zer0 Apr 07 '20 at 11:59
  • if I open my .csproj I have a line v5.0, it's a Xamarin project, but like I said, I'm working with that library and that function on another Xamarin projects with no problem – Windgate Apr 07 '20 at 12:04
  • have you installed the [.net standard 2.0 update for VS2015](https://aka.ms/dotnet-standard-support-vs2015-2.0.0-win-x86)? – magicandre1981 Apr 07 '20 at 14:49
  • @magicandre1981 I did it and the result is the same. I think it is not a .NET Framework version problem, because my project is a Xamarin project for Android, and the target framework would be Android Studio, not .NET Framework. The line v5.0 is cause I have Android Lollipop 5.0 as target Android version. I keep on researching. Thanks all. – Windgate Apr 08 '20 at 07:19
  • modern nuget libs use [.net standard 2.0](https://www.fuget.org/packages/MySql.Data/8.0.19) . VS2015 is really too old. – magicandre1981 Apr 08 '20 at 13:13
  • Thanks all, I'm asking for a VS version upgrade, everything works fine with VS 2017 and VS 2019, but I think that nowadays VS 2015 can't compile anything related to Xamarin :( – Windgate Apr 20 '20 at 08:40

0 Answers0