dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.72k stars 1.07k forks source link

Wrong RuntimeFrameworkVersion indicated in runtimeconfig #23764

Open rnsoon opened 2 years ago

rnsoon commented 2 years ago

Is there an existing issue for this?

Describe the bug

Given section in project file: image

The resulting runtimeconfig is as follows: image

Application will not run unless 6.0.0 is installed or a different rollforward strategy is used (e.g., latestpatch).

Expected Behavior

Runtimeconfig.json must indicate the 6.0.1 as the targeted .NET runtime version (as in RuntimeFrameworkVersion)

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

.net 6

Anything else?

Using VS 2022

dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc

.NET SDKs installed: 6.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

baronfel commented 2 years ago

Hello! I couldn't reproduce this with the following steps on .NET SDK 6.0.102:

dotnet new webapi
<manually add RuntimeFrameworkVersion 6.0.1 and RollForward disable to the generated project file>
dotnet build

After this build, I checked the generated runtimeconfig.json file, which looked like this:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "rollForward": "disable",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "6.0.1"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "6.0.1"
      }
    ],
    "configProperties": {
      "System.GC.Server": true,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

This seems to be correct. Can you try again and let me know if you can reproduce?