Some files in "wwwroot" folder are not published in ASP.NET Core web deploy
Solution 1
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.
Solution 2
<PropertyGroup>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
<Content Include="wwwroot\**\*">
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>
Solution 3
It's working for me
<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Solution 4
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:
Related videos on Youtube
kudzai zishumba
Updated on February 26, 2022Comments
-
kudzai zishumba about 2 years
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.
-
rene almost 6 yearsare the file and folders you need part of the .csproj?
-
Marcus Höglund almost 6 yearsHow do you deploy?
-
-
kudzai zishumba almost 6 yearsall the files in the wwwroot folder will be included except for empty files
-
Dan Gifford over 4 yearsIf you remove all the other itemgroup tags, won't other items that were meant to be included end up NOT in the build?
-
A X about 4 yearsWhy is the element named "None" and not "Content"?