Skip to content

Fixes #5703. Build fails with NETSDK1004: missing project.assets.json for TestAssets after NuGet/SDK changes - #5704

Closed
BDisp wants to merge 3 commits into
tui-cs:developfrom
BDisp:issue/5703_build-fails
Closed

BDisp wants to merge 3 commits into
tui-cs:developfrom
BDisp:issue/5703_build-fails

Conversation

@BDisp

@BDisp BDisp commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Summary
This PR prevents local/CI builds from failing with NETSDK1004 when optional test fixture projects under Tests/TestAssets are not present or restored. It makes the ProjectReference entries for those TestAssets conditional on the presence of both the referenced .csproj and its obj/project.assets.json.

Changes

  • Modified: Tests/UnitTests.NonParallelizable/UnitTests.NonParallelizable.csproj
    • Added MSBuild Condition guards to the two ProjectReference entries for ConfigPropertyTypeLoad test fixtures (ConsumerLib and AttrProviderMissing). The references are only included when the referenced .csproj and its obj/project.assets.json exist.

Rationale
Some test fixture projects are optional and not always checked out or restored in developer machines or CI. Without project.assets.json present, the SDK raises NETSDK1004 during package resolution. The change avoids forcing package resolution for absent test assets while preserving behavior when they are available.

Testing

  1. dotnet build (repo root) — build should succeed even if TestAssets are absent or not restored.
  2. If you need the test fixtures, run dotnet restore at repo root so project.assets.json is generated for the TestAssets projects and the ProjectReferences will be included as before.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

Update central package versions for SourceLink, logging, xUnit, System.IO.Abstractions, System.CommandLine, Terminal.Gui.Editor, ImageSharp, ReportGenerator, and coverlet.

Normalize test project XML formatting and add private runner asset metadata for xunit.runner.visualstudio.

Make ConfigPropertyTypeLoad fixture references conditional on restored fixture assets to avoid build failures when unavailable.
@BDisp
BDisp requested a review from tig as a code owner October 10, 2026 17:04
Copilot AI balanced review requested due to automatic review settings October 10, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clean restores cannot re-enable the conditioned fixtures, and unrelated dependency upgrades broaden the PR beyond its stated scope.

2 open findings
What changed in this PR

Prevents NETSDK1004 failures by conditionally including optional test fixtures, while also updating unrelated dependencies.

Changes:

  • Adds guards around fixture project references.
  • Updates test-runner package metadata.
  • Upgrades multiple centrally managed dependencies.
File Description
Directory.Packages.props Upgrades package versions.
Tests/​IntegrationTests/​IntegrationTests.csproj Updates runner metadata and formatting.
Tests/​PerformanceTests/​PerformanceTests.csproj Updates runner metadata.
Tests/​StressTests/​StressTests.csproj Updates runner metadata and formatting.
Tests/​UnitTests.Legacy/​UnitTests.Legacy.csproj Updates runner metadata and formatting.
Tests/​UnitTests.NonParallelizable/​UnitTests.NonParallelizable.csproj Conditionally includes fixtures and updates runner metadata.
Tests/​UnitTestsParallelizable/​UnitTests.Parallelizable.csproj Updates runner metadata and formatting.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Tests/UnitTests.NonParallelizable/UnitTests.NonParallelizable.csproj Outdated
Comment thread Directory.Packages.props Outdated
BDisp added 2 commits October 10, 2026 18:20
Downgrade SixLabors.ImageSharp from 4.1.3 to 3.1.12 in Directory.Packages.props to restore compatibility.
Update UnitTests.NonParallelizable to reference the two ConfigPropertyTypeLoad fixture projects whenever their project files exist and IncludeTestFixtures is not false, so restore works from a clean checkout; add a note on opting out with IncludeTestFixtures=false.
@BDisp

BDisp commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

It was a problem with Visual Studio. After restarting the machine, this problem no longer occurs. That's why I'm closing this.

@BDisp BDisp closed this Oct 10, 2026
@BDisp
BDisp deleted the issue/5703_build-fails branch October 10, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails with NETSDK1004: missing project.assets.json for TestAssets after NuGet/SDK changes

2 participants