Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
325 stars 56 forks source link

Error when following Azure Static Web App Tutorial Blog: Client' is invalid. Could not detect this directory #1292

Open siegfried01 opened 1 year ago

siegfried01 commented 1 year ago

Error when following Azure Static Web App Tutorial Blog: Client' is invalid. Could not detect this directory

To Reproduce Steps to reproduce the behavior:

  1. Follow this tutorial: https://www.microsoft.com/en-gb/industry/blog/technetuk/2023/02/01/using-github-actions-to-deploy-an-azure-static-web-app/

Error in log file from initial Action:

I have pasted the results from the action log here:

DeploymentId: 8b4de2a2-c694-4a6a-bf61-994b032a0e91

Try to validate location at: '/github/workspace/Client'. App Directory Location: 'Client' is invalid. Could not detect this directory. Please verify your workflow file reflects your repository structure.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/ If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/ Exiting

Thanks

Siegfried

brswan commented 3 months ago

I ran into the same error error following the tutorial. I'm still learning Blazor myself so take this advice with that in mind.

When I followed a tutorial - I was using the Blazor Web App template - which creates two projects - one for Client and another for Server side. See here for more information: https://stackoverflow.com/questions/77575252/missing-html-file-for-blazor-net-8-web-app-when-published-with-jetbrains-rid

I was able to get past the error you see by updating the workflow file, however, the main problem is that I did not have the Blazor WASM Stand Alone project in my solution. Once I added this - I was able to deploy using Visual Studio.

To fix the build issue you see do the following:

  1. Go to your repo on Git
  2. Select .github/workflows
  3. Select the .yml file
  4. Update app_location: "Client" # App source code path to the name of you client project ex: app_location: "HelloWorld.Client"

Please note -I still had build issues which I realized that the Client project outputs no index.html file. This led me to the Stack link that indicated I was not using the Blazor WASM Stand Alone Project.

Hope this helps!