[xaprepare] add --dotnet-sdk-archive switch#10769
Merged
Conversation
Context: dotnet/sdk@bd5d3af I need to build a local .NET SDK, and then *use* it to build a local .NET Android. So, add a `--dotnet-sdk-archive` switch to xaprepare, such as: dotnet run --project .\build-tools\xaprepare\xaprepare\xaprepare.csproj -- --dotnet-sdk-archive="D:\src\dotnet\sdk\artifacts\packages\Debug\Shipping\dotnet-sdk-10.0.300-dev-win-x64.zip" With this in place, I could build dotnet/android normally using this .NET SDK. I also had to edit `eng/Versions.props`, such as: <MicrosoftNETSdkPackageVersion>10.0.300-dev</MicrosoftNETSdkPackageVersion> In order for targets like `ConfigureLocalWorkload` to work properly. With these changes, I can test a local .NET 10.0.300-dev SDK build with local .NET Android changes.
There was a problem hiding this comment.
Pull request overview
This PR adds a --dotnet-sdk-archive command-line switch to xaprepare, enabling developers to use a locally built .NET SDK archive instead of downloading it from the internet. This is particularly useful for testing local .NET SDK builds with .NET Android changes.
Changes:
- Added command-line option parsing for
--dotnet-sdk-archiveparameter - Added
LocalDotNetSdkArchiveproperty to Context class for storing the archive path - Implemented
InstallDotNetFromLocalArchiveAsyncmethod to install from local archive - Modified SDK installation logic to check for local archive before attempting download
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| build-tools/xaprepare/xaprepare/Main.cs | Adds command-line option parsing for the new --dotnet-sdk-archive switch and assigns it to Context |
| build-tools/xaprepare/xaprepare/Application/Context.cs | Adds nullable LocalDotNetSdkArchive property to store the path to a local SDK archive |
| build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs | Implements local archive installation logic and modifies Execute method to use local archive when specified |
jonathanpeppers
added a commit
that referenced
this pull request
Feb 4, 2026
Context: dotnet/sdk@bd5d3af `dotnet run` now passes in `dotnet run -e FOO=BAR` as `@(RuntimeEnvironmentVariable)` MSBuild items. To opt in to this new feature, we need to add: <ProjectCapability Include="RuntimeEnvironmentVariableSupport" /> As well as update the `_GenerateEnvironmentFiles` MSBuild target: <!-- RuntimeEnvironmentVariable items come from 'dotnet run -e NAME=VALUE' --> <_GeneratedAndroidEnvironment Include="@(RuntimeEnvironmentVariable->'%(Identity)=%(Value)')" /> I added a new test to verify we have the env vars on-device at runtime. Note that I tested this in combination with a local .NET SDK build: * #10769 We won't be able to merge this until we have a .NET SDK here that includes the above commit.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jonathanpeppers
added a commit
to jonathanpeppers/xamarin-android
that referenced
this pull request
Feb 5, 2026
Context: dotnet/sdk@bd5d3af I need to build a local .NET SDK, and then *use* it to build a local .NET Android. So, add a `--dotnet-sdk-archive` switch to xaprepare, such as: dotnet run --project .\build-tools\xaprepare\xaprepare\xaprepare.csproj -- --dotnet-sdk-archive="D:\src\dotnet\sdk\artifacts\packages\Debug\Shipping\dotnet-sdk-10.0.300-dev-win-x64.zip" With this in place, I could build dotnet/android normally using this .NET SDK. I also had to edit `eng/Versions.props`, such as: <MicrosoftNETSdkPackageVersion>10.0.300-dev</MicrosoftNETSdkPackageVersion> In order for targets like `ConfigureLocalWorkload` to work properly. With these changes, I can test a local .NET 10.0.300-dev SDK build with local .NET Android changes.
jonathanpeppers
added a commit
to jonathanpeppers/xamarin-android
that referenced
this pull request
Feb 5, 2026
Context: dotnet/sdk@bd5d3af `dotnet run` now passes in `dotnet run -e FOO=BAR` as `@(RuntimeEnvironmentVariable)` MSBuild items. To opt in to this new feature, we need to add: <ProjectCapability Include="RuntimeEnvironmentVariableSupport" /> As well as update the `_GenerateEnvironmentFiles` MSBuild target: <!-- RuntimeEnvironmentVariable items come from 'dotnet run -e NAME=VALUE' --> <_GeneratedAndroidEnvironment Include="@(RuntimeEnvironmentVariable->'%(Identity)=%(Value)')" /> I added a new test to verify we have the env vars on-device at runtime. Note that I tested this in combination with a local .NET SDK build: * dotnet#10769 We won't be able to merge this until we have a .NET SDK here that includes the above commit.
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.
Context: dotnet/sdk@bd5d3af
I need to build a local .NET SDK, and then use it to build a local .NET Android.
So, add a
--dotnet-sdk-archiveswitch to xaprepare, such as:With this in place, I could build dotnet/android normally using this .NET SDK.
I also had to edit
eng/Versions.props, such as:In order for targets like
ConfigureLocalWorkloadto work properly.With these changes, I can test a local .NET 10.0.300-dev SDK build with local .NET Android changes.