It turns out the fact that this Orchard decision is an important fact!
Here is this line in Orchard.Web.csproj:
<Target Name="CustomCollectFiles"> <ItemGroup> ... <_CustomFiles Include="Media\**\*;App_Data\**\*;Modules\**\*;Themes\**\*;Core\**\*" Exclude="**\obj\**;@(Orchard-Web-Bins -> '**\%(Filename)%(Extension)');**\*.csproj.user;**\*.hg*" />
It was used to copy files from individual folders using Orchard to the build package. Note that it should exclude Mercurial files and folders, but this is not the case. I changed this line as follows:
<_CustomFiles Include="Media\**\*;App_Data\**\*;Modules\**\*;Themes\**\*;Core\**\*" Exclude="**\obj\**;@(Orchard-Web-Bins -> '**\%(Filename)%(Extension)');**\*.csproj.user;**\.hg\**" />
Note the "*" after .hg. Yes, it took me about three hours, going through each build configuration option I could find to achieve this.
Now it excludes only .hg folders, but not .hg files (like .hgignore or .htags), but I don’t care: they are harmless in spite of the .hg folders that contain a bunch of files.
This blogpost helped me.
source share