Microsoft.Assumes + InternalErrorException:文件不应依赖于自身在asp.net Core 3.1 Visual Studio Windows上

问题描述

试图在Windows VM上的Visual Studio 2019中打开在Visual Studio for Mac中创建的项目,并收到此错误

=====================
8/22/2020 3:14:58 AM
NotRecoverable
Microsoft.Assumes+InternalErrorException: File should not depend on itself.
   at Microsoft.Assumes.Fail(String message)
   at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.ResolveDependentItems(Dictionary`2 pendingItemsByDirectory)
   at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports,CancellationToken cancellationToken)
   at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__208.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.ProjectTreeProviderBase.TreeUpdateSubmission.<UpdateTree>d__19.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.VisualStudio.ProjectSystem.CoreProjectTreeProviderBase.<>c__displayClass76_1.<<Initialize>b__2>d.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.CoreProjectTreeProviderBase.<>c__displayClass78_0.<<SubmitTreeUpdateCoreAsync>g__waitOnTask|0>d.MoveNext()
RunningInVisualStudio Microsoft.VisualStudio.ProjectSystem.RetailRuntime HostSetActiveProjectConfiguration
===================

解决方法

我在proj文件中设置了Generated文件和其他相关文件的相关性时遇到了类似的问题。 就我而言,依赖文件的掩码File * .cs包括File.cs

<ItemGroup Label="Database"> <Compile Update="Data\File*.cs"> <DependentUpon>File.cs</DependentUpon>