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

Notification

Icon
Error

The target "_SplitProjectReferencesByFileExistence" does not exist in the project.
DavidPartington
#1 Posted : Thursday, July 15, 2021 11:38:02 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 5
Location: United Kingdom

Thanks: 3 times
Everything working fine yesterday.....

Windows update overnight to OS Build: 19043.1110

Running:
VS 2019 16.10.3
NCrunch 4.9.0.8

22 Projects, mostly .Net 4.7

One Blazor project (.Net 5.0) and this is the one that NCrunch is having issues loading (Load Failure). It builds and runs perfectly in Visual Studio.

The same solution still works on my Laptop OK (NCrunch loads projects), but I have not yet updated that.

I'm looking for ideas of where to look for the problem.

Thanks!



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.()
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.(CallMethodMessage )
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)
Remco
#2 Posted : Thursday, July 15, 2021 1:28:04 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for sharing this issue.

This error is a catch-all thrown up by MSBuild when it can't resolve the base system targets from the project file.

Can you confirm if this project file builds normally using MSBuild via the command line?

... And could you submit an NCrunch bug report after the load failure?
1 user thanked Remco for this useful post.
DavidPartington on 7/15/2021(UTC)
DavidPartington
#3 Posted : Thursday, July 15, 2021 2:22:51 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 5
Location: United Kingdom

Thanks: 3 times
I have submitted the bug report as requested.

I'm not sure how to build this project with msbuild. I followed online info @ Microsoft and got this:

error MSB4041: 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/develop
er/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.


Given that I always build from within the GUI I may need a little coaching on how to do exactly what you need. Note this is a .Net 5.0 project.
Remco
#4 Posted : Friday, July 16, 2021 12:53:25 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Thanks for sending through the bug report. I can't see a clear reason for this error. The project looks fine. I think the Windows update may have broken something in the underlying toolset.

Can you try the following?

1. Find your version of MSBuild.exe that ships with VS (usually something like C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin)
2. Open a command prompt to the directory containing your project
3. Ensure the bin directory is removed to force a full build
4. Run MSBuild.exe over the project, for example: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" myproject.csproj

Does the project build successfully?
1 user thanked Remco for this useful post.
DavidPartington on 7/16/2021(UTC)
DavidPartington
#5 Posted : Friday, July 16, 2021 11:41:18 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 5
Location: United Kingdom

Thanks: 3 times
Well, the good news or bad news is it does not build. Why would it build via the GUI but not via the command line tool?

The errors are all similar to these:

C:\Development\{Path}\{MorePath}\{ProjectPath}\_Imports.razor(8,27): error CS0234: The type or namespace name 'Shared' does not exist in the namespace '{Project}' (are you missing an assembly reference?) [C:\Development\{Path}\{MorePath}\{Project}\{ProjectName}csproj]

C:\Development\{Path}\{MorePath}\{ProjNameHere}\obj\Debug\net5.0\Razor\Pages\Unsubscribe\Unsubscribe.razor.g.cs(115,33): error CS0115: 'Unsubscribe.BuildRenderTree(RenderTreeBuilder)': no suitable method found to override [C:\Development\{Path}\{MorePath}\{ProjectPath}\{ProjectName}.csproj]


HOWEVER, on the laptop where NCrunch is still working - I get the SAME errors running the MSBuild from the command line. < scratch head />




Remco
#6 Posted : Saturday, July 17, 2021 2:00:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
There are some subtle differences in how VS handles the build of projects vs how they are handled by MSBuild. This includes everything from different property values injected into the build to environmental differences in the process doing the work.

NCrunch's build system is more closely aligned with MSBuild than it is with VS. So technically if a project fails to build with MSBuild, it's extremely unlikely that NCrunch will be able to build it.

I note that the errors you're receiving under MSBuild are different to the ones you're getting under NCrunch. I'm hopeful that getting your solution to the point where it can build under MSBuild may well lead to a solution for the NCrunch issue also, but the truth is that there is a lot happening on your system right now that doesn't make sense to me. Given that the issues started appearing after a windows update, it might be worth doing a repair/reinstall of VS to make sure that you don't have a corrupted installation.
DavidPartington
#7 Posted : Monday, July 19, 2021 11:29:25 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 5
Location: United Kingdom

