Build/Test Issues

ASP.NET Core 2 App tries to build *.ts files despite being excluded in config

Started by MikeWard on 5,802 views

Getting acquainted with ASP.NET core. Added a single test but the main project won't build in NCrunch.


NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
app\js\app.ts (8, 20): Build:Cannot find module 'mithril'.
app\js\components\page\nav-bar.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\components\page\nav-bar.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\components\page\page-footer.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\components\page\page-footer.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\components\page\page-header.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\components\page\page-header.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\components\status\loading.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\components\status\loading.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\components\widgets\grid.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\components\widgets\grid.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\pages\about.test.ts (6, 1): Build:Cannot find name 'test'.
app\js\pages\about.ts (1, 20): Build:Cannot find module 'mithril'.
app\js\pages\about.ts (16, 11): Build:Parameter 'rs' implicitly has an 'any' type.
app\js\pages\about.ts (17, 12): Build:Parameter 'rj' implicitly has an 'any' type.
app\js\pages\home.test.ts (6, 1): Build:Cannot find name 'test'.
etc....


I've excluded *.ts files in the NCrunch config but it still seems to want to build them.

The project is at https://github.com/mike-ward/SampleCore

Clone it, install Parcel (npm install -g parcel-bundler) and then run

build.cmd


in the root to get things set up. Then open in VS2017 and enable NCrunch.

Edited

Hi, thanks for sharing this problem.

Most likely, this project is set up so that the typescript files are always compiled during a normal build. So the problem here is likely to be not that NCrunch is building them, but rather that it's failing to do so. It looks like there are dependencies that aren't being included in the NCrunch workspace. Do you have any other typescript libraries that perhaps need to be included using the 'Additional files to include' configuration setting? NCrunch should resolve most dependencies automatically, but presently there are no auto resolution features for typescript dependencies.
This will block TypeScript from Compiling when running under NCrunch. Add this to the .csproj File.


<PropertyGroup Condition="$(NCrunch) == '1'">
    <TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
</PropertyGroup>

Edited

The PropertyGroup settings fixed the typescript issues.

Now I'm seeing unresolved in NewtonSoft.Jason


NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
..\..\..\..\..\..\Program Files\dotnet\sdk\2.1.100\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets (155, 5): The "GenerateRuntimeConfigurationFiles" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.GenerateCreateSetPropertyIL(PropertyInfo propertyInfo, ILGenerator generator)
...
Are you running the latest build of NCrunch? This looks like the problem introduced by VS2017.6 that we fixed in v3.13.
That was it. I was running second latest version. Usually, I get a pop up in VS telling me there's a new version available. Anyways, NCrunch is working again. My world is restored to its nominal order :) Thanks...

Post a reply

Log in to reply.