且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从NuGet安装System.Data.SqlClient时出错

更新时间:2022-10-17 22:19:12

尝试更改"项目属性"窗口中的"目标框架"版本。选择4.5.1或更新版本。


对于MySql,您可能需要另一个包。




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 'nuget.org'.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.

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

For MySql, you probably need another package.