我正在尝试将Blazor网站放在MAUI应用程序中的一个单独目录中,以创建分离(并在将来将其用作GIT子模块)。
但是,我似乎无法让MAUI识别出一个与默认的wwwroot/index.html不同的BlazorWebView 'HostPage‘引用,有人知道如何将其设置为子目录位置吗?

当前MainPage.xaml的代码,它编译和运行,但给出0.0.0.0无法找到;
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiApp1.ImagineItsASubModule"
x:Class="MauiApp1.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<BlazorWebView HostPage="ImagineItsASubModule/wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentPage>发布于 2022-07-06 23:22:33
找出我的问题,在这里为任何有问题的人发帖子。
由于复制/导入html/css等文件,文件上的“build”设置为“None”,因此当生成发生时,它们自然不会随编译一起出现。
为此,我将项目组添加到csproj文件中;
<ItemGroup>
<Content Include="ImagineItsASubModule\\**\*.*" />
</ItemGroup>现在,需要的文件出现了,Blazor按预期启动,可能需要处理regex,以确保某些项按需要包括/排除。
https://stackoverflow.com/questions/72886011
复制相似问题