Thanks: 3 times
Thanks.

I did a repair and it made no difference.

Another developer I work with has the same Windows update, same version of Visual Studio, same version of NCrunch and same project, and it loads without any issues.

Not sure where to go from here.

DavidPartington
#8 Posted : Monday, July 19, 2021 12:53:13 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 5
Location: United Kingdom

Thanks: 3 times
Ok - Totally uninstalled Visual Studio & rebooted.

Clean install of Visual Studio and Repair for NCrunch. Still broken.

Uninstalled NCrunch. Rebooted. Reinstalled NCrunch and it's WORKING :)

I really have no idea what was broken, or exactly what fixed it, but uninstalling both VS and NCrunch and re-installing them both has fixed it.

YAY!

Thanks for your help. I wish I could give you better feedback so you'd know what was wrong, but this is all I have.....

Remco
#9 Posted : Monday, July 19, 2021 1:30:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
DavidPartington;15544 wrote:

Uninstalled NCrunch. Rebooted. Reinstalled NCrunch and it's WORKING :)

I really have no idea what was broken, or exactly what fixed it, but uninstalling both VS and NCrunch and re-installing them both has fixed it.


AWESOME!!

DavidPartington;15544 wrote:

Thanks for your help. I wish I could give you better feedback so you'd know what was wrong, but this is all I have.....


No matter. If a reinstall fixed it, likely knowing the details wouldn't help much anyway. The answer would simply be to advise a reinstall. That said though, I've never seen this issue be caused by a faulty install of NCrunch before.


1 user thanked Remco for this useful post.
DavidPartington on 7/19/2021(UTC)
cheil
#10 Posted : Friday, August 13, 2021 3:55:10 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/5/2019(UTC)
Posts: 7
Location: United States of America

Thanks: 4 times
Was thanked: 2 time(s) in 2 post(s)
I ran into this issue as well and encountered another weird issue that might help others.

When the latest VS2022 preview caused this issue for me I decided to uninstall it completely, and continue using VS2019. However, this ALSO broke NCrunch on VS2019. I rolled back .NET 6 preview 7 to .NET 5 as well, and that continued the issues I was facing

With .NET 6 Preview uninstalled, I ran the `dotnet --version` command and got this response

> Found .NET SDK, but did not find dotnet.dll at [C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\dotnet.dll]

Since I wanted 6 gone, I deleted the 6.0 folder, restarted NCrunch, and it immediately resolved my issue. I am guessing the `dotnet` command will look for the highest version number folder, and the uninstaller must have left the folder behind, resulting in everything breaking.
1 user thanked cheil for this useful post.
michaelkroes on 8/13/2021(UTC)
Remco
#11 Posted : Saturday, August 14, 2021 12:07:32 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
cheil;15601 wrote:

Since I wanted 6 gone, I deleted the 6.0 folder, restarted NCrunch, and it immediately resolved my issue. I am guessing the `dotnet` command will look for the highest version number folder, and the uninstaller must have left the folder behind, resulting in everything breaking.


We've had this happen to us in our dev environments here before too. My suspicion is that the uninstaller can leave files behind if they are in use by background processes. There are a number of areas of the toolset where the chosen version of .NET is determined by which directories exist (regardless of whether they happen to be empty).

Good find :)
bhugot
#12 Posted : Wednesday, August 18, 2021 4:56:22 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/19/2018(UTC)
Posts: 9
Location: France

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
This could also be fix with DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR & DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER
1 user thanked bhugot for this useful post.
firstdowns on 2/27/2024(UTC)
kpbarrow
#13 Posted : Friday, October 29, 2021 10:51:57 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/29/2021(UTC)
Posts: 1
Location: United Kingdom

Was thanked: 1 time(s) in 1 post(s)
I have been getting this error message for a while. I had installed the dotnet6 RC but added local global.json files to the project so they continue to build with dotnet 5 to keep local consistent with the build servers:

Code:

{
  "sdk": { "version": "5.0.302" }
}


I removed dotnet6 as I was only playing with some features - but left the global.json files. Removing the global.sjon files solved the problem

Hopefully this will help someone else - lost hours on this
1 user thanked kpbarrow for this useful post.
Remco on 10/29/2021(UTC)
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.098 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download