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
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.
Your problem is that you have one Form
named ErrSer
and one resource file named ErrSer
with a custom tool set. There are only two conditions comes to my mind for this case to happen
You have a form and you accidentally set Custom Tool property on that file, so even if you do not need it to be generated and a ErrSer.Designer.cs file is generated for your resources.
You have a form and you have created a ResX with same name.
For the first case just remove Custom Tool property on ResX file and generated Designer file. For the second case, rename your ResX file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With