can not I use the using data directive?

1

I'm learning C #, I do not know much about IDE, so it can be silly.

I needed to create a class library, the "teacher" uses the VS 2015, I use the 2017, he chose the only library of classes that I had, I had several (standard, framework, portable, windows universal) I chose the "standard" I assumed it would be the common one.

I need to add a directive "Using System.Data;" And after that, add "Using System.Data.SqlClient;" However, I do not know why it is a mistake, and it tells me that "the use of the directive is not necessary"

I do not know what the error may be, I'm following a course, and the one who dictates it has the same as me, everything, but he does not make mistakes. I leave screenshots.

I need to be able to use the "DataSet" I'll be attentive, thank you.

    
asked by Abraham Valencia 05.06.2018 в 02:27
source

2 answers

2

The first thing you should know is that selecting .NET Standard is not the same as using the .net framework full since there are limitations on the libraries that you can or can not use, this is because you are creating a library portable that you can use on different platforms

.NET Standard

Here is the problem mentioned

Why is there no System.Data in netstandard20?

is mentioned

  

.NET Core already does and will continue to support System.Data. We currently have a devotyping adding virtually all of the generic ADO.NET namespaces, i.e. System.Data and System.Data.Common, including DataSet and DataTable

As you will see, you should use .net full or maybe see how to apply

  

The alternative to adding System.Data to the standard would be to provide it as a set of NuGet packages that target .NET Standard.

or add them from nuget

System.Data.SqlClient

or else you want to make it complicated to create a library project that uses the full version of the .net framework

    
answered by 05.06.2018 / 03:53
source
0

I solved it by creating a new class library, I chose, I chose to create a Standard , and it has limitations, I just deleted it and created another library but this time I chose the Framework and it's done, fixed.

    
answered by 23.06.2018 в 04:38