Blazor WebAssembly 本地调试时如何将项目运行在子目录

假设项目名为MyApp,想要运行的子目录名也叫MyApp

MyApp.csproj

<PropertyGroup>
	<StaticWebAssetBasePath>MyApp</StaticWebAssetBasePath>
</PropertyGroup>

Properties/launchSettings.json

    "https": {
      "commandName": "Project",
      "commandLineArgs": "--pathbase=/MyApp",
      "launchBrowser": true,
      "launchUrl": "MyApp/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "dotnetRunMessages": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/MyApp/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:7270;http://localhost:5238"
    }

wwwroot/index.html

<base href="/MyApp/" />
posted @ 2024-02-18 17:22  Yu-Core  阅读(40)  评论(0编辑  收藏  举报