Skip to content

Support Visual Studio "Build Acceleration" #8581

Closed

Description

@jonathanpeppers

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

.NET 8

Description

Context: https://github.com/dotnet/project-system/blob/main/docs/build-acceleration.md
Context: https://github.com/dotnet/project-system/blob/main/docs/up-to-date-check.md

Using Visual Studio 17.8, there is a new feature that skips running MSBuild "builds" in some cases during incremental builds.

This currently has an issue in Android projects:

WARNING: Potential build performance issue in 'XamarinTV.Android.csproj'.
The project does not appear up-to-date after a successful build:
Input ResolvedCompilationReference item 'C:\Users\daortin\source\repos\app-xamarintv\XamarinTV.Android\obj\Debug\net8.0-android\_Microsoft.Android.Resource.Designer.dll' (2023-12-11 11:34:12.546) has been modified since the last successful build started

There is a new item group we can add _Microsoft.Android.Resource.Designer.dll to that will solve this problem and improve build performance inside VS.

/cc @davidortinau

Steps to Reproduce

  1. Create an Android app project
  2. References an Android class library
  3. Read the diagnostic project system logs

Did you find any workaround?

No

Relevant log output

No response

Activity

  1. changed the title [-]Support Visual Studio "Build Acceleration[/-] [+]Support Visual Studio "Build Acceleration"[/+] on Dec 11, 2023
  2. added this to the .NET 9 milestone on Dec 11, 2023
  3. dellis1972 commented on Jan 4, 2024

    @dellis1972
    Contributor

    I've taken a look at the ItemGroups, I'm not sure which ones we should be using. Most of them are about files which MSBuild does NOT know about. But in this case it does.

    I'll read through the source code and see what they are actually doing.

  4. self-assigned this
    on Jan 4, 2024
  5. jonathanpeppers commented on Jan 4, 2024

    @jonathanpeppers
    MemberAuthor

    I tested in VS 17.9 Preview 2.1 with this setting:

    image

    This project also has some instructions to cause it:

    https://github.com/jonathanpeppers/MauiBuildAcceleration

    1>FastUpToDate:         Adding ResolvedCompilationReference inputs: (MauilClassLibrary)
    1>FastUpToDate:             D:\src\MauiBuildAcceleration\MauilClassLibrary\obj\Debug\net8.0-android\_Microsoft.Android.Resource.Designer.dll (MauilClassLibrary)
    1>FastUpToDate: Input ResolvedCompilationReference item 'D:\src\MauiBuildAcceleration\MauilClassLibrary\obj\Debug\net8.0-android\_Microsoft.Android.Resource.Designer.dll' (2024-01-04 09:13:06.818) has been modified since the last successful build started (2024-01-04 09:13:05.405), not up-to-date. (MauilClassLibrary)
    
  6. jonathanpeppers commented on Jan 9, 2024

    @jonathanpeppers
    MemberAuthor

    After playing with this more, the current behavior is:

    1. First build: as usual.
    2. Second (incremental) build, VS & FUTDC will run MSBuild due to the message above.
    3. Third (incremental) build, VS & FUTDC will skip running MSBuild.

    Had some conversation with the project system team, and I think we could try:

    1. Hook into the CollectResolvedCompilationReferencesDesignTime target, remove the _Microsoft.Android.Resource.Designer.dll file from @(ReferencePathWithRefAssemblies):

    https://github.com/dotnet/project-system/blob/e617a12f5f3e1e77ddcd7bffcbe292c706a8affe/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/DesignTimeTargets/Microsoft.Managed.DesignTime.targets#L442-L443

    1. See if that helps no. 2 above.

    2. Verify that MSBuild will still run again if you change an AndroidResource. If it doesn't, we may need to add all AndroidResource files to @(UpToDateCheckInput).

  7. dellis1972 commented on Feb 8, 2024

    @dellis1972
    Contributor

    Odd I can't seem to repo on the latest Preview of VS...

  8. added a commit that references this issue on Jun 19, 2024
    14f15f7
  9. dellis1972 commented on Jun 19, 2024

    @dellis1972
    Contributor

    PR is up #9042

  10. added a commit that references this issue on Jun 26, 2024
    70cb8a5
  11. locked and limited conversation to collaborators on Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.enhancementProposed change to current functionality.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions