Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

3 Pages123>
NCrunch cannot build .NET Standard 2.0 projects
Marcello
#1 Posted : Tuesday, November 16, 2021 3:30:01 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello Support,

When I reference a .NET Standard 2.0 project, NCrunch gives 2 different build errors it in 2 different machines:

Machine 1.
Code:
[PID:4076 16:17:40.3629 NodeProcessor-534] ERROR (Internal): System.NullReferenceException: Object reference not set to an instance of an object.
   at nCrunch.Compiler.DotNetCoreSdkDirectory.GetInstalledSdkDirectories()
   at nCrunch.Core.BuildManagement.GridNodeDotNetCoreSdkVersionSelector.OverrideDotNetCoreSdkForProcess(DotNetCoreSdkVersion dotNetCoreSdkVersion, ProcessLoadParameters parameters, VisualStudioVersion vsVersion)
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.(EffectiveProcessorArchitecture , BuildSystemParameters , IList`1 , FilePath , DotNetCoreSdkVersion )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress , DotNetCoreSdkVersion  )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.BuildComponentInExternalProcess(ComponentBuildParameters buildParameters, VisualStudioVersion vsVersion, GridClientId client, IList`1 customEnvironmentVariables, Guid taskId, GridAddress clientAddress)
   at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridAddress clientAddress, Boolean extractCoverageReportStructure)
   at nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
   at nCrunch.Core.Processing.TaskLogic.ProcessTaskAndReturnSuccessFlag()
   at nCrunch.GridNode.NodeTaskProcessor..()
   at nCrunch.Common.ErrorHandler.DoWithErrorHandling(Action action, Object context)



Machine 2.
Code:
[PID:9268 16:17:41.0082 ?-14] The target "Build" does not exist in the project.
[PID:9408 16:17:41.0082 NodeProcessor-27] ERROR (Build): ProtobufNet: C:\NCrunch Grid Node\9408\567\ProtobufNet\ProtobufNet.csproj (0): The target "Build" does not exist in the project.


You can download the sample project here.
I'm using NCrunch v4.11.0.2

For Machine 1, maybe I need to install something like .net core SDK?
For Machine 2, maybe something is missing in the project file?
Remco
#2 Posted : Tuesday, November 16, 2021 11:38:15 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi, thanks for posting.

On machine 1, it looks like the Dotnet SDK is not correctly installed. Usually this is installed to 'C:\Program Files\dotnet', and there must be a reference to it in your system's PATH environment variable. Alternatively, you can set the DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR environment variable to put to its installation path.

On machine 2, it looks like the build system isn't installed. Do you have VS or the appropriate build tools installed on this machine?
Marcello
#3 Posted : Wednesday, November 17, 2021 8:00:57 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco, thanks for the quick reply.

Machine 1. Yes, it's so.

Machine 2. Seems so. There are both Visual Studio Build Tools 2017 and Visual Studio Build Tools 2019. Could you try with the sample project I linked in my previous post, please?
Remco
#4 Posted : Wednesday, November 17, 2021 8:40:47 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi,

I've tested your sample project and it compiles fine under NCrunch in all our test environments under both VS2019 and VS2022.

Based on the stack trace you've provided, this issue is being caused by a configuration or platform installation issue in your environment.

Can you confirm for me the location of dotnet.exe on your machine?

Can you confirm for me which versions of the Dotnet SDK you have installed? These need to be installed under 'sdk' directory adjacent to dotnet.exe.

Can you set the environment variable 'DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR' to point to the directory containing dotnet.exe, for example:
DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR = C:\Program Files\dotnet
Please make sure this environment variable is set at system level. If the IDE is open when you set it, you will need to restart the IDE.
Marcello
#5 Posted : Wednesday, November 17, 2021 10:37:58 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi,

Yes, I can confirm all you asked, as shown in this image.
Remco
#6 Posted : Wednesday, November 17, 2021 11:50:20 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Thanks. Can you confirm whether the DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR environment variable on the grid node has any effect on the issue? Note that you'll need to restart the grid node service before any environment variable changes take effect.
Marcello
#7 Posted : Wednesday, November 17, 2021 12:08:43 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Yes, I can confirm.

Please have a look at this short video that shows my attempt.
Remco
#8 Posted : Wednesday, November 17, 2021 12:16:14 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Thanks for the video. This confirms that the first problem (locating the installation of Dotnet) on the machine appears to be resolved. I'm going to conduct some experiments on this side to try and identify why the build tools aren't being correctly resolved. At the moment I'm wondering if this might be related to the versions of Dotnet involved (we generally work with newer versions). I'll get back to you when I have more questions or information. Thanks for your patience.
Remco
#9 Posted : Wednesday, November 17, 2021 12:47:12 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
You've mentioned that you have the MSBuild tools for VS2017 and VS2019 installed on the grid node. Can you confirm for me the version of Visual Studio being used on the client machine?
Marcello
#10 Posted : Wednesday, November 17, 2021 12:53:10 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
VStudio Build Tools 2017 --> v15.9.27
VStudio Build Tools 2019 --> v16.7.5
Remco
#11 Posted : Wednesday, November 17, 2021 1:18:07 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Marcello;15806 wrote:
VStudio Build Tools 2017 --> v15.9.27
VStudio Build Tools 2019 --> v16.7.5


Can you please confirm the version of Visual Studio you have installed on the client machine that you are using to access the grid node?
Marcello
#12 Posted : Wednesday, November 17, 2021 1:23:55 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
I tried both with
Microsoft Visual Studio Professional 2019 - Version 16.11.7
and
Microsoft Visual Studio Professional 2022 (64-bit) - Version 17.1.0 Preview 1.1

Remco
#13 Posted : Wednesday, November 17, 2021 1:29:55 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Thanks - Just to be sure, can you confirm that you are receiving the exact same missing build target error on the grid node when you use both VS2019 and VS2022 on the client?
Marcello
#14 Posted : Wednesday, November 17, 2021 1:33:39 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Yes, I just re-checked and the message is the same

VStudio 2019 --> [PID:8104 14:22:15.8682 ?-14] The target "Build" does not exist in the project.
VStudio 2022 --> [PID:10092 14:21:16.1332 ?-9] The target "Build" does not exist in the project.
1 user thanked Marcello for this useful post.
Remco on 11/17/2021(UTC)
Remco
#15 Posted : Wednesday, November 17, 2021 11:52:19 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Could you please do the following for me?

1. Open the sample project you sent to me in VS2019 on your client machine
2. Set your 'Log Verbosity' to 'Detailed' in your NCrunch configuration
3. Set your 'Build Log Verbosity' to 'Detailed' in your NCrunch configuration
4. Reset the engine and let it run, so that it will connect to the faulty grid node and try to execute the build task on that node
5. Open the Processing Queue window and find the build task responsible for execution on the grid node
6. Click on the build task and examine the log in the pane below. Copy/paste the log from there into this forum

I'm hopeful that the error handling is working well enough that we'll be able to retrieve the log in this way despite the target issue. If the log isn't available in the processing queue, we might instead need to extract it from the grid node itself (a more painful process).
Marcello
#16 Posted : Thursday, November 18, 2021 7:55:52 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
The log text is too much longer, so you can download it here.
Remco
#17 Posted : Thursday, November 18, 2021 9:15:29 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
This is perfect, thanks! I'll get back to you soon.
Remco
#18 Posted : Thursday, November 18, 2021 12:39:31 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Do you know if this use case worked for you before the latest NCrunch version? (I'm trying to identify if this is a long standing issue or a recent regression).
Marcello
#19 Posted : Thursday, November 18, 2021 12:59:01 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Unfortunately, no, sorry.
Remco
#20 Posted : Friday, November 19, 2021 1:39:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Can you try downloading and installing the following version of the .NET SDK on the grid node, then restart the machine and let me know if this changes anything?

https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-6.0.0-windows-x64-installer
Users browsing this topic
Guest (2)
3 Pages123>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.082 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download