5

I created a library that uses: generics, extension methods and Func delegate. Func delegate is most new feature to .NET (version 3.5) in the library. When I published it to nuget, the project was targeting the .NET version 4.5.2 but when I tried to install it to a project that target version 4.5, it failed.

How to ensure that the package will be installed on any project that targets .NET 3.5 and later versions, should I change the target framework in the library to 3.5 or I should use the directory convention, and create separate dll for every framework, explained here:

Supporting multiple .NET framework versions

mshwf
  • 7,009
  • 12
  • 59
  • 133

1 Answers1

4

Target the package for 3.5 which means the lib folder should be like this.

lib\net35

If a package targets net35, it can be installed in any project that targets .NET 3.5 or above.

Mathivanan KP
  • 1,979
  • 16
  • 25
  • So, changing the target framework will just do the job? because I didn't build my library with this structure: lib\{net version} – mshwf Feb 10 '17 at 12:17
  • Yes, Changing the target framework will do it for you. – Mathivanan KP Feb 11 '17 at 04:01
  • For curiosity, why not just using this approach instead of using the folder convention? targeting the highest version used in the library is easier and more convenient than creating an assembly for every framework version? – mshwf Feb 12 '17 at 08:02
  • Yes, you are right. This method will avoid duplication. – Mathivanan KP Feb 13 '17 at 04:08