Github actions workflow failing to find Index.html for an ASP .NET Core MVC web app

haynque 0 Reputation points
2023-03-15T14:28:48.7766667+00:00

Although I've been studying computer science for a few years now and am pretty comfortable talking about it, this is a new area for me and I'm not very familiar with all the proper terminology, so I apologize in advance.

I'm trying to publish an azure static web app to act as a personal portfolio. I have the full ASP .NET Core MVC project built and I have added the github action workflow file but believe I have configured it incorrectly. It successfully builds in Oryx but gets stuck shortly after with this error:

Failed to find a default file in the app artifacts folder (/). 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.

Here is my workflow file env variables:

env:
  APP_LOCATION: "/projectname" # location of your client code
  #API_LOCATION: "api" # location of your api source code - optional
  APP_ARTIFACT_LOCATION: "/"
  skip_app_build: true
  AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}

I'm wondering if what I'm trying to do is even possible, or if I'm barking up the wrong tree by trying to publish this kind of project without building it with something like Blazor. Any thoughts or recommendations?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2023-03-18T07:33:04.4133333+00:00

    You chose the right service to deploy to, so the error message is desired.

    ASP.NET Core MVC is a server side rendering technology, so it cannot be hosted in Azure Static Web Apps but Azure App Service (or other equivalent services).

    If you insist using Azure Static Web Apps, then your only option right now with C# is to create a Blazor WebAssembly project,

    https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-blazor

    0 comments No comments

  2. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-03-28T07:18:32.3933333+00:00

    haynque Thanks for reaching here! The error message you're encountering suggests that the GitHub Actions workflow is unable to find the default file (index.html or Index.html) in the app artifacts folder.

    You may want to know that there are three folder locations specified in the workflow.

    Ensure these settings match both your project and any tools that transform your source code before deployment.

    User's image

    You can find more information on how to configure the build process for Azure Static Web Apps in the following document: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/static-web-apps/build-configuration.md

    Also see similar issue here

    Let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.