我正在用Blazor和WebAssembly做一些测试,我已经在https://docs.microsoft.com/en-us/aspnet/core/blazor/?view=aspnetcore-3.1上学习了一些教程
我可以很好地构建和运行我的测试项目。但是,当我尝试在Visual Studio 2019中发布Blazor客户端或Blazor服务器时,我收到一条错误消息:
Publish failed
Publish has encountered an error.
Object reference not set to an instance of an object.然后它引用一个日志文件,我已经检查过了,它包含以下内容。
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Publish.Framework.Provider.DefaultPublishTabProvider.CreatePublishServiceProvider(IVsHierarchy hierarchy)
at Microsoft.Publish.Framework.Provider.DefaultPublishTabProvider.CreateViewAsync(IVsHierarchy project, IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken)
at Microsoft.Publish.Framework.Provider.PublishProjectDesignerTabProvider.<CreateViewAsync>d__7.MoveNext()我不确定这是一个bug,因为Blazor WebAssembly仍在预览中,或者是我的设置有问题。我试着用谷歌搜索这个错误,但结果很少。
所以我想知道是否有其他人与Blazor和WebAssembly合作过,他们以前见过这个错误,他们是否解决了这个问题?
发布于 2021-11-18 09:40:27
我以前经历过这种情况,但自VS 2017年以来就没有经历过。以前的工作是:
在C:\Users%userprofile%\AppData\Local\Microsoft\VisualStudio中删除所有内容的
在C:\Users%userprofile%\AppData\Local\Microsoft\VSCommon中删除所有内容的
devenv /resetuserdata,这将清除Visual Studio.祝好运。
https://stackoverflow.com/questions/60390169
复制相似问题