Skip to content

Fix NU1004 restore failure by referencing .NET Framework reference assemblies explicitly - #520

Open
DominikPalo wants to merge 1 commit into
mainfrom
bugfix/lockfile-reference-assemblies
Open

DominikPalo wants to merge 1 commit into
mainfrom
bugfix/lockfile-reference-assemblies

Conversation

@DominikPalo

Copy link
Copy Markdown
Member

Summary

The tests workflow has been failing on main since the releases/netoffice_v1.9.11 merge (afc621391). Every project fails restore in locked mode with:

error NU1004: The package references have changed for net462. Lock file's package references:
Microsoft.NETFramework.ReferenceAssemblies:[1.0.3, ), ... project's package references: ...

Cause

The .NET SDK adds Microsoft.NETFramework.ReferenceAssemblies on its own only when the .NET Framework targeting pack is not installed. The packages.lock.json files were regenerated on a machine without the net462 targeting pack, so they list the package. The windows-2025 runner has the targeting pack, so the SDK doesn't add the package there. The lock files and the projects disagree, and RestoreLockedMode=true fails the build.

Fix

Reference Microsoft.NETFramework.ReferenceAssemblies 1.0.3 explicitly (PrivateAssets="All") in Source/NetOffice.props. That way the dependency graph is the same on every machine. Every project with a lock file imports NetOffice.props, and the lock files already pin [1.0.3, ), so no lock file changes are needed.

Notes for reviewers

  • I couldn't build locally (no .NET SDK on the authoring machine). CI on this branch is the verification.

🤖 Generated with Claude Code

The .NET SDK adds this package implicitly only when the .NET Framework
targeting pack is missing. The lock files were regenerated on such a
machine, so restore in locked mode failed with NU1004 on the Windows
CI runner where the targeting pack is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T12:19:43.038566Z 4cf3faf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@DominikPalo
DominikPalo requested a review from jozefizso October 9, 2026 12:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant