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. 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:
LC
which I don't see it directly in the file structure. What does this file mean?Update 1:
After some experiments, I am able to isolate the problem in a third party tool Actipro. There are two ways to integrate this tool. The first way which I used is installing the software and reference the assemblies. It worked fine. Since we are moving to Azure, I had to switch to the second way which is their Nuget Package. It worked fine on my local system but not on the Pipeline/VM. Today I uninstalled my local installation of Actipro and I am seeing the same error on my local machine. So I guess this problem is not related to the VM. Is there a way that a Nuget package reading license info from local storage? Here is a link to their official guide: https://www.actiprosoftware.com/docs/controls/wpf/licensing
The problem is caused by an existing .licx file, which is no longer supported by Actipro .NET 6. After removing the file, it works without issue.