Missing partial modifier on declaration of type 'x' - cause by auto-generated code by designer

c#, declare, partial, winforms

Solution

You (accidentally) have set the "Custom Tool" property for "ErrSer.resx" file to "ResXFileCodeGenerator". So Visual Studio generates a redundant source file for that file.

To solve the problem, open Solution explorer, then in "FormFile" folder expand "ErrSer.cs" node. Right-click the "ErrSer.resx" file and select "Properties". In the properties window clear the value of "Custom Tool" property:

Clear the specified value then build the project.

Problem

The full error description is as per below: And I found a few similar question posted before: A and B But the question in A and B does not provide detail of problem description (perhaps we prompted the same error message but caused by different reason? I am not sure..). Any how, answer in A and B does not have good solution. So I decided to post the similar question with some more details. My problem is as per below: The Designer auto generate a new code (ErrSer1.Designer) which contain the same partial class name in (ErrSer.Designer). [Shown in printScreen_1 -> line 25 ] The difference as we can see is, one is in ErrSer1.Designer (the extra auto generated one) internal class ErrSer Another one is in ErrSer.Designer (the original one who suppose to be) partial class ErrSer Here is the printScreen_1 to show ErrSer1.Designer (the extra auto-generated one) [ Notice line 25 ] And here is the printScreen_2 to show ErrSer.Designer (the original and usual one) [ Notice line 3 ] Lastly... what can I do to solve this annoying auto-generated code problem? EDIT1: My ErrSer Form declared like this ``` public partial class ErrSer : Form ``` EDIT2: My .csproj file My .csproj file location

Original source

Related problems