Home > other >  .NET Application version compatibility between .NET 6 Desktop Runtime versions
.NET Application version compatibility between .NET 6 Desktop Runtime versions

Time:01-09

I am working on a Visual Studio Solution with an C# application project (WPF). This project targets net6.0-window framework. My goal is to be compatible with every .NET6 Desktop Runtime Environment version.

When running the executable on another machine the .NET 6 Desktop Runtime Environment in version 6.0.8 must be installed. But when the machine has already installed a newer Version (currently 6.0.12) the executable won't start and a window appears: "You must install or update .NET to run this application [...] version 6.0.8".

How can I configure the .NET project to allow also later versions of the .NET 6 Desktop Runtime Environment?

CodePudding user response:

I think you can try this method to fix it.

<ItemGroup Condition="'$(TargetFrameworkVersion)' == '6.0'">
  <FrameworkReference
          Update="Microsoft.WindowsDesktop.App;Microsoft.WindowsDesktop.App.WPF;Microsoft.WindowsDesktop.App.WindowsForms"
          TargetingPackVersion="6.0.0" />
</ItemGroup>

Update:

This issue is left over from previous versions, updating to the latest version can fix the problem.

The same problem can try to update to .Net 7.0 and then fall back to 6.0.x, this will fix the problem.

  • Related