dazinator / AspNetSolutionUpgradeTool

A utility that can be used to upgrade an ASP.NET 5 RC1 or RC2 based solution to ASP.NET Core 1.0.0 RTM.
MIT License
5 stars 2 forks source link

appSettings.json files - coptyToOutput #32

Closed dazinator closed 8 years ago

dazinator commented 8 years ago

In RC2, you have to explicitly copy appSettings files to the output directory, otherwise when you run your application it can;t find them. You do this by adding this to your project.json file:;

  "buildOptions": {

    "copyToOutput": [
      "appsettings.json",
      "appsettings.Staging.json",
      "appsettings.Production.json"     
    ]
  },

Likewise userSecrets won't work anymore, unless project.json is also copied, (as userSecrets has to read the userSecrets id from the project.json file).

However I don't want the tool to automatically modify project.json files to copy project.json to the output directory because it sounds like that may be in the process of changing: https://github.com/aspnet/UserSecrets/issues/62

Note: the tool already adds appSettings.json to publishOptions, however this logic could do with sprucing up too, as ideally it should add a line for each appSettings file in you project - i.e appSettings.development.json for example.

dazinator commented 8 years ago

Done