Error With Installing System.Data.SqlClient From NuGet RRS feed

  • Question

  • Okay, so I am making a game in Unity that accesses data from A MySql Database. I installed the Data processing package from the Visual Studio 2017 Installer and I added a reference to System<g class="gr_ gr_14 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" data-gr-id="14" id="14">.Data</g> in my solution. Yet, when I try installing System.Data.SqlClient from NuGet, I get this output from Package Manager: 

    Attempting to gather dependency information for package 'System.Data.SqlClient.4.5.1' with respect to project 'Assembly-CSharp', targeting '.NETFramework,Version=v3.5'Gathering dependency information took 382.04 msAttempting to resolve dependencies for package 'System.Data.SqlClient.4.5.1' with DependencyBehavior 'Lowest'Resolving dependency information took 0 msResolving actions to install package 'System.Data.SqlClient.4.5.1'Resolved actions to install package 'System.Data.SqlClient.4.5.1'Retrieving package 'System.Data.SqlClient 4.5.1' from ''.Install failed. Rolling back...Package 'System.Data.SqlClient.4.5.1' does not exist in project 'Assembly-CSharp'Package 'System.Data.SqlClient.4.5.1' does not exist in folder 'C:\Users\kids only\Desktop\Unity Projects\Cool YT RPG\packages'Executing nuget actions took 5.54 secCould not install package 'System.Data.SqlClient 4.5.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.Time Elapsed: 00:00:06.1397891========== Finished ==========

    Please, I'm new to Visual Studio, Unity, C#, ect. please give detailed, easy-to-understand, step-by-step instructions on how to fix this problem.

    Friday, October 5, 2018 3:44 PM

All replies

  • Try changing the Target Framework version in Project Properties window. Select 4.5.1 or newer.

    For MySql, you probably need another package.

    Friday, October 5, 2018 4:18 PM
  • MySQL doesn't use SqlClient. You need to download the MySQL package.

    Unity (unless you use the beta version) does not support .NET 4.x yet. This is coming in the next version. Until then you cannot rely on any packages that only work on .NET 4.x or higher. I cannot find a version of MySQL that works with 3.5 but there may be one or you could go to MySQL's site and look. 

    For questions related to Unity please post in their forums.

    For questions related to MySQL please post in their forums.

    Michael Taylor

    Friday, October 5, 2018 5:14 PM