Home > Blockchain >  Is the .NET SDK not backwards compatible with older runtimes?
Is the .NET SDK not backwards compatible with older runtimes?

Time:02-12

We have installed .NET desktop runtime 6.0.1 on our machines. Building happens in a docker container with an image built on mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022, which was apparently updated to SDK 6.0.102. Now our app will crash at startup saying

Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'PresentationFramework, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Local builds work just fine, I have SDK 6.0.101 installed.

The target framework in the project is defined as

<TargetFramework>net6.0-windows</TargetFramework>

so I thought it should run on any .NET 6.0, not only on 6.0.2, no matter with which SDK it's built. According to MS Docs it should even run on 6.1 by default, unless a different <RollForward> policy is defined.

What are we missing?

Edit: It must be something with WPF, because console applications built on that container work just fine...

CodePudding user response:

This seems to be a known bug in .net 6.0.2

see: https://github.com/dotnet/core/issues/7172#issuecomment-1034105137

for a workaround you could try this: https://github.com/dotnet/winforms/issues/6663#issuecomment-1034371295

Or just use the sdk:6.0.101-windowsservercore-ltsc2022 image till a fixed version is released

  • Related