2

I am trying my hand at converting a VB.net application over to C#, and I got to the part where I was doing the database portion with the SqlClient, and it just isn’t there. most of the posts I’ve found say I should use the nuget package, but when I did that, it failed because I am targeting .net 3.5 This is a requirement because until we get rid (slowly) of all of our windows 7 machines, that’s what I have to target.

EDIT a screenshot of my reference manager, also i am using System.Data enter image description here

3
  • Just FYI - Windows 7 supports .Net 4.0 and above. Even XP supports .Net 4.0. You can go up to 4.6 on Vista. learn.microsoft.com/en-us/dotnet/framework/get-started/… Commented Sep 24, 2019 at 15:10
  • 1
    I dont know what the patching level is on the machines sadly, i know that they are older thin clients. Commented Sep 24, 2019 at 15:11
  • in .NET 3.5: SqlClient is in System.Data Commented Sep 24, 2019 at 23:04

1 Answer 1

6

If you're targeting .NET 3.5, you can use a framework reference to System.Data, which gives you SqlClient. However, you probably shouldn't still keep trying to work with .NET 3.5. You won't be able to use the nuget package, because it doesn't go back that far. In csproj terms, this is:

<ItemGroup>
  <Reference Include="System.Data" />
</ItemGroup>
Sign up to request clarification or add additional context in comments.

3 Comments

However, you probably shouldn't still keep trying to work with .NET 3.5 - Can you help me convince my managers? ;)
I was getting advice from some guys on the Rubber Duck team at the same time i posted this, it seems i needed System.Data.Entity as well.
@BrootsWaymb you jest, but I'm actively trying, which is why I've recently dropped down-level TFMs from a number of libraries that I manage; I had hoped to make netstandard2.0 the minimum supported version, but problems with .NET 4.6.1 claiming to support netstandard2.0 (but kinda not really) mean that I've had to multi-target with netstandard2.0 + net461 as the bottom of the pile. I'm not alone in this direction - I've seen multiple library maintainers do the same. So: tell your managers "no more library support"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.