且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

net core 2.0 appsettings.json 保存在 bin 目录中

更新时间:2023-02-16 09:31:18

我一直在寻找这个问题的答案,我发现的大部分帖子都引用了 project.json 文件,该文件现已被弃用.csproj 文件 根据 3 月发布的本指南2017.

I've been looking for an answer to this question and most of the posts I've found reference the project.json file which has now been deprecated in favour of the .csproj file according to this guide published March 2017.

本文档还说明了您如何可以使用 .csproj 文件中的CopyToOutputDirectory"属性来确保将 appsettings.json 文件复制到构建时的输出目录:

This document also indicates how you can use the "CopyToOutputDirectory" attribute in your .csproj file to ensure your appsettings.json file is copied to the output directory on build:

<Project ...>
    ...
    <ItemGroup>
        <None Include="appsettings.json" CopyToOutputDirectory="Always" />
    </ItemGroup>
</Project>

.