0

I wanted to publish my Blazor client side to Azure static web app with following locations:

app_location: "src/Client/Project.Client.Web"
api_location: ""
output_location: "wwwroot"

and I received an error:

Failed to find a default file in the app artifacts folder (wwwroot). Valid default files: index.html,Index.html.

If your application contains purely static content, please verify that the variable 'app_location' in your workflow file points to the root of your application.

If your application requires build steps, please validate that a default file exists in the build output directory.

The app is buildable locally without problem, do you know where could be a problem ? Or what do I do wrong ?

Julian
  • 33,915
  • 22
  • 119
  • 174
Kebechet
  • 1,461
  • 15
  • 31

1 Answers1

2

After several hours of trial and error I stumbed upon a possibility to deploy a project from Visual Studio locally:

enter image description here

So I set up this local publishment and then I published it on my local drive. And thanks to that I found out that my index.html is not in the wwwroot as expected but in wwwroot/app.

So when I edited my deployment file: azure-static-web-apps-asdasd-asdds-1234.yml and changed: output_location from wwwroot to wwwroot/app it finally worked.

The /app subfolder was created probably (just speculation) because this app service has linked custom domain (subdomain): app.project.fit.

EDIT: So the real cause of this /app subfolder was a specified property in .csproj

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <StaticWebAssetBasePath>app</StaticWebAssetBasePath> //<--- this
</PropertyGroup>

that was a leftover from DualHosted project of client and server. Example here: https://github.com/Kebechet/BlazorDualHostedExample

Kebechet
  • 1,461
  • 15
  • 31