小编A. *_* Gh的帖子

如何在 Azure Devops 版本部署 Azure 静态 Web 应用中找到我的 staticwebapp.config.json?

我有一个为我的Angular应用程序构建 artificat 的管道。在我尝试访问特定 URL 之前,部署工作正常。它将我重定向到 404。这与staticwebapp.config.json. 看起来像:

{
  "navigationFallback": {
    "rewrite": "/index.html",
    "exclude": ["*.{css,scss,js,png,gif,ico,jpg,svg}"]
  }
}
Run Code Online (Sandbox Code Playgroud)

我在 Azure Devops 中创建了一个发布管道,将其发布到Azure 上的静态 Web 应用程序。这就是我的.yaml样子:

steps:
- task: AzureStaticWebApp@0
  displayName: 'Static Web App: '
  inputs:
    workingDirectory: '$(System.DefaultWorkingDirectory)/xx/xx/xx-xx-web'
    app_location: /
    output_location: dist
    config_file_location: configuration
    skip_app_build: true
    skip_api_build: true
    is_static_export: false
    verbose: true
    azure_static_web_apps_api_token: 'SOMEVALUE'
Run Code Online (Sandbox Code Playgroud)

staticwebapp.config.json 位于此处:

  • 源代码
    • 应用程序
    • 资产
    • 配置
      • 静态webapp.config.json

这是我在发布过程中遇到的错误:

##[error]routes_location: route file 'staticwebapp.config.json/routes.json' could not be found.
Run Code Online (Sandbox Code Playgroud)

或者当我填写config_file_location:

##[error]config_file_location: config file …
Run Code Online (Sandbox Code Playgroud)

azure-devops angular azure-static-web-app azure-static-web-app-routing

3
推荐指数
1
解决办法
3785
查看次数