1

I want to create a Nuget Package for a C# library that targets .NET Framework 4.0 and higher.

If I put my library in a directory named Net40, will this cause issues for projects that target say 4.1 and higher?

Should i just publish my library in a lib folder without specifying the supported .NET Framework version? My library supports .NET Framework 4.0 and higher.

The reason why I am asking is that sometimes projects get messed up quickly when they target a different platform whilst the installed libraries via NuGet target another platform version. At least I want to avoid issues when developers target 4.0 and higher.

I hope your advice will be very helpful.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
Russell Chidhakwa
  • 339
  • 2
  • 5
  • 16
  • 1
    It sounds like you're trying to put together the NuGet package by hand - is there any reason you're not letting the normal tooling do this for you? I would just create an SDK-style project with a target framework of `net40` and everything should just work. (I would suggest also targeting netstandard2.0 if your library would support that.) – Jon Skeet Feb 27 '20 at 07:44
  • @Jon: okay i appreciate your direction. Will try that. – Russell Chidhakwa Feb 27 '20 at 08:46

0 Answers0