I am building an open source project with Visual Studio 2022. The open source project was throwing this error. I do not need to sign the project to do my testing.
In Visual Studio 2022, right-click on the project. Left-click Properties. Scroll down to Build / Strong Naming. Under Sign the assembly, uncheck Sign the output assembly to give it a strong name.
Build the project and the error no longer displays.