我可以在版本 4.6.2 的 visual studio 项目中使用针对 4.5.1 .net 框架的库吗
Can I use a library which is targeted to 4.5.1 .net framework in a visual studio project of version 4.6.2
我正在做的visual studio项目是针对.Net framework 4.6.2版本的。我必须在图书馆的帮助下将它与外部应用程序集成。该库仅在 4.5.1 目标版本中可用。我可以在 4.6.2 版本的 visual studio 项目中引用相同的内容。但不确定 运行 在部署环境中相同时的兼容性。这是正确的方法吗?解决方案是什么?
来自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.
我建议阅读完整的 MSDN 文章,因为它继续表明框架版本的差异可能会导致不稳定:
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.
在很多情况下你不会有任何问题,我不认为。我自己从未遇到过任何问题,即使图书馆很大。当然,这并不意味着你不会,所以我提倡谨慎。
我正在做的visual studio项目是针对.Net framework 4.6.2版本的。我必须在图书馆的帮助下将它与外部应用程序集成。该库仅在 4.5.1 目标版本中可用。我可以在 4.6.2 版本的 visual studio 项目中引用相同的内容。但不确定 运行 在部署环境中相同时的兼容性。这是正确的方法吗?解决方案是什么?
来自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.
我建议阅读完整的 MSDN 文章,因为它继续表明框架版本的差异可能会导致不稳定:
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.
在很多情况下你不会有任何问题,我不认为。我自己从未遇到过任何问题,即使图书馆很大。当然,这并不意味着你不会,所以我提倡谨慎。