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

Notification

Icon
Error

NCrunchConsole alternative for global.json?
GreenMoose
#1 Posted : Tuesday, September 17, 2019 12:06:36 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 457

Thanks: 124 times
Was thanked: 57 time(s) in 55 post(s)
[v3.30.0.1]

Wen building awith dotnet.exe I can have a global.json with content below, and I can easily see in TeamCity output SDK is used, e.g.
global.json:
Quote:

{
"sdk": {
"version": "2.1.801"
}
}

Output:
Quote:

.NET Core SDK v2.1.801 dotnet.exe build APIs\Utils\Utils.sln --configuration Release --no-restore -warnAsError @D:\TeamCity\buildAgent\temp\agentTmp\2.rsp


But how can I decide this with NCrunch, i.e. does it also use global.json somehow but not including it output?

Thanks.
Remco
#2 Posted : Tuesday, September 17, 2019 11:26:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,788

Thanks: 748 times
Was thanked: 961 time(s) in 916 post(s)
Hi, thanks for posting.

In theory, NCrunch should be using the MSBuild abstractions that allow the global.json to be effective for the projects NCrunch has loaded. I believe we have some code in there to fish out this file and copy it to the workspace too.

Are you receiving an error of some kind? Is NCrunch using the correct SDK version?
GreenMoose
#3 Posted : Wednesday, September 18, 2019 6:52:05 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 457

Thanks: 124 times
Was thanked: 57 time(s) in 55 post(s)
I initially had issues with MethodNodFoundException in NCrunch which is why I originally wrote the post (with dotnet test it was "could not find dll"), but that was due to use of different versions of a nuget package but led me to wonder if global.json was used.

Anyhow, I did a quick test and NCrunch does indeed copy the global.json to workspace folders.

However, if using a SDK version in it that does not exist NCrunch throws a pretty cryptic exception, but at least it fails which I would expect :).

dotnet build error:
Quote:

dotnet : A compatible SDK version for global.json version: [2.0.801] from [D:\TeamCity\buildAgent\work\cd4ee94462cc9ad\global.json] was not found
+ CategoryInfo : NotSpecified: (A compatible SD...] was not found:String) [],


NCrunch error:
Quote:

Utils.Common.Tests.NUnitTests.csproj: 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)


Thanks.
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.030 seconds.