Build/Test Issues

Projects using NuGet v3 do not build in NCrunch, error about global.json

Started by jnm236 on 6,646 views

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:
{
    "frameworks": {        
        "net452": { }
    },
    "runtimes": {
        "win": { }
    }
}



NCrunch window:


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)

Edited

Hi,

Thanks for sharing this issue.

During the first round of integration with DNX early last year, NCrunch was rigged to detect DNX projects through the presence of the project.json file. At the time, this was a safe assumption as DNX projects were the only ones making use of this system.

Much has changed since then. Now the presence of this file causes NCrunch to falsely assume that certain projects are DNX projects when actually they aren't.

I am not aware of any workaround for this problem other than avoiding the use of tools that require project.json. This will need to be addressed with an urgent fix to NCrunch. Thanks for making me aware of it.
Would you like to try the build below? This build has all DNX integration disabled:

http://downloads.ncrunch.net/NCrunch_Console_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_Console_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_GridNodeServer_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_GridNodeServer_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_LicenseServer_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_VS2008_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_VS2010_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_VS2010_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_VS2012_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_VS2012_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_VS2013_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_VS2013_2.20.0.3.zip
http://downloads.ncrunch.net/NCrunch_VS2015_2.20.0.3.msi
http://downloads.ncrunch.net/NCrunch_VS2015_2.20.0.3.zip
Installed NCrunch_VS2015_2.20.0.3.msi, everything works as expected. Thanks for the amazing turnaround time!
Good to know!

Post a reply

Log in to reply.