Conversation
VS 2026 (v18) MSBuild/Roslyn fails Rock.Blocks with CS0012 ('JObject is
defined in an assembly that is not referenced') at every call site that
binds .ToDictionary()/LINQ overloads, because Rock's
JsonExtensions.ToDictionary(this JObject) extension (namespace Rock) puts
JObject in the overload-candidate set and classic csproj builds never pass
transitive dependencies to the compiler. VS 2022 tolerated this; VS 2026
does not.
Add the reference explicitly (Newtonsoft.Json 13.0.1 is already in the
solution packages folder and ships in RockWeb\Bin, so no output change).
Upstream Rock resolves this from v18.1 onward by converting Rock.Blocks to
an SDK-style project; this commit is the stopgap for the 1.16.x/17.x lines
and should be cherry-picked onto future version branches until then.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses VS 2026 (v18) build failures by explicitly adding a Newtonsoft.Json reference to the classic (non-SDK) Rock.Blocks project so the compiler receives the required assembly reference.
Changes:
- Added an explicit
Newtonsoft.Jsonassembly reference toRock.Blocks.csproj. - Added
Newtonsoft.Jsonv13.0.1 toRock.Blocks/packages.configso NuGet restore provides the referenced DLL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Rock.Blocks/Rock.Blocks.csproj | Adds a direct Newtonsoft.Json reference (matching the same HintPath pattern used elsewhere in the solution) to satisfy VS 2026 compilation. |
| Rock.Blocks/packages.config | Adds the NuGet package entry for Newtonsoft.Json 13.0.1 to support restore for the new reference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building the Rock solution with VS 2026 (v18) fails
Rock.Blockswith ~10x:plus a cascading
Could not get dependencies for project reference 'Rock.Blocks'from RockWeb. The identical tree builds clean under VS 2022.Cause
Rock/Utility/ExtensionMethods/JsonExtensions.csdefinesToDictionary(this JObject)in namespaceRock, so every.ToDictionary()/LINQ binding in Rock.Blocks putsJObjectin the overload-candidate set. Classic (non-SDK) csproj builds never pass transitive dependencies to csc, and Rock.Blocks has never referenced Newtonsoft.Json directly. VS 2026's Roslyn now requires the reference where VS 2022's did not.Fix
Add the explicit
Newtonsoft.Json 13.0.1reference toRock.Blocks.csproj+packages.config. The package is already in the solutionpackagesfolder and the DLL already ships inRockWeb\Bin, so there is no output change — this only lets the compile succeed.Verified locally: VS 2026 MSBuild fails before / builds clean after; VS 2022 unaffected.
Forward-compat note
Upstream resolves this from v18.1 onward by converting Rock.Blocks to an SDK-style project (transitive refs flow to the compiler there). All 17.x hotfix branches still have the classic csproj without the reference, so this commit should be cherry-picked onto each future 1.16.x/17.x-based branch and dropped once we're on 18.1+.
🤖 Generated with Claude Code