I have a solution that I would like to enable NCrunch for.
The solution contains netstandard2.0 library projects and net8.0 test projects. Building & working locally.
Out of the 10, 3 projects (two tests and one lib) fails to load by NCrunch (every config setting at default) with a build error:
c:\program files\microsoft visual studio\2022\community\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets: Could not find a part of the path
When I set the "Build SDK" of these projects to "8.0.407" then the NCrunch build succeeds.
So the problem is "solved" by setting the SDK, but I would like to understand it more what the problem was. The funny thing is that the referred file "c:\program files\microsoft visual studio\2022\community\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets" does exist... Also I don't see why this three projects are the problematic ones (there are other similar test and lib projects that are building fine).
Do you have any hints? Thx!
Build/Test Issues
Build error that misses Microsoft.Managed.Core.targets when SDK is not specified
Started by gasparnagy on 1,216 views
Remco NCrunch Developer
#18024
04 Apr 2025 23:38 UTC
Hi Gaspar, thanks for posting.
Normally, NCrunch allows MSBuild to select the SDK version that it finds most appropriate for the project being loaded. Typically, this will be the latest installed version. Changing 'Build SDK' tells NCrunch to override this behaviour.
I've seen this go wrong with Preview versions of Visual Studio, beacuse MSBuild has an internal check which does a memory test against the software calling it to see if it's a preview version of VS. If it is, the SDK resolution works differently in a way that NCrunch can't always reliably detect. Are you running a preview version of VS?
I can't speak to the error message itself, but SDK version incompatibility issues can cause some of the weirdest errors I've ever seen. I guess this makes sense, since the nature of the issue comes from library versions calling other libraries that they were never designed to work with.
If you aren't running a preview VS, could you confirm whether a command-line MSBuild call allows you to build this project? If it doesn't, then this is a toolset installation issue or platform bug.
Normally, NCrunch allows MSBuild to select the SDK version that it finds most appropriate for the project being loaded. Typically, this will be the latest installed version. Changing 'Build SDK' tells NCrunch to override this behaviour.
I've seen this go wrong with Preview versions of Visual Studio, beacuse MSBuild has an internal check which does a memory test against the software calling it to see if it's a preview version of VS. If it is, the SDK resolution works differently in a way that NCrunch can't always reliably detect. Are you running a preview version of VS?
I can't speak to the error message itself, but SDK version incompatibility issues can cause some of the weirdest errors I've ever seen. I guess this makes sense, since the nature of the issue comes from library versions calling other libraries that they were never designed to work with.
If you aren't running a preview VS, could you confirm whether a command-line MSBuild call allows you to build this project? If it doesn't, then this is a toolset installation issue or platform bug.
Post a reply
Log in to reply.