Skip to content

[release/10.0.1xx] Backport remaining CFSClean fixes - #12394

Closed
jonathanpeppers wants to merge 5 commits into
dotnet:release/10.0.1xxfrom
jonathanpeppers:jonathanpeppers-backport-cfsclean-fixes
Closed

[release/10.0.1xx] Backport remaining CFSClean fixes#12394
jonathanpeppers wants to merge 5 commits into
dotnet:release/10.0.1xxfrom
jonathanpeppers:jonathanpeppers-backport-cfsclean-fixes

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

Backports the remaining non-Maven/Gradle CFSClean fixes from main to release/10.0.1xx, with release-specific conflict resolution that preserves files removed or consolidated on the release branch.

Maven/Gradle backports #12199 (466da4a84) and #12368 (adffb38fd) are intentionally excluded because they are being handled separately.

Original changes

Validation

  • Confirmed the merge-base is exactly origin/release/10.0.1xx and the PR range contains exactly five backport commits.
  • git diff --check origin/release/10.0.1xx...HEAD
  • Parsed all 4 changed Azure Pipelines YAML files and all 8 changed template JSON files.
  • dotnet build src\Microsoft.Android.Templates\Microsoft.Android.Templates.csproj -c Debug -p:RunningOnCI=true -v:minimal -nodeReuse:false
  • Attempted the targeted Xamarin.Android.Build.Tests build; repository preparation was blocked after all three approved-feed runtime-pack restore attempts timed out.

jonathanpeppers and others added 5 commits August 14, 2026 14:49
CFSClean reports network-isolation warnings when tests and CI tooling resolve packages directly from public NuGet endpoints. Route those package downloads through the existing dnceng `dotnet-public` Azure Artifacts feed and rely on the repository `NuGet.config` for generated test projects and the API-docs tool installation.

Direct `.nupkg` test downloads now use the feed's V3 package base address, while obsolete `ExtraNuGetConfigSources` public overrides are removed. No fallback to nuget.org is retained.

`Xamarin.Google.Android.InstallReferrer` 1.1.2.6 is not currently mirrored to `dotnet-public`; `InstallAndRunTests.GradleFBProj` will require that package to be mirrored.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Internal [build 14925232](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=14925232) reported CFSClean violations during **Create MAUI template**. The pipeline needs to suppress three independent .NET network paths:

1. `DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE=true` prevents background workload advertising-manifest updates.
2. `DOTNET_SDK_VULNERABILITY_CHECK_DISABLE=true` prevents the .NET CLI's separate background SDK release/vulnerability/EOL metadata refresh. The SDK invokes this refresh from restoring commands such as `dotnet build` and `dotnet restore`.
3. `NuGetAudit=false` disables NuGet restore's package-advisory lookup. This is a distinct MSBuild property and does not replace the SDK-level variable.

The immediate MAUI violation came from `dotnet new maui`, which runs a restore post-action by default. That restore had no project-specific `NuGet.config`, so it contacted public NuGet and workload advertising-manifest hosts. Passing `--no-restore` creates the template without running that post-action.

This does not remove the intended MAUI restore/build. The following Debug and Release build steps remain unchanged and explicitly pass `--configfile $(Build.SourcesDirectory)/maui/NuGet.config`, keeping package acquisition on the configured sources. Disabling these metadata checks also does not disable package hash/signature validation; it prevents external metadata lookups in network-isolated jobs.

- Retain `DOTNET_SDK_VULNERABILITY_CHECK_DISABLE=true` and add `NuGetAudit=false` alongside it in shared pipeline variables and the internal override.
- Add `--no-restore` to MAUI template creation in the main, public, and internal pipeline definitions.

