0

How could I select to which ItemGroup the Content entries get added. I am using the .csproj extension in VS Code.

E.g. if I have the following:

<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>

Then there are two options:

<ItemGroup>
    <Content Include="folder\foo.extension" />
</ItemGroup>
<ItemGroup>
</ItemGroup>

and

<ItemGroup>
</ItemGroup>
<ItemGroup>
    <Content Include="folder\foo.extension" />
</ItemGroup>

I would like to control which option is used. My ultimate goal is to have the same behavior in VS Code as it is in VS 2022.

manymanymore
  • 2,251
  • 3
  • 26
  • 48

1 Answers1

1

It doesn't matter which ItemGroup you select, neither does the order.

Usage of Item, ItemGroup elemtens

https://learn.microsoft.com/en-us/visualstudio/msbuild/item-element-msbuild?view=vs-2022#attributes-and-elements

Posible values for Content

https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2022#content

Works fine with dotnet cli (VS Code)

   <ItemGroup>
      <Content Include="folder/foo.extension">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </Content>
    </ItemGroup>
ultranaco
  • 26
  • 2