具有4.7.2目标框架版本的C#项目是否可以在.net 4.6.1上运行 [英] Can C# projects that have 4.7.2 target framework version run on .net 4.6.1

查看:38
本文介绍了具有4.7.2目标框架版本的C#项目是否可以在.net 4.6.1上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个C#项目,其中的C#项目是使用TargetFrameworkVersion 4.7.2编译的.例如,在csproj文件中指定为-

We have a C# project where the C# projects are compiled with TargetFrameworkVersion 4.7.2. For example, in the csproj file this is specified --

 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>

编译并生成的exe安装在已安装.net 4.6.1的VM中.我看到安装成功,并且软件运行正常.因此,我们可以肯定地说,在安装.netframework 4.6.1之后,可以执行使用4.7.2构建的项目.还是这里有什么问题要注意?

The compiled and built exe is installed in a VM which has .net 4.6.1 installed. I see that installation is successful and the software is working fine. So can we safely say that projects built with 4.7.2 can execute when .netframework 4.6.1 installed. Or are there any issues to look out for here ?

推荐答案

您可以使用

You can use supportedRuntime element in your app.config file, like

<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
    </startup>
</configuration>

这是可能的,因为它们共享相同的CLR版本4.0.但是,如果使用.NET 4.7.2中的任何特定功能,则可能会遇到运行时异常.请查看线程以了解更多详细信息

It's possible, since they share the same CLR version 4.0. But you'll probably get a runtime exception, if using any specific features from .NET 4.7.2. Have a look at this thread for more details

这篇关于具有4.7.2目标框架版本的C#项目是否可以在.net 4.6.1上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