Fix CI: target MyPortfolio.csproj explicitly for build and publish#3
Merged
Merged
Conversation
Both dotnet build and dotnet publish now target MyPortfolio.csproj directly so the test project is never pulled into the CI pipeline. Also pins test package versions to the confirmed-stable set used by the dotnet new xunit template (xunit 2.4.2, SDK 17.8.0, Moq 4.18.4). https://claude.ai/code/session_01Qj49iUs6QNA2MQcCVP5cFN
- Add explicit 'dotnet restore MyPortfolio.csproj' step so NuGet only restores the app project, never the test project - Add --no-restore to build step and --no-build to publish step so neither can trigger a solution-level restore that picks up the test project (whose packages are incompatible with older CI runners) - Remove Build.0 entries for MyPortfolio.Tests from the solution so 'dotnet build' without arguments also skips the test project https://claude.ai/code/session_01Qj49iUs6QNA2MQcCVP5cFN
The test project lives in a subdirectory of the repo root, so the SDK's default **/*.cs wildcard was pulling all test source files into MyPortfolio.csproj — causing 'Moq not found' / 'Fact not found' errors when building the app project. Explicitly remove the test folder from Compile, Content, EmbeddedResource, and None item groups. https://claude.ai/code/session_01Qj49iUs6QNA2MQcCVP5cFN
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.
Summary
dotnet buildanddotnet publishnow targetMyPortfolio.csprojdirectly, so the test project is never pulled into the CI pipeline and can't cause package resolution failuresdotnet new xunittemplate (xunit 2.4.2,Microsoft.NET.Test.Sdk 17.8.0,Moq 4.18.4)This fixes the build failure introduced when the
MyPortfolio.Testsproject was added to the solution —dotnet buildwas building the full solution and hitting unresolvable NuGet packages.Generated by Claude Code