简体   繁体   English

具有 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

We have a C# project where the C# projects are compiled with TargetFrameworkVersion 4.7.2.我们有一个 C# 项目,其中 C# 项目是使用 TargetFrameworkVersion 4.7.2 编译的。 For example, in the csproj file this is specified --例如,在 csproj 文件中,这是指定的——

 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>

The compiled and built exe is installed in a VM which has .net 4.6.1 installed.编译和构建的 exe 安装在安装了 .net 4.6.1 的 VM 中。 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.所以我们可以肯定地说,使用 4.7.2 构建的项目可以在安装 .netframework 4.6.1 时执行。 Or are there any issues to look out for here ?或者这里有什么需要注意的问题吗?

You can use supportedRuntime element in your app.config file, like您可以在app.config文件中使用supportedRuntime元素,例如

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

It's possible, since they share the same CLR version 4.0.这是可能的,因为它们共享相同的 CLR 4.0 版。 But you'll probably get a runtime exception, if using any specific features from .NET 4.7.2.但是,如果使用 .NET 4.7.2 中的任何特定功能,您可能会遇到运行时异常。 Have a look at this thread for more details查看线程以了解更多详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以在.Net Framework 4.6.1中使用C#7.3吗? - Can I use C# 7.3 with .Net Framework 4.6.1? AppHarbor c# 4.6.1 比当前目标框架中存在的版本更高 - AppHarbor c# 4.6.1 higher version than exists in current target framework C# .NET 框架 4.7.2 中的 8 个功能 - C# 8 features in .NET Framework 4.7.2 只有更改 web 配置文件,我才能将 .NET 框架 4.6.1 迁移到 4.7.2 吗? - can I migrate .NET Framework 4.6.1 to 4.7.2 only if change web config file? 数据未通过 DataBinding 正确更新(C#,.NET Framework 4.7.2) - data not updated properly through DataBinding (C#, .NET Framework 4.7.2) 集成测试C#WebAPI asp.NET Framework 4.6.1 - Integration testing C# WebAPI asp.NET Framework 4.6.1 如何将 Target Framework 从 .NET 5.0 降级到 .NET Framework 4.7.2? - How can I downgrade Target Framework from .NET 5.0 to .NET Framework 4.7.2? Nuget package 创建 - Class 库以 Z303CB0EF9EDB9082D61BBBE5625D972AZ41 为目标框架不正确。 - Nuget package creation - Class library that targets .NET framework 4.6.1 can not target correct framework EntityFramwork 与 .net 框架 4.7.2 项目和 .net 标准 2.0 项目的兼容性 - EntityFramwork compatibility with .net framework 4.7.2 projects and .net standard 2.0 project Asp.NET MVC应用程序是使用.net Framework 4.5版构建的,我想在更高的.net框架4.7.2上运行该应用程序 - An Asp.NET MVC application is built with .net framework version 4.5, I want to run the application on a higher .net framework that is 4.7.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM