Open
Description
- 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 thewwwroot
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.