我刚刚遇到了一个类似的错误,我相信这与您在错误信息上方的分析仪警告有关.
There is a thread here about that warning. How to fix "The analyzer assembly references version '4.7.0.0' of the compiler, which is newer than the currently running version '4.6.0.0'."
使用global.json文件为我做了not项工作,但值得一试.我通过升级我在机器上安装的Visual Studio 2022版本来修复这个错误.更新到了版本17.9.6,经过一次清理,我能够成功地构建.