Visual Studio Publishing (Deploying) Package Contains Mercurial (hg) (Orchard) Files

I have a C # solution for a web project (actually this is the Orchard CMS website, but it doesn’t matter), this version is controlled under Mercurial (using Tortoise HG BTW), which has some projects that are in separate repositories (and subrepositories solution repository). Hg files are never included anywhere in the solution; they are not displayed anywhere in Visual Studio.

When I try to publish a solution (or create a deployment package) with the option "Only files necessary to run the application" selected as part of the web project properties, hg files (for example, the entire .hg folder) of subheadings are embedded in the package.

This is basically harmless (besides publishing a few unnecessary files), but publishing can also complete completely with the following message:

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

I have no idea what to do next, how to prevent VS from creating files that he supposedly does not see. Any help would be greatly appreciated.

+4
source share
1 answer

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.

+2
source

All Articles