Skip to content

Restore "[One .NET] fix GetAndroidDependencies target with --no-restore" #10339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonathanpeppers
Copy link
Member

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.

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.
@jonathanpeppers
Copy link
Member Author

The issue with this change as-is, $(_XATargetFrameworkDirectories) is blank, and a lot of builds fail.

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.
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.

1 participant