1

I am building an SDK dll that needs to support multiple .NET frameworks with different references.

For example, one SDK dll is for Azure Functions which is .Net 4.6.1 with Newtonsoft.Json reference 9.0.0.1 (which was hard coded into Azure Functions). The other is a .NET 4.5.1 framework with newtonsoft.json 10.0.3.

What is the best way to build 2 dll's from the same cs code files using one Visual Studio solution where frameworks and references are different?

thanks

CPGAdmin
  • 29
  • 5

2 Answers2

1

Using SharedProjects in visual studio 2015 or greater allows for the targeting of multiple frameworks and references.

http://www.c-sharpcorner.com/UploadFile/7ca517/shared-project-an-impressive-features-of-visual-studio-201/

CPGAdmin
  • 29
  • 5
0

You can use the new .Net Standard class libraries https://learn.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio

With that you can target the minimum library in your case it will be 1.2 https://learn.microsoft.com/en-us/dotnet/standard/net-standard

Them you can reference this dll from both projects.

For the referenced assemblies you need NOT specify a specific version of your dependency. There is a detailed explanation on how to do that on this answer here.

How exactly does the "Specific Version" property of an assembly reference work in Visual Studio?