- Parsed all changed YAML files successfully.
- Ran `git diff --check`.
- Verified every MAUI template-creation variant uses `--no-restore`.
- Verified all three isolation controls remain present where expected.
- Verified `dotnet new --no-restore` creates a project without producing a restore assets file.
- Confirmed the separate SDK behavior in [`RestoringCommand`](https://github.com/dotnet/sdk/blob/8795d0128cf1efbb900edd5cfbd8e9789be10653/src/Cli/dotnet/Commands/Restore/RestoringCommand.cs) and [`SdkReleaseMetadataCache`](https://github.com/dotnet/sdk/blob/8795d0128cf1efbb900edd5cfbd8e9789be10653/src/Cli/dotnet/SdkVulnerability/SdkReleaseMetadataCache.cs).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- declare the standard `skipRestore` symbol in every Android project template
- map `skipRestore` to the user-facing `--no-restore` option through each template's `dotnetcli.host.json`
- prevent `XASdkTests.DotNetNew` from restoring generated projects implicitly
- copy the repository `NuGet.config` into generated projects before builds restore
- route `AndroidMavenLibrary` items with blank repository metadata through `dotnet-public-maven` in test scope

`--no-restore` is presented as a standard `dotnet new` option, but project templates must opt into accepting it by declaring a `skipRestore` boolean symbol and mapping that symbol to `--no-restore` in `dotnetcli.host.json`. This follows the symbol/mapping convention used by the .NET SDK and .NET MAUI templates.

The Android templates intentionally do not add a restore post-action. They therefore preserve their existing default behavior and avoid restoring before test call sites configure approved package versions and feeds. The new option lets `XASdkTests` explicitly document and enforce that expectation before copying the repository `NuGet.config` into generated projects.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Depends on dotnet#12336.

The Windows template smoke project is generated under `$(Build.StagingDirectory)`, outside the repository `NuGet.config` hierarchy. Its implicit build restore therefore falls back to the agent's machine NuGet configuration and may access unapproved package feeds.

- Pass `RestoreConfigFile=$(System.DefaultWorkingDirectory)\NuGet.config` to the template build.
- Quote the template creation and build staging paths using Windows path syntax.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`CodeBehindTests` passed a file path to `CopyNuGetConfig`, which expects a directory and appends `NuGet.config`. This placed the repository configuration in a nested path, so generated projects could miss it and contact external package feeds. Pass the temporary project root instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 20:13
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

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.

Pull request overview

Backports a set of CFSClean/network-isolation fixes from main into release/10.0.1xx, focusing on preventing unintended public NuGet access during CI and template/test flows while preserving release-branch-specific layout.

Changes:

  • Removes explicit api.nuget.org overrides from several test projects and routes direct package downloads through dotnet-public.
  • Adds support for dotnet new --no-restore in Android project templates and updates XASdkTests to create templates without restore, then build with an approved NuGet.config.
  • Updates Azure Pipelines YAML to disable restore-related network paths (workload update notifications, SDK vulnerability checks, NuGet audit) and to avoid implicit restores in template creation/smoke steps.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs Removes explicit nuget.org source override from a device integration test project.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs Adds noRestore support to dotnet new wrapper used by tests.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs Uses --no-restore, copies repo NuGet.config, and adjusts build parameters (including Maven targeting for wear template).
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/FilterAssembliesTests.cs Switches test package downloads to the dotnet-public package base address and adds a lowercase URL test.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/dotnet-public-maven.targets Adds an MSBuild hook to route blank AndroidMavenLibrary.Repository entries through dotnet-public-maven.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs Fixes CopyNuGetConfig usage to pass a directory instead of a file path.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs Removes explicit nuget.org source override from a smoke test project.
src/Microsoft.Android.Templates/androidlib/.template.config/template.json Adds skipRestore symbol so templates can accept --no-restore.
src/Microsoft.Android.Templates/androidlib/.template.config/dotnetcli.host.json Maps skipRestore to --no-restore for the androidlib template.
src/Microsoft.Android.Templates/android/.template.config/template.json Adds skipRestore symbol so templates can accept --no-restore.
src/Microsoft.Android.Templates/android/.template.config/dotnetcli.host.json Maps skipRestore to --no-restore for the android template.
src/Microsoft.Android.Templates/android-wear/.template.config/template.json Adds skipRestore symbol so templates can accept --no-restore.
src/Microsoft.Android.Templates/android-wear/.template.config/dotnetcli.host.json Maps skipRestore to --no-restore for the androidwear template.
src/Microsoft.Android.Templates/android-bindinglib/.template.config/template.json Adds skipRestore symbol so templates can accept --no-restore.
src/Microsoft.Android.Templates/android-bindinglib/.template.config/dotnetcli.host.json Maps skipRestore to --no-restore for the bindinglib template.
build-tools/automation/yaml-templates/variables.yaml Adds variables to suppress workload updates, SDK vulnerability checks, and NuGet audit in isolated environments.
build-tools/automation/yaml-templates/build-windows.yaml Quotes template paths and forces restore to use the repo NuGet.config during the Windows template smoke build.
build-tools/automation/azure-pipelines.yaml Creates the MAUI template with --no-restore to prevent unconfigured restore post-actions.
build-tools/automation/azure-pipelines-apidocs.yaml Removes explicit nuget.org source from boots tool installation to rely on approved feeds.

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

@jonathanpeppers

Copy link
Copy Markdown
Member Author

Superseded by #12396, which uses a branch hosted directly on dotnet/android.

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.

2 participants