使用Github操作发布和托管blazor Web程序集时出错



我使用本教程将我的Blazor WebAssemply网站发布到Github页面。当我运行操作时,我得到

/home/runner/work/learning-blazor/learning-blazor/Learning_Blazor.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found.

所有其他教程都会产生相同的结果。这是我的主要产品。yml:

name: Deploy to GitHub Pages
# Run workflow on every push to the master branch
on:
push:
branches: [ main ]
jobs:
deploy-to-github-pages:
# use ubuntu-latest image to run steps on
runs-on: ubuntu-latest
steps:
# uses GitHub's checkout action to checkout code form the master branch
- uses: actions/checkout@v2.4.2

# sets up .NET Core SDK 3.1
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: 3.1

# publishes Blazor project to the release-folder
- name: Publish .NET Core Project
run: dotnet publish Learning_Blazor.csproj -c Release -o release --nologo

- name: Deploy GitHub Pages site
uses: actions/deploy-pages@v1.0.10
with:
token: github.token

有人能提出解决方案吗?

我也遇到了同样的问题,这是由于我的应用程序的dotnet-version实际上是.NET 7,所以我将该行更改为dotnet-version: 7.0.x。我想你也可以对.NET 5和6做同样的事情。

最新更新