I ported my .NET 5.0 application to .NET 6.0 and now I found that the source-code generator fails. It shows the following error:
Generator 'PermissionGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'
Adding <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
to the property-group of the generator's project-file didn't really help. It does add System.Collection.Immutable.dll
to the output folder (6.0.21.52210), but I still get the same error.
My generator is a .NET Standard 2.0 project, which might not be necessary anymore with .NET 6. So I also tried setting the runtime for the generator to .NET 6. This failed with another error:
An instance of analyzer ... cannot be created from ... Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.