I migrated a WPF project from .NET Framework to .NET 6 which builds fine on my local system (windows 11). However when I moved forward to Azure pipeline, we got this error and it can be replicated on a Windows Server 2022 VM. There are multiple .NET projects in the solution. This is the only project with this issue.
The full error is
Error LC0000 'Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)' ProAnalysisUI C:\...\ProAnalysisUI\LC 1
There are several points confuse me:
- The error shows missing assembly but "System.Runtime" is not directly used in this project. How can I trace where the assembly cause this error?
- It shows the error occurs in file
LC
which I don't see it directly in the file structure. I searched it and it seems the file is related to licenses. But the licenses of what?
- Why the error does not exist on my local system windows 11?
- Last, what could be a solution?