I have a .NET 5 WPF project, in the csproj file, i have
<ItemGroup>
<ViewModelFiles Include="**\*ViewModel.cs"></ViewModelFiles>
<Content Include="@(ViewModelFiles)">
<DependentUpon>$([System.String]::Copy('%(FileName)').Replace('Model', '.xaml'))</DependentUpon>
</Content>
</ItemGroup>
However, whenever I add a new item into my project, the IDE automatically adds a line of remove into the csproj file. For example, after Visual\Settings\Control\InputActionViewModel.cs is added:
<ItemGroup>
<ViewModelFiles Include="**\*ViewModel.cs"></ViewModelFiles>
<ViewModelFiles Remove="Visual\Settings\Control\InputActionViewModel.cs" />
<Content Include="@(ViewModelFiles)">
<DependentUpon>$([System.String]::Copy('%(FileName)').Replace('Model', '.xaml'))</DependentUpon>
</Content>
</ItemGroup>
</Project>
This is troblesome as I need to make an additional manual operation for every item I created. I would like to know how to swich off this auto generation.
October 25, 2022 Edit
The following is my current code
<ItemGroup>
<Compile Update="**\*ViewModel.cs">
<DependentUpon>$([System.String]::Copy('%(FileName)').Replace('Model', '.xaml'))</DependentUpon>
</Compile>
</ItemGroup>