dotnet publish doesn´t publish correct appsettings.{env.EnvironmentName}.json

后端 未结 5 1498
难免孤独
难免孤独 2020-11-29 03:27

When I issue the following command in the command line:

dotnet publish -o \"./../output\" -c Release

The dotnetcli publishes the pr

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 03:45

    In your project.json there is a section publishOptions. This lists all the files and folders that will be included when you publish. You will need to update yours to look something like this

    {
      "publishOptions": {
        "include": [
          "wwwroot",
          "Views",
          "appsettings.json",
          "appsettings.Production.json",
          "web.config"
        ]
      },
    }
    

    You can also use globbing patterns, so you should find this works too (I haven't tested this one)

    {
      "publishOptions": {
        "include": [
          "wwwroot",
          "Views",
          "appsettings*.json",
          "web.config"
        ]
      },
    }
    

提交回复
热议问题