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

Notification

Icon
Error

The target "_SplitProjectReferencesByFileExistence" does not exist in the project.
LatinProgrammer
#1 Posted : Friday, November 21, 2025 9:07:44 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/26/2019(UTC)
Posts: 9

Was thanked: 1 time(s) in 1 post(s)
Hello,

We have a solution that is multi-targeted for different frameworks. NCrunch used to work with it and we switched to Visual Studio Live Testing. I switched back and the solution is failing on NCrunch with this error
Quote:
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
The target "_SplitProjectReferencesByFileExistence" does not exist in the project.
at nCrunch.Compiler.ComponentAnalysisContext.queryValuesFromMSBuild()
at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.processCallMethodMessage(CallMethodMessage callMethodMessage)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.readMessage(Byte[] returnedData)
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.Invoke(String methodName, Object[] args)
at nCrunch.Compiler.RemoteBuildRunnerProxy.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.<>c__DisplayClass4_0.<AnalyseComponentBuildInExternalProcess>b__0(IRemoteBuildRunner remoteBuildRunner)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.executeTaskUsingExternalProcess(Action`1 task, EffectiveProcessorArchitecture processorArchitecture, GridClientId client, BuildSystemParameters buildSystemParameters, IList`1 customEnvironmentVariables, Nullable`1 taskId, GridClientDescription clientDescription, DotNetCoreSdkVersion dotNetCoreSdkVersion)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.analyseComponentBuild(EffectiveProcessorArchitecture buildProcessorArchitecture, String targetFrameworkForMSBuild)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, IDEVersion ideVersion, BuildEngineId buildEngineId, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)


I reproduced the issue on a sample solution:
https://drive.google.com...Y-ZZwh/view?usp=sharing

You may need to open it twice. However, after doing so, Visual Studio builds and runs tests correctly. We also have multiple pipelines and msbuilds on our devops and we are able to correctly build the solution in the framework we choose.

The core issue seems to be that NCrunch doesn't work correctly with our "targets" file. We use it because we don't want to copy-and-paste common settings between projects. I also included Expand-CommonTargets.ps1 which replaces
Quote:
<ImportGroup>
<Import Project="..\MultiTargetFile.targets" />
</ImportGroup>


With the actual contents of the file. After doing so, NCrunch works correctly.

However, the actual solution has many projects so this workaround is not ideal, and it would not be something that I would consider more of our devs doing. I tried a lot of workarounds and settings posted in the documentation and couldn't find something that works. I'm hoping this is something that you can fix in your end. Any help is appreciated.

-LP

Remco
#2 Posted : Saturday, November 22, 2025 12:10:25 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 1008 times
Was thanked: 1353 time(s) in 1256 post(s)
Hi, thanks for sharing this issue along with the sample project (it's so much easier with a code sample to help understand what's happening).

For NCrunch to load a project, there is a critical property that must be present in the project, "TargetFrameworks".

This is because we need to know the target frameworks in advance of loading the project with MSBuild, so they need to be parsed out of the project file, which happens before any MSBuild evaluation or import logic can fire.

You can work around this though, without needing to change the the project file. In your NCrunch configuration for the project, go to 'Custom build properties' and set TargetFrameworks = net48;net8.0-windows

In this way, the loader will know what the frameworks are and won't need to parse them out of the file. NCrunch should then be able to load your projects as normal.
LatinProgrammer
#3 Posted : Monday, November 24, 2025 2:19:39 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/26/2019(UTC)
Posts: 9

Was thanked: 1 time(s) in 1 post(s)
Thank you for the response. I added that custom build property and I was able to resolve the issue!
1 user thanked LatinProgrammer for this useful post.
Remco on 11/24/2025(UTC)
Users browsing this topic
Guest (3)
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.032 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download