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

Notification

Icon
Error

Build error that misses Microsoft.Managed.Core.targets when SDK is not specified
gasparnagy
#1 Posted : Friday, April 4, 2025 1:06:51 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/24/2023(UTC)
Posts: 4
Location: Hungary

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!
Remco
#2 Posted : Friday, April 4, 2025 11:38:39 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 979 times
Was thanked: 1316 time(s) in 1221 post(s)
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.
Users browsing this topic
Guest
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download