Build/Test Issues

Build problem: Hg repository not found

Started by Stellorion on 9,914 views

Hi,

Using the last version on VS 2010, I have the following build error:

(126): Mercurial command "hg.exe identify -n" exited with code -1.
abort: there is no Mercurial repository here (.hg not found)

This problem come from a special msBuild task that update version numbers based on the mercurial revision number. For that, I am using MSBuild Versioning Task I got on Codeplex. Basically, it seems that this task gets the Hg revision number by issuing the hg command on the repository the source is coming from.

As I understand where the problem is coming from, I am not able to find a workaround to bypass this problem, probably because I do not have a real understanding of the VS build process yet.

Regards,

Christophe
Hi Christophe,

Thanks for posting. The best solution to this is definitely to disable your custom build step for NCrunch builds.

NCrunch sets a build property that can allow you to do this. You simply need to add a condition onto your custom build step. For example:

<Target Name="BeforeBuild">
<HgVersionFile TemplateFile="Properties\VersionInfo.base.cs"
DestinationFile="Properties\VersionInfo.cs" />
</Target>

... Should be changed to:

<Target Name="BeforeBuild" Condition="$(NCrunch) != '1'">
<HgVersionFile TemplateFile="Properties\VersionInfo.base.cs"
DestinationFile="Properties\VersionInfo.cs" />
</Target>

I'm keen to hear whether this solves your problem.


Cheers,

Remco
Remco,

Your workaround worked perfectly. Thank you for your quick answer, you can consider me as a fan of your porduct.

Regards,

Christophe

Post a reply

Log in to reply.