amesh
amesh

Reputation: 1319

Can I use a library which is targeted to 4.5.1 .net framework in a visual studio project of version 4.6.2

The visual studio project which I am working is targeted to .Net framework 4.6.2 version. I have to integrate it with an external application with the help of a library. The library is available only in 4.5.1 targeted version. I am able to refer the same in visual studio project of 4.6.2 version. But not sure about the compatibility when running the same in deployed environment. Is it a right approach. What would be the solution for this?

Upvotes: 0

Views: 1046

Answers (1)

ProgrammingLlama
ProgrammingLlama

Reputation: 38767

From MSDN:

The .NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the .NET Framework. In other words, apps and components built with previous versions will work without modification on the .NET Framework 4.5 and later versions. However, by default, apps run on the version of the common language runtime for which they were developed, so you may have to provide a configuration file to enable your app to run on the .NET Framework 4.5 or later versions. For more information, see the Version compatibility for apps section earlier in this article.

I recommend reading the full MSDN article, as it does go on to suggest that differences in framework versions could cause instability:

In practice, this compatibility can be broken by seemingly inconsequential changes in the .NET Framework and changes in programming techniques. For example, performance improvements in the .NET Framework 4.5 can expose a race condition that did not occur on earlier versions.

In a lot of scenarios you won't have any problems, I don't think. I've never experienced any issues myself, even with a fairly big library. That doesn't mean that you won't, of course, so I advocate caution.

Upvotes: 3

Related Questions