Daily Usage Issues

VS 2022 "The msbuild command returned exit code 1" error

Started by MrClyfar on 4,842 views

Hello.

I am uising the following:

NCrunch version 4.10.0.6

Microsoft Visual Studio Enterprise 2022 RC
Version 17.0.0 RC
VisualStudio.17.Release/17.0.0+31808.319.rc
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise


Whilst NCrunch is building the various projects in the solution, I get the following error for two of the unit test projects...

NCrunch was unable to resolve dependency data for its own assemblies under your chosen framework. It is possible that the version of NCrunch you are using does not have support for this framework, or otherwise there may be another problem present on your system. NCrunch will fall back to using pre-packaged dependency data which may or may not be compatible with your chosen framework. This may result in dependency resolution problems inside your test environments.

Details for this problem are below:

The msbuild command returned exit code 1: "c:\program files\microsoft visual studio\2022\enterprise\MSBuild\Current\Bin\msbuild.exe" /t:Restore nCrunch.Module.XUnit2.DotNetCore.csproj


I'm not certain what to do here. I checked whether the Live Unit Tests feature in VS is working, and that did indeed process all the tests without issue.

Is there some means of resolving this issue please?

Thanks.

EDIT:

I've just noticed that NCrunch does execute the tests, at first I thought it did not. But the above warning is still being outputted - not sure if it's a big issue.

Edited

Hi, thanks for sharing this issue.

For NCrunch to be able to execute tests on your system, its own code has dependencies on certain Nuget packages.

Because we don't include these packages in the installer, they need to be restored using an MSBuild step when NCrunch goes to set up its environment. To do this, we basically build a small .csproj file with references to the packages, then run a restore command. The restore step pulls down the packages and all is well.

Unfortunately, the command isn't 100% reliable. Sometimes it fails, probably due to differences in the environment. When this happens, you'll get a warning like this one, which usually will also show the names of the missing packages and their versions.

If your tests are running without problems, there's nothing you need to do here. Most likely you already have later versions of the same packages already installed and NCrunch is able to do fine with those.

Post a reply

Log in to reply.