I'm working on a project where I generate C# classes in a pre-build step using XSLT and XML to generate those. Those generated classes are included in one file, let's name it "MyClasses.cs" file. The problem now is, if a developer removes the file from the solution after the build is done and try to build the solution again, I see ItemGroup added like that under the project file as follows:
<ItemGroup>
<Compile Remove="MyClasses.cs" />
</ItemGroup>
While this won't prevent the generation of the classes again, it causes the solution to not build because the generated classes won't be included in the project. Meaning, the file needs a developer to include manually (right click and include it) so the entire solution can build. So, I wanna do is prevent people to remove the generated code "MyClasses.cs" file so that they can always build or override the behavior of Visual Studio to add an ItemGroup with Remove action for that file when removing it. Is that possible?