Restore "[One .NET] fix GetAndroidDependencies target with --no-restore"#10339
Closed
jonathanpeppers wants to merge 1 commit intomainfrom
Closed
Restore "[One .NET] fix GetAndroidDependencies target with --no-restore"#10339jonathanpeppers wants to merge 1 commit intomainfrom
jonathanpeppers wants to merge 1 commit intomainfrom
Conversation
Member
Author
|
The issue with this change as-is, Will revisit this. |
jonathanpeppers
added a commit
that referenced
this pull request
Jul 25, 2025
Context: #10339 In order to complete #10339, I want to refactor & remove the need for having to define `$(_XATargetFrameworkDirectories)` at all. An easy first step is to remove the usage of "Facades" directories because these don't exist in the .NET 6+ world. These are a Mono/.NET framework-ism, which is replaced by "ref" packs in .NET 6+. I also removed the `gen-ProfileAssemblies.sh` script, which was used to generate files specific to Mono & Xamarin.Android, but is no longer needed.
jonathanpeppers
added a commit
that referenced
this pull request
Jul 26, 2025
Context: #10339 In order to complete #10339, I want to refactor & remove the need for having to define `$(_XATargetFrameworkDirectories)` at all. An easy first step is to remove the usage of "Facades" directories because these don't exist in the .NET 6+ world. These are a Mono/.NET framework-ism, which is replaced by "ref" packs in .NET 6+. I also removed the `gen-ProfileAssemblies.sh` script, which was used to generate files specific to Mono & Xamarin.Android, but is no longer needed.
Context: a21d1a7 This reverts commit a84eccb. I've noticed the following sometimes happens when a new .NET MAUI project is created in VS 2022 on Windows: dotnet\sdk\6.0.200-preview.22055.18\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1004: Assets file 'obj\project.assets.json' not found. Run a NuGet package restore to generate this file. I seem to only get this for MAUI projects and only *sometimes*. `dotnet new android` projects seem to always work fine. When this error occurs, I think the dropdown fails to load the device list. What you end up with is the play button that just says `> Android Emulator`. After some amount of "fiddling", you can get the IDE to load the device list. What I think is happening is: 1. NuGet restore takes longer in MAUI projects than `dotnet new android` 2. Sometimes `GetAndroidDependencies` runs *before* NuGet restore, and that triggers the above error. I could validate this hypothesis with: > dotnet new android > dotnet build -t:GetAndroidDependencies --no-restore And I get the above error! I could also reproduce in a test.
0bd32a8 to
3859395
Compare
jonathanpeppers
commented
Jul 30, 2025
Comment on lines
+52
to
+55
| <_AndroidTargetingPackAssemblyPath | ||
| Condition=" '%(TargetingPack.Identity)' == 'Microsoft.NETCore.App' " | ||
| Include="$([MSBuild]::ValueOrDefault('%(TargetingPack.Path)', '%(TargetingPack.PackageDirectory)'))\ref\*\System.dll" | ||
| /> |
Member
Author
Member
Author
Member
Author
Member
Author
|
Closing in favor of an IDE change: |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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: a21d1a7
This reverts commit a84eccb.
I've noticed the following sometimes happens when a new .NET MAUI project is created in VS 2022 on Windows:
I seem to only get this for MAUI projects and only sometimes.
dotnet new androidprojects seem to always work fine.When this error occurs, I think the dropdown fails to load the device list. What you end up with is the play button that just says
> Android Emulator. After some amount of "fiddling", you can get the IDE to load the device list.What I think is happening is:
NuGet restore takes longer in MAUI projects than
dotnet new androidSometimes
GetAndroidDependenciesruns before NuGet restore, and that triggers the above error.I could validate this hypothesis with:
And I get the above error! I could also reproduce in a test.