Orchard Hungary is an archive

This site is now an archive. We'll keep it so the content is accessible, but we won't update it anymore. However, we frequently publish Orchard-related news on our other site Orchard Dojo, so be sure to check that out instead. And if you're interested in news about our Orchard development company, Lombiq, check out our website.

Orchard Brotips: deploy without .hg folders

Tags: Orchard, Orchard brotips, deployment, Mercurial

The Orchard web project file, Orchard.Web.csproj contains a line that tells the compiler to include (among others) modules and themes in the result package too. That one currently has a slight, but important glitch: the pattern for excluding Mercurial-related files is broken. Therefore, if you have subrepositories in you solution (like it's frequent with modules or themes) their .hg folders will also be in the deploy package. With big repositories, besides deploying a bunch of unnecessary files, this can even cause errors when publishing:

Error Copying file ModuleFolder\.hg\store\data_libraries_parallel_extensions_extras_coordination_data_structures_async_coordination_async_reader_writer.cs.i to obj\Release\Package\PackageTmp\ModuleFolder\.hg\store\data_libraries_parallel_extensions_extras_coordination_data_structures_async_coordination_async_reader_writer.cs.i failed. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Solving this is very simple. There's the following line responsible for this in Orchard.Web.csproj:

<_CustomFiles Include="Media\**\*;App_Data\**\*;Modules\**\*;Themes\**\*;Core\**\*" Exclude="**\obj\**;@(Orchard-Web-Bins -> '**\%(Filename)%(Extension)');**\*.csproj.user;**\*.hg*" />

It should be modified to this:

<_CustomFiles Include="Media\**\*;App_Data\**\*;Modules\**\*;Themes\**\*;Core\**\*" Exclude="**\obj\**;@(Orchard-Web-Bins -> '**\%(Filename)%(Extension)');**\*.csproj.user;**\.hg\**" />

This will filter out .hg folders, but not other Mercurial files like .hgignore or .hgsub. Since those are harmless, I haven't tweaked the pattern further, but if you'd like, do it and share the result :-). Vote on the issue if this is a problem for you as well!

Happy publishing!

No Comments