0

When I include dlls from other projects or 3rd parties, and include them into my VS.NET solution, does it matter what version those libraries were compiled against?

I am targetting version 4.6 in my solution, and I have to make sure all http requests are done using version 4.6 for TLS 1.2

cool breeze
  • 4,461
  • 5
  • 38
  • 67
  • I'm a little confused by your last paragraph. If your app is using `SecurityProtocolType.Tls12` you won't need to worry about compiling a version where that is not available, as you'll get an error. I also don't see how this concern relates to the question in the first paragraph. – Broots Waymb Mar 02 '18 at 21:34
  • Presumably he/she has a library that makes HTTPS requests, but is unsure if the library will use the SecurityProtocolType default for the runtime version. – Jim W Mar 02 '18 at 21:38
  • @JimW that is correct. My app uses another dll and I want to make sure it will also be compiled using the same version when I compile my solution. A dll is precompiled so I guess not? – cool breeze Mar 02 '18 at 21:40

1 Answers1

0

What matters is the runtime version, not the SDK version you compile with. So if a library was built against .NET 4.0, but your app is running with runtime 4.5, it will use the v4.5 protocol defaults.

See Default SecurityProtocol in .NET 4.5 for more

EDIT:

If you call

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

then it will apply to the entire application including the library code, unless the library code is explicitly setting SecurityProtocol to some other value.

Jim W
  • 4,866
  • 1
  • 27
  • 43