Search code examples
.netvisual-studioblazor-webassemblyncrunch

Why am I getting The "ComputeBlazorBuildAssets" task was not given a value for the required parameter "DotNetJsVersion" when using NCrunch?


NCrunch is not able to compile these two projects: enter image description here

Because of the same error: enter image description here

Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets: enter image description here

Visual Studio compiles with no errors. Thank you.

.net version: 7.0.400 visual studio version: 17.7.2

I tried downloading the file from internet, but same results. I tried restarting NCrunch, rebuilding solution, etc..


Solution

  • This question was answered in the NCrunch forum, where official support is given.

    The answer from Remco was:

    Try adding SelfContained=True for this project under your NCrunch 'Custom build properties' setting

    This worked for me, as well as for the person who asked the original question.

    Here's a screenshot of where this setting is located: enter image description here

    The full answer, which includes an explanation:

    The problem is caused by a recent change in VS that causes Blazor WASM project builds to break whenever they are built with SelfContained=false. From what I understand, this type of project isn't something that MS want to support without it being run with a self contained publishing mode.

    Under NCrunch, we force SelfContained=false because otherwise the build system slips an undeclared framework reference in that points to a platform target specific to this type of project. This causes problems with our ability to synchronise with grid nodes, as we need to know which packages are required by a project up-front before we try to build them on nodes.

    Could you please try adding SelfContained=True for this project under your NCrunch 'Custom build properties' setting?

    I hope that this will suppress the issue. If you're using distributed processing with this project, you'll need to perform a manual package restore on the remote nodes to make sure the required runtime pack is installed (the error will tip you off on this). If you're only running NCrunch locally, this shouldn't be an issue for you.

    I'm submitting a fix to NCrunch to force SelfContained=true for Blazor WASM projects in future released builds.