Form and designer files not linking in Solution Explorer

I've seen the same problem in Visual Studio 2008. Usually after compiling or closing and re-opening the solution the problem would fix itself. In Visual Studio 2012 I know that I have problems if I try to Add > Existing Item and choose all three files. Typically you only want to add the top level form.cs and VS will automatically include the .designer.cs and .resx files.


Check the project (.csproj) file.

Inside the ItemGroup node, see if the .designer file is associated with the code-behind file. The XML should look something like this:

<Compile Include="FormPrompt.cs">
    <SubType>Form</SubType>
</Compile>
<Compile Include="FormPrompt.Designer.cs">
    <DependentUpon>FormPrompt.cs</DependentUpon>
</Compile>