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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

So, changing the target framework will just do the job? because I didn't build my library with this structure: lib\{net version}
Yes, Changing the target framework will do it for you.
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?
Yes, you are right. This method will avoid duplication.

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.