[dotnet run] $(Device) global property missing during DeployToDevice target#53018
Merged
jonathanpeppers merged 1 commit intoFeb 13, 2026
Merged
Conversation
…ce` target When the `DeployToDevice` target runs, and you selected a device from the `dotnet run` device selection prompt, `$(Device)` is blank! This was because evaluation already occurred, so we have to invalidate the project, so it will occur in subsequent steps. I could reproduce this in a test, so this verifies it will remain fixed for the future.
rolfbjarne
approved these changes
Feb 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes dotnet run device deployment scenarios where the selected device wasn’t flowing into subsequent MSBuild target execution (notably DeployToDevice) because the project had already been evaluated before the device was chosen.
Changes:
- Invalidate the cached MSBuild evaluation in
RunCommandSelectorwheneverDevice(and optionallyRuntimeIdentifier) is applied so later targets re-evaluate with the updated global properties. - Strengthen run-device tests to assert
DeployToDevicelogs include the expectedDevice(andRuntimeIdentifierfor auto-selected devices).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Cli/dotnet/Commands/Run/RunCommand.cs |
Forces selector re-evaluation after setting Device so DeployToDevice sees updated global properties. |
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunSelectsDevice.cs |
Extends binlog assertions to validate DeployToDevice received/logged the selected Device/RuntimeIdentifier. |
MiYanni
approved these changes
Feb 13, 2026
rmarinho
added a commit
to dotnet/android
that referenced
this pull request
Mar 18, 2026
The dotnet/sdk fix (dotnet/sdk#53018) now properly passes the Device global property to DeployToDevice via InvalidateGlobalProperties. Remove the device.props write/read cache that was working around this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rmarinho
added a commit
to dotnet/android
that referenced
this pull request
Mar 19, 2026
The dotnet/sdk fix (dotnet/sdk#53018) now properly passes the Device global property to DeployToDevice via InvalidateGlobalProperties. Remove the device.props write/read cache that was working around this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rmarinho
added a commit
to dotnet/android
that referenced
this pull request
Mar 19, 2026
The dotnet/sdk fix (dotnet/sdk#53018) now properly passes the Device global property to DeployToDevice via InvalidateGlobalProperties. Remove the device.props write/read cache that was working around this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rmarinho
added a commit
to dotnet/android
that referenced
this pull request
Mar 19, 2026
The dotnet/sdk fix (dotnet/sdk#53018) now properly passes the Device global property to DeployToDevice via InvalidateGlobalProperties. Remove the device.props write/read cache that was working around this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rmarinho
added a commit
to dotnet/android
that referenced
this pull request
Mar 23, 2026
The dotnet/sdk fix (dotnet/sdk#53018) now properly passes the Device global property to DeployToDevice via InvalidateGlobalProperties. Remove the device.props write/read cache that was working around this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
When the
DeployToDevicetarget runs, and you selected a device from thedotnet rundevice selection prompt,$(Device)is blank!This was because evaluation already occurred, so we have to invalidate the project, so it will occur in subsequent steps.
I could reproduce this in a test, so this verifies it will remain fixed for the future.