我已将Microsoft.AspNetCore.Blazor.DevServer下载到3.0.0-preview9.19465.2,并将Microsoft.AspNetCore.Blazor.HttpClient下载到了3.0.0-preview9.19465.2
更新了必须在客户端和服务器上都更新的软件包。然后去除不必要的东西。然后建立我的解决方案。我可以成功构建,但是当我运行项目时,我陷入了“加载中...”的状态,并且在检查器中出现了以下错误:
System.InvalidOperationException: Object of type 'Microsoft.AspNetCore.Components.Routing.Router' does not have a property matching the name 'ChildContent'.
该如何解决?谢谢。
答案 0 :(得分:1)
检出您的app.razor文件并将其更改为以下
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
还要进入_Imports.razor并确保解决任何using语句都没有问题。例如,Microsoft.AspNetCore.Layouts不再存在。
答案 1 :(得分:0)
我也遇到了同样的问题。
我从“ 3.0.0-preview6.19307.2”升级到“ 3.0.0-preview9.19465.2”,并一次升级了一个预览,并使用以下链接涵盖了每个版本中升级的所有内容。 / p>
https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-7/ https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-8/ https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/
然后我用以下内容更新了App.razor
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
希望这会有所帮助!