错误	 CS8032; Analyzer System.text.json.sourcegeneration.jsonsourcegenerator的实例无法创建
我通过。升级助手将其升级到.NET 5,并留下以下两个错误,除了Roslyn版本控制(3.11和4.0)。
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn3.11\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn4.0\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
如果我将nuget软件包引用添加到system.text.json版本6.0.0,第二个错误会消失,让我
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn3.11\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
有Nuget软件包引用对Nhibernate 5.3.12和Serilog 2.11.0,没有其他。我不确定如何诊断可能导致该项目问题并进行编译。任何建议将被赞赏。
I ran my .Net Framework 4.7.1 project through the .NET Upgrade Assistant to upgrade it to .NET 5 and have been left with the following two errors that are both the same except for the roslyn versioning (3.11 and 4.0).
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn3.11\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn4.0\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
If I add a nuget package reference to System.Text.Json version 6.0.0, the second error goes away, leaving me with
Error CS8032 An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\myAccount\.nuget\packages\system.text.json\6.0.5\analyzers\dotnet\roslyn3.11\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
I have nuget package references to NHibernate 5.3.12 and Serilog 2.11.0 and no others. I am not sure how to diagnose what could be causing the problem for this project and get it to compile. Any suggestions are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,似乎添加了不必要的系统.text.json Nuget软件包是红鲱鱼。
事实证明,我正在使用Visual Studio 2019(我们在整个或开发.NET 5的产品中使用或开发了同一IDE)。当我在Visual Studio 2022中打开解决方案时,实际显示了基础误差,易于解决,现在可以按预期进行编译。
So it appears that the addition of the unnecessary System.Text.Json nuget package was a red herring.
It turned out that I was using Visual Studio 2019 (the same IDE we have been using throughout or development of the product pre-upgrade to .NET 5). When I opened the solution in Visual Studio 2022, the underlying errors were actually displayed, easily resolved, and now the solution compiles as expected.