[英].net Dll shows framework 4.0 after being converted to 4.5.2
I've found a partial answer to my question in this thread: 我在此线程中找到了我的问题的部分答案:
Here on stackoverflow cannot change target framework... 在这里stackoverflow无法更改目标框架...
In my case, the framework has successfully been converted to 4.5.2, and putting a method with async and await, that I'm sure are part of framework 4.5, the method is successfully run by an exe referencing the library. 就我而言,该框架已成功转换为4.5.2,并放置了一个带有async和await的方法,我确定它是框架4.5的一部分,该方法由引用该库的exe成功运行。 So I can presume that the library is really compiled using framework 4.5.2.
因此,我可以假定该库实际上是使用框架4.5.2编译的。
However, when referenced in any other project the library shows in its properties that it is compiled under framework 4.0. 但是,当在任何其他项目中引用该库时,该库将在其属性中显示它是在框架4.0下编译的。 and when the debugger loads the assembly it prints out that it is compiled under framework 4.0... So who is right?
当调试器加载程序集时,它会打印出它是在Framework 4.0下编译的...那么谁是对的? my code executing methods of framework 4.5 or the strings telling the library is on framework 4.0?
我的框架4.5的代码执行方法或告诉库的字符串在框架4.0上?
I've checked for what possible in my abilities if there are any .targets files in my installation, and yes there are two, under the msbuild-targets temporary folder, Microsoft.Common.targets and Microsoft.Csharp.targets, but I'm not able to understand if these files force the compiler to use framework 4.0. 我已经检查了我的安装中是否有任何.targets文件,并且在msbuild-targets临时文件夹下有两个Microsoft.Common.targets和Microsoft.Csharp.targets,我有什么可能,但是我我无法理解这些文件是否迫使编译器使用框架4.0。 Mainly because on this machine I compile directly in visual studio.
主要是因为我在这台机器上直接在Visual Studio中进行编译。
I have several solutions using component libraries compiled 4.5.2 that work correctly. 我有几种使用组件库4.5.2正常工作的解决方案。 So I don't really know how to be sure that my library is compiled under the right framework and that the library shows the right framework in its properties and when loaded.
因此,我真的不知道如何确定我的库是在正确的框架下编译的,以及该库在其属性和加载时是否显示了正确的框架。
If anyone has a clue on how to achieve this, thank you in advance. 如果有人对如何实现这一目标有所了解,请先谢谢您。
If your project properties say you're targeting .NET 4.5.2, then it's being built to work with .NET 4.5.2 and above versions. 如果您的项目属性表明您的目标是.NET 4.5.2,则说明该版本可与.NET 4.5.2及更高版本一起使用。
Maybe you've a confusion with CLR and Framework versions. 也许您对CLR和Framework版本感到困惑。 .NET 4.x (any) work with CLR (ie Common Language Runtime ) 4.0.
.NET 4.x(任何版本)可与CLR(即公共语言运行时 )4.0一起使用。
Check .NET Framework Versions and Dependencies to get further details about this topic. 检查.NET Framework版本和相关性以获取有关此主题的更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.