Daily Usage Issues

How to diagnose why ncrunch build takes so long?

Started by thomasmaisel on 2,239 views

Hi.

My problem is, that a particular project takes 3 Minutes to Build in NCrunch, while it takes only a few seconds to build in VS2019.

It's an ASP.NET Core project with Angular client app, so there are two things that might be an issue:
- It might build the client files which might take so long (it shouldn't build them, since this build is only enabled in Release Mode)
- It might have trouble with thousands of node_modules which are in the project files (I also tried to exclude *.js / *.ts with no effect)

Is there any way to get a NCrunch Build output to diagnose why it takes so long?

Edited

Hi,

Yes, you can get a more detailed look at the build, and you definitely should.

Set your Log Verbosity configuration setting to 'Detailed' then let the NCrunch build run and examine the log in the Processing Queue Window. Probably, there is a step somewhere that is eating a lot of time, and probably it won't be needed and could be downsized or deactivated.
Thank you for the hint. Increasing the log verbosity in the general configuration helped me identifying the problem.

The solution:

The .csproj file had a section which ensured that node packages are installed.

Executing "npm install" manually finishes in 10 seconds, but in NCrunch it takes 2,5 minutes.

I added
And !('$(NCRUNCH)' == '1')
to the following section's Condition and NCrunch works fine as usual ;-)

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
    <!-- Ensure Node.js is installed -->
    <Exec Command="node --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
    <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
  </Target>
Good find and nicely fixed :)

Post a reply

Log in to reply.