Skip to content

[StaticWebAssets] Cache incorrectly updaded when a total update is performed #49010

@javiercn

Description

@javiercn

We discovered this late in the cycle, essentially when we detect that we need to discard the cache completely, we incorrectly leave some state behind.

The most common way you can run into this situation is when you copy the project from one location to another or there are two different casings across builds.

Removing the obj folder and triggering a new build should make the issue go away. Alternatively, removing duplicate assets using the following snippet

  <Target Name="RemoveCachedDuplicates" AfterTargets="ResolveProjectStaticWebAssets">
    <ItemGroup>
      <_UniqueAssets Include="@(StaticWebAsset->Distinct())" />
      <StaticWebAsset Remove="@(_UniqueAssets)" />
      <StaticWebAsset Include="@(_UniqueAssets)" />
    </ItemGroup>
   </Target>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions