Reputation: 732
I am using ASP.NET Core 2.0 in Visual Studio 2017.
My site works fine when I hit debug in IIS Express. But when deploying the site to IIS server, not all the folders and files in wwwroot are deployed. I have looked at the .csproj file, but I don't know how to make sure it deploys all files and folders.
Upvotes: 34
Views: 39171
Reputation: 3154
Notice to myself:
when you stumble over this issue again (like it happened twice already), double check whether the wwwroot
content is really committed to git, and the build agent has the files to publish, or if there is an exclusion of wwwroot
in (any) .gitignore
:facepalm:
Upvotes: 5
Reputation: 249
It's working for me
<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Upvotes: 24
Reputation: 173
<PropertyGroup>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
<Content Include="wwwroot\**\*">
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>
Upvotes: 16
Reputation: 732
I solved the issue. The solution is to edit the .csproj file.
Remove all the ItemGroup
tags related to wwwroot and then add this one:
<ItemGroup>
<None Include="wwwroot\*" />
</ItemGroup>
The asterisk will include all the subfolders and files.
Upvotes: 19