首页 > 解决方案 > Does sku attribute in app.config determines against which framework the application is running?

问题描述

I have multiple frameworks installed on my machine.I have .NET Framework 4.6.1 and .NET Framework 4.8

If i build my application say with .NET Framework 4.6.1 and want to run it against 4.8. How do i do it?

Will adding the following tags in the App.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup>         
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> 
    </startup>
</configuration>

make sure that the application is run against 4.8? Even though 4.6.1 still exits on the machine. If so how do i determine that my application has run against 4.8?

标签: c#.netvisual-studio

解决方案


如果您想使用另一个 .net 框架版本运行应用程序,您可以尝试以下两种方法来修改您的 .net 框架版本。

首先,请右键单击您的项目属性-> 选择 .NET Framework 4.8-> 重建项目。

在此处输入图像描述

其次,请在文件资源管理器中右键单击您的项目打开文件夹-> 打开 .csproj 文件。

尝试改变:

<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>

保存.csproj文件后,visual studio会弹出提示框,请选择reload all,即可修改成功。


推荐阅读