Having some issues getting my .NET Core projects to build. I get the following error after enabling NCrunch:
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:
Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
at nCrunch.Compiler.RemoteBuildRunner.(FilePath , , String , String , DirectoryPath , String )
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture buildProcessProcessorArchitecture, DirectoryPath workspaceBasePath)
--- 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.[T](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(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture buildProcessProcessorArchitecture, DirectoryPath workspaceBasePath)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture processorArchitecture, VisualStudioVersion vsVersion, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(ProcessorArchitecture )
at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(FilePath projectFilePath, BuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion)
They're using csproj, not project.json, and I'm targeting netstandard1.4. What am I missing here?
Just read the support notes about the priority of this for 3.3. That's no problem. If this is something I can fix on my end, or I can provide information to help debug, let me know. Otherwise, I'll go back to waiting patiently.
As you've discovered, .NET Core build support is still a work in progress. Though I'd really like to know more about this problem to make sure it's properly handled in the next release. Is there any chance you could share with me the non-source components of your .csproj and project.json files? I'd like to be able to recreate this so I can investigate further.
Sure, just put them through the contact form at https://www.ncrunch.net/support/contact. I only need the structural parts of these files to figure out how to produce the problem. Any domain related elements you a very welcome to remove if you are concerned about IP.
I think we're getting somewhere. I'm getting an error on a few projects, but it seems to be related to this issue: https://github.com/dotnet/sdk/pull/478
I'm going to update the projects with problems with deep references and see if I can get them to build. I'll let you know how it turns out.
Less sure about that now. I've taken the two simplest projects in the solution. The first one has no other project dependencies and built fine in NCrunch out of the box. The other threw the error I'm seeing. I duplicated all nuget references directly into the other project so that there's no way it's using any transitive project references that I can see. Same error, even after unloading/reloading, etc.
I'm going to keep playing with it, but it may still be a genuine issue.
Here's the error:
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
..\..\..\..\..\..\Users\jbarket\.nuget\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Sdk.targets (77, 5): The "GenerateDepsFile" task failed unexpectedly.
System.Exception: Could not find valid a SingleProjectInfo for project 'C:\Users\jbarket\AppData\Local\NCrunch\7216\2\Development\redacted\Shared.Data\Shared.Data.csproj'
at Microsoft.NET.Build.Tasks.DependencyContextBuilder.GetProjectInfo(LockFileLibrary library)
at Microsoft.NET.Build.Tasks.DependencyContextBuilder.GetLibrary(LockFileTargetLibrary export, LockFileLookup libraryLookup, IDictionary`2 dependencyLookup, Boolean runtime)
at Microsoft.NET.Build.Tasks.DependencyContextBuilder.<>c__DisplayClass19_0.<GetLibraries>b__0(LockFileTargetLibrary export)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.<CastIterator>d__94`1.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__58`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Extensions.DependencyModel.DependencyContext..ctor(TargetInfo target, CompilationOptions compilationOptions, IEnumerable`1 compileLibraries, IEnumerable`1 runtimeLibraries, IEnumerable`1 runtimeGraph)