It says that folders like wwwroot will automatically be copied to the output folder but it is not. I added the following statements to the csproj file and it works.
<ItemGroup>
<Content Update="wwwroot\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>