【发布时间】:2021-06-10 21:41:04
【问题描述】:
当我尝试编译我的 Blazor WebAssembly 应用程序时遇到此错误。
error CS0234: The type or namespace name 'ApplicationPartAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' (are you missing an assembly reference?)
原因是因为我使用的库使用了Microsoft.AspNetCore.Mvc.Core,而且它似乎与 blazor Web Assembly 不太兼容,
我确实测试过创建一个服务器端 Blazor 应用程序,它工作正常。
有没有办法让错误“消失”?我想使用那个库,我想坚持使用 Blazor WA。
【问题讨论】:
-
我总是得到这种东西。 Blazor 中的 VS Intellisense 是一团糟,我认为现在我们只能接受它。
-
您使用的是哪个版本的 Asp.net Core?从official document可以看出类名应该是
ApplicationPartAttribute,而不是ApplicationPartAttributeAttribute(attribute是重复的)。ApplicationPartAttribute类适用于 Asp.net Core 3.0、3.1、5.0。 -
@Bennyboy1973 是的,好像是这样,因为它是一个内部库,我最终将它一分为二,但我担心更大的库会发生类似的情况:/
-
@ZhiLv 我用的是net5;我主要担心的是为什么它在 blazor 服务器端而不是在 WA 中工作。
-
哪个库? MVC 的东西不适用于 WebAssembly。
标签: c# asp.net-core blazor blazor-webassembly