Search code examples
c#asp.net-coreasp.net-core-staticfile

ASP.NET Core publish of wwwroot subfolders starting with '.'


I have an ASP.NET Core project where wwwroot folder subfolders that start with a letter get published fine but ones that start with . do not, e.g. wwwroot/.auth

Is there a known reason for that to be the case or does one need to do some special case step in csproj [ and dockerfile ] to include those subfolders starting with .?


Solution

  • I had this problem too, I need to publish some static files in wwwroot/.well-known folder for LetsEncrypt validation

    Just "include" the folder in the project, then press F4 on its files and in the "properties" set "copy to output folder"

    Alternatively just copy-paste this into your .csproj

    <ItemGroup>
      <Content Include="wwwroot\.well-known\*">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </Content>
    </ItemGroup>