Skip to content

Resolve issue with Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder test #29224

@captainsafia

Description

@captainsafia

The Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder currently fails with the following exception:

This occurs because .NET SDK has introduced a new target that throws an error if it finds items with any duplicate metadata ResolvedFileToPublish.

I added this task to ensure that items in RazorGenerate were removed from the ResolvedFileToPublish list before the task below had a chance to run.

  <Target
    Name="_RazorRemoveGenerateBeforePublish"
    BeforeTargets="_HandleFileConflictsForPublish"
    Condition="'$(ResolvedRazorCompileToolset)'=='RazorSdk' and '$(RazorCompileOnPublish)'=='true'">
    <ItemGroup Condition="'$(CopyRazorGenerateFilesToPublishDirectory)'=='false'">
      <ResolvedFileToPublish Remove="@(RazorGenerate)"/>
    </ItemGroup>
  </Target>

This doesn't resolve the test failure in Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder. Upon further inspection, it appears that the RazorGenerate ItemGroup associated with the publish step of this test is completely empty -- which means that the cshtml files are never removed.

We should investigate:

  • Why this test failure occurs only on this test and not others in the suite
  • If there's a more reliable heuristic to use here

Addendum: with the code above the Publish_DoesNotPublishCustomRazorGenerateItems passes which indicates that the issue is with the items not being populated into RazorGenerate and not any issues with the _RazorRemoveGenerateBeforePublish target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-static-web-assetstest-failure

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions