Repository navigation
[release/10.0.1xx] [tests] Use repository NuGet feeds - #13288
Conversation
Projects generated outside the source tree do not inherit the repository NuGet.config. A restore can then use api.nuget.org from user or machine settings and fail with NU1301 and HTTP 403 under Default Deny. Copy the repository config before dotnet new, preserving existing files. Keep the config in ProjectDirectory, not item-template output directories. Adapt the release DotNetNew cases to restore during project creation and remove their separate config copy. Keep the file-content assertion and check that item templates do not write a config under Resources/layout. The existing Debug and Release builds use the same project config. Context: #13280 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The tests leave config-copy ordering unverified because the templates lack restore post-actions; a restore-enabled regression must assert that project.assets.json exists immediately after New(), before any build.
1 open issue
What changed in this PR
Backports repository NuGet feed handling to release/10.0.1xx so generated test projects outside the source tree receive the repository configuration before dotnet new runs.
Changes:
- Creates the project directory and copies
NuGet.configonly when none exists. - Removes the test-local config copy and
--no-restoreargument. - Adds checks that item creation leaves the project config unchanged and creates no layout-directory config, while retaining Debug and Release build checks.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs | Copies repository NuGet configuration before template creation. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs | Uses shared config handling and checks config placement after item creation. |
Review effort: Balanced
Restore noRestore: true in XASdkTests.DotNetNew. The release Android templates have no restore post-action, so removing this option did not add creation-time restore coverage. The existing Debug and Release builds still restore using the config copied by DotNetCLI.New(). Context: #13288 (comment) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
Checked internal CI run 15834717, which tested merge commit All four release
The other MSBuild lanes had none of these four cases. All 28 network-isolation stop logs reported no blocked connections and Default Deny COMPLIANT. This includes every Windows and Linux lane listed above. The Windows MSBuild 1 start log confirms The run failed overall in the macOS APK 1 and APK 2 jobs, not in the network-isolation checks. Coverage limit: |
|
Checked the CI failures in build 15834717. The failures appear unrelated to this PR. The downloaded NUnit results show:
|
|
@dalexsoto stamp |
dalexsoto
left a comment
There was a problem hiding this comment.
Stamping as requested by @jonathanpeppers; no code review performed.

Adapt the fix from #13280 (e22e418) to
release/10.0.1xx. No merge from main or unrelated changes. The initial backport is 2473560; follow-up 7976857 restoresnoRestore: true, as requested. The user chose a second commit rather than rewriting the first.Projects generated outside the source tree, including under
BUILD_STAGINGDIRECTORY, do not inherit the repositoryNuGet.config. Restore can then use the user or machineapi.nuget.orgsource and fail with NU1301 and proxy HTTP 403 under network isolation.Xamarin.ProjectTools.DotNetCLI.New()now createsProjectDirectoryand copies the repository config there before runningdotnet new, only when no project config exists. Existing custom configs stay unchanged. Item-template output directories such asResources/layoutdo not receive a config. Default Deny remains enabled; no source is allowlisted and no restore failure is ignored.Release test coverage:
XASdkTests.DotNetNewhas four cases:android,androidlib,android-bindinglib, andandroidwear.noRestore: trueand remove the separate config copy. These release templates have no restore post-action. Removing--no-restoredid not exercise restore during project creation; the earlier description claiming that coverage was incorrect.Resources/layout/NuGet.configdoes not exist. Keep the existing Debug and Release builds and warning checks; these builds restore using the project config.DotNetNewAndroidTestandNestedBuildReusesResolvedAndroidToolingare absent from this release branch. This PR does not add them or claim coverage from them.Validation: focused source checks and
git diff --checkpassed. Per the user's request to let CI test this, no SDK build, device setup, or test run was started, and no pipeline was manually queued. Restore, builds, and Default Deny behavior remain for CI to verify. Public PR checks without network isolation cannot establish Default Deny results.No linked issue.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: