gpt4 book ai didi

azure - Blazor Azure 部署错误 : "Error: Could not detect the language from repo."

转载 作者:行者123 更新时间:2023-12-02 07:53:56 25 4
gpt4 key购买 nike

我正在尝试将 Blazor .NET6 应用程序部署到 Azure 静态 Web 应用程序。问题是当我设置构建时它崩溃了:

错误:无法从存储库中检测到语言。

我的部署配置:

name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_MEADOW }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "PortfolioWeb" # App source code path
api_location: "" # Api source code path - optional
output_location: "wwwroot" # Built app content directory - optional
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_MEADOW_000314403 }}
action: "close"

我的项目结构:

PortfolioWeb [repository]
├── .git
├── .github
├── PortfolioWeb [solution dir]
│ ├── .vs
│ ├── PortfolioWeb [project dir]
│ │ └── <blazor project files>
│ └── PortfolioWeb.sln
├── README.md
│ ├── default.html
│ └── post.html
└── .gitignore

我是否搞砸了我的道路?

app_location: "PortfolioWeb"
api_location: ""
output_location: "wwwroot"

在许多教程中,他们除了这个设置之外什么也没做。指定 src 文件夹和 wwwroot。那么为什么它在我的情况下不起作用呢?

最佳答案

经过一番尝试和错误,我终于发现我必须从存储库指定我的项目(而不是解决方案)相对路径。因此,当我在 PortfolioWeb 中时,app_location 是:

app_location: "PortfolioWeb/PortfolioWeb"

换句话说

app_location: "<SolutionFolder>/<ProjectFolder>"

之后,我的 Azure 静态 Web 应用程序已成功部署并运行。

文档: https://learn.microsoft.com/sl-si/azure/static-web-apps/build-configuration?WT.mc_id=DOP-MVP-4020672&tabs=github-actions

关于azure - Blazor Azure 部署错误 : "Error: Could not detect the language from repo.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69896803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com