I am building a NuGet package for a WinForms control demonstrating how to use it. As such, I need to add some sample forms into the target project when my NuGet package is being installed. If the name of my sample form is Form2 and I integrate it into a default C# WinForms project, I get the following result in the solution explorer:
As you can see, the Form2 is not added to the target project correctly. And really, if we look into the .csproj file, we'll find the following records for the code parts of the Form2:
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs" />
, while the correct record for the Form2.Designer.cs file should be
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
(the same problem for Form2.resx).
What is interesting, VB forms are integrated into VB projects from a NuGet package without any problems, and this issue looks like a C#-specific NuGet issue.
Is there any way to solve this problem for C#?