E. Alex Davis
E. Alex Davis

Reputation: 31

Unable to build Newtonsoft.Json from source locally

I am attempting to build Newtonsoft.Json from source locally. I downloaded the source as a zip file. After installing a variety of prerequisites, I was able to get it to build in Visual Studio 2019. However, the DLL produced in that way is incomplete. I noticed the Build folder with various scripts. However, when I execute runbuild, I get errors:

C:\Users(redacted).nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning : Unable to locate repository containing directory 'C:(redacted)\Newtonsoft.Json\Src\Newtonsoft.Json'. [C:(redacted)\Newtonsoft.Json\Src\Newtonsoft.Json\Newtonsoft.Json.csproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.target s(104,5): error : SourceRoot items must include at least one top-level (not nested) item when DeterministicSourcePaths is true [C:(redacted)\Newtonsoft.Json\Src\Newtonsoft.Json\Newtonsoft.Json.csproj]

Any tips appreciated!

Upvotes: 1

Views: 1144

Answers (1)

E. Alex Davis
E. Alex Davis

Reputation: 31

Taking the error message at face value, I did some searches and came up with

Only set DeterministicSourcePaths to true on a build/CI server, never for local builds.

at https://github.com/dotnet/sourcelink/blob/master/docs/README.md

So, I added

<DeterministicSourcePaths>false</DeterministicSourcePaths>

to Newtonsoft.Json.csproj

Result: errors are gone

Still not getting a strong name for the DLL. But, I'll save that for a fresh post since this one already got down-voted...!?

Upvotes: 1

Related Questions