Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to publish Blazor app to github pages in 2023?

$
0
0

I have tried all day to try and upload my Blazor project to Github pages but I always end in a 404 error.enter image description hereI have tried the yaml below, as well as copying and pasting wwwroot to the repository root.

`name: Deploy to GitHub Pages

Run workflow on every push to the master branch: workflow trigger

on:push:branches:- masterpull_request:branches:- master

jobs:deploy-to-github-pages:

use ubuntu-latest image to run steps on

runs-on: ubuntu-lateststeps:# uses GitHub's checkout action to checkout code form the main branch- uses: actions/checkout@v2# sets up .NET Core SDK 7.0.x- name: Setup .NET Core SDK  uses: actions/setup-dotnet@v1  with:    dotnet-version: 7.0.x # Install dotnet wasm buildtools workload- name: Install .NET WASM Build Tools  run: dotnet workload install wasm-tools# Publishes Blazor project to the release-folder- name: Publish .NET Core Project  run: dotnet publish Portfolio/Portfolio.csproj -c:Release -p:GHPages=true -o dist/Web --nologo# changes the base-tag in index.html from '/' to 'WebPortfolio' to match GitHub Pages repository subdirectory- name: Change base-tag in index.html from / to WebPortfolio  run: sed -i 's/<base href="\/" \/>/<base href="\/WebPortfolio\/" \/>/g' release/wwwroot/index.html#Publish static files to Github pages- name: Commit wwwroot to GitHub Pages  uses: JamesIves/github-pages-deploy-action@3.7.1  with:    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}    BRANCH: gh-pages    FOLDER: dist/Web/wwwroot`

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>