Skip to content

Dragging file between folders which match wildcards for different Build Action items results in file being included in both #1048

Open
@dsplaisted

Description

@dsplaisted
  • Create a new Console App (.NET Core) project
  • Add the following to the .csproj file:
<ItemGroup>
  <None Include="**/*" Exclude="bin/**;obj/**;**/*.*proj;**/*.user" />
  <Content Include="wwwroot\**" />
  <None Remove="wwwroot\**" />
</ItemGroup>
  • Create a wwwroot folder in the project folder
  • Create TextFile1.txt in wwwroot folder
  • Create TextFile2.txt in project root folder
  • Alternatively, open the following repro project instead of the provious steps: FolderBuildActionRepro.zip
  • In Solution Explorer, drag TextFile2.txt to the wwwroot folder
  • Save project file and view it

EXPECTED: Move operation should have included the file in the None item and removed it from the Content item, ie:

  <ItemGroup>
    <Content Remove="wwwroot\TextFile2.txt" />
  </ItemGroup>
  <ItemGroup>
    <None Include="wwwroot\TextFile2.txt" />
  </ItemGroup>

ACTUAL: The file is included in the None item but not removed from Content. So it will be in both items. Further project modifications can result in more weirdness because of this (for example, moving the file back to the root will include it in Content at the root and leave a None include for the file where it doesn't exist anymore).

  <ItemGroup>
    <None Include="wwwroot\TextFile2.txt" />
  </ItemGroup>

NOTE: Changing the Build Action of TextFile1.txt from Content to None does correctly remove the file from the Content item and include it in the None item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-External-CPSOwned by CPS and not this repo. Likely be closed in lieu of issue filed against VS platform.Triage-ApprovedReviewed and prioritized

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions