Build/Test Issues

Cannot get Grid Node Server with VS 2019 Tools to build .NET Sdk Project

Started by jaymclain on 2,457 views

Hi, I've been attempting to get a grid node server setup with VS 2019 tools to build a .NET Sdk project.

Everything seems to build and run locally fine, but when I enable the grid node in the "NCrunch Distributed Processing" panel, the build fails on the node server (see error below).

I created a sample project which demonstrates the issue I've encountered. It's a very simple project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
  </PropertyGroup>

</Project>



With one file (Class1.cs):

namespace Infrastructure
{
    public class Class1
    {
    }
}


I receive the following output attempting to build the assembly:

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
NCrunch: The build results for this project are not consistent across all computers within the grid.

This project was successfully built on computers: (local)
This project failed to build on computers: CAB3F10EDEC5

Associated tests will continue to run on computers that are able to build this project successfully.  Please ensure all computers within the grid are configured correctly with all required SDKs installed.

****************** BUILD OUTPUT FROM 'CAB3F10EDEC5' ******************

NCrunch was unable to parse this project file because of an unexpected error: Microsoft.Build.Exceptions.InvalidProjectFileException: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectParser.Parse()
   at Microsoft.Build.Construction.ProjectParser.Parse(XmlDocumentWithLocation document, ProjectRootElement projectRootElement)
   at Microsoft.Build.Evaluation.Project..ctor(XmlReader xmlReader, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at nCrunch.VSIntegration2010.MSBuildIntegration.BuildableProject2010.Initialise(BuildXml buildXml, FilePath projectFilePath, IDictionary`2 globalProperties)
   at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters , BuildOutput )
   at nCrunch.Compiler.RemoteBuildRunner..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters )



I have validated the tools are installed to "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
and the .Net Sdk is installed to "C:\Program Files\dotnet\sdk"

And, I have attempted the suggestions in other articles I found in the forums, including:

1. Setting the environment variable:
NCrunchVSInstallPath.VS2019="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"

2. Setting the environment variable:
VSINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"

Any help would be appreciated.

Sorry for the quick reply...but, I forgot to note that I have tried Grid Node Server 3.28 (downloaded from the website), and 3.29.0.3 which was referenced in another support issue to fix a project file parsing issue -- I receive the same error result from both versions.

- Jay
Hi thanks for posting.

I'm investigating this. I'll let you know what I find.
I've tried to reproduce this issue. I've setup a clean VM with just the VS2019 build tools and the latest grid node server and create a multitargetted project like you have. I couldn't get this to fail.

This leads me to believe that we are having some issues finding the version of VS.

Could you confirm that the version of VS you are using is VS2019?

Could you try and stop the gridnode service via services.msc and start the gridnode executable manually via the desktop and try again?
Weird, ya, it seemed to work just fine when running the console app...

This is what I did from a powershell:

stop-service NCrunchGridNode
get-service NCrunchGridNode
cd "C:\Program Files (x86)\Remco Software\NCrunch Grid Node Server"
.\NCrunch.GridNode.Console.exe

Then, restarted NCrunch engine in my solution.

That worked...so, then I killed that process and:

start-service NCrunchGridNode

Then, restarted NCrunch engine in my soluation.

That failed with the error I initially reported...

"NCrunch was unable to parse this project file because of an unexpected error: Microsoft.Build.Exceptions.InvalidProjectFileException"
I think I figured it out! Thanks for your tip on running the GridNode.Console. That pointed me towards the environment config -- which, it tuns out was correct for the local user, but not configured for the system-wide environment.

So, running:

SETX /M NCrunchVSInstallPath.VS2019 "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\"

allowed the service to correctly find the 2019 build tools.

I also set VSINSTALLDIR the same way -- but not sure that really helped anything...

Looks like I am up and running now.

-Jay

Post a reply

Log in to reply.