Search code examples
asp.net-corecruisecontrol.netdnx.net-core

How to set up dnx builds on CCNet? dnu runs but fails with "dnx not found"


I'm trying to set up some ASPNetv5 builds on CCNet. I added an exec block like this:

<cb:define name="DnuPackageRestore">
    <exec>
        <executable>dnu</executable>
        <cb:ifdef name="SourceFolder">
            <baseDirectory>$(SourceFolder)</baseDirectory>
        </cb:ifdef>
        <cb:else>
            <baseDirectory>$(WorkingPath)\$(ProjectName)</baseDirectory>
        </cb:else>
        <description>DNU Package Restore</description>
        <buildArgs>restore</buildArgs>
    </exec>
</cb:define>

For some strange reason, CCNet fails for .cmd files in PATH, so I changed executable from dnu to dnu.cmd. It now runs dnu fine but that immediately crashes saying it can't find dnx:

2016-03-02 14:17:19,073 [SuperThing:DEBUG] Starting process [dnu.cmd] in working directory [D:\CI\W\SuperThing] with arguments [restore]
2016-03-02 14:17:19,076 [SuperThing:DEBUG] Not setting PriorityClass on [D:\CI\W\SuperThing\dnu.cmd] to default Normal
2016-03-02 14:17:19,091 [13:DEBUG] [SuperThing dnu.cmd] '"D:\CI\W\SuperThing\dnx"' is not recognized as an internal or external command,
2016-03-02 14:17:19,091 [13:DEBUG] [SuperThing dnu.cmd] operable program or batch file.

It claims to be looking in SuperThing for dnx, but since it says the same for dnu.cmd I think that's a red herring.

If I PowerShell remote into the server as the same user, everything works fine (I installed dnvm, let it install 1.0.0-rc1-update1 and I ran dnvm set default -p).

There's seemingly something wonky with how CCNet is executing this dnu.cmd that's causing it to fail (my guess is a PATH is getting lost somewhere?).


Solution

  • In general, you can't execute ".cmd" files using standard Process.Start (not sure if CCNet does that). Instead, you need to exec cmd with arguments /c [path to cmd file]. Perhaps try that and see if it resolves the issue?