Because NuGet packages are coming out that make the old NuGet v2 (packages.config) much less desirable to use than the NuGet v3 (project.json) system, we migrated our projects. (See
Project.json all the things by Oren Novotny.)
Project.json has been supported in Visual Studio 2015 Update 1 for .NET Framework 4.x since the end of November last year, and we have been delighted to find out that NuGet v3 resolves a host of issues we had had to work around with v2.
However, NCrunch seems to be making an incorrect assumption about projects that have a project.json. It refuses to build them, saying it can't find global.json. This should not be an issue; they are legal projects, supported in Visual Studio and TFS build, and build fine.
We are targeting 4.5.2, not .NET Core, and these are Windows Forms and WPF applications, not ASP.NET applications. Rather than complaining that global.json does not exist, NCrunch should realize these are
not DNX projects and simply run these projects as it has always run them.
How soon can this be fixed so that we can use NCrunch, and is there a workaround for the time being?As a workaround I tried adding a global.json file; the next error was a NullReferenceException on nCrunch.Compiler.DnxIntegration.GlobalJson.get_RuntimeVersion().
I added { "sdk": { "version": "1.0.0-rc1-update1" } } and the next error is "Unable to find the DNX runtime library expected at 'C:\Users\jmusser\AppData\Local\NCrunch\10220\dnx_x86.1.0.0-rc1-update1\bin\Microsoft.Framework.Runtime.dll'. Your DNX runtime installation is either corrupt or is not supported by this version of NCrunch." Fresh install, definitely not corrupt.
I'm pretty sure winforms and WPF will not run on DNX anyway, so this seems to be a dead end.
project.json:
Code:
{
"frameworks": {
"net452": { }
},
"runtimes": {
"win": { }
}
}
NCrunch window:
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: Unable to resolve the global.json file from 'C:\Users\jmusser\Source\Workspaces\HeritagePMS\Heritage'. This file is required to be in a parent directory of the project being built.
at nCrunch.Compiler.DnxIntegration.GlobalJson.(DirectoryPath )
at nCrunch.Compiler.DnxIntegration.GlobalJson..ctor(DirectoryPath projectJsonDirectory)
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 , ProcessorArchitecture , GridClientId , IBuildableProject , 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, ISnapshotConfig snapshotConfig, VisualStudioVersion vsVersion)