Search code examples
vb.netwinformsresx

In a VB project, is it possible to have a resx file with the same name than a form?


Good Morning,

I'm working in a VB project (usually I work mostly on C#) and there is an issue at the compilation that I don't understand:

In my VB project I have a Windows Form (with its own Designer.vb and .resx) and a Resources file (with its Designer.vb), both have the same name, and it seems that it produce the following compilation error:

Error 13 The item "obj\Debug[projectName].[fileName].resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

I can't change the name of one of them as it's an internal design pattern (and it works in C# projects).

Doesn't VB accept such pattern ? If yes, are there any workaround possible ? Or do I have something wrong in one of my project files ?

Regards

Edit: As my problem may not be very clear, here is the pattern I have to respect in this project :

enter image description here
This doesn't compile. In VB only as I'm using this pattern in C# projects without any issues.


Solution

  • Finally I found where the problem was:
    It was an issue with namespaces, as VB generated in VisualStudio doesn't provide any namespace by default in WinForms, ones I gave a namespace to the form and the designer of the form, and gave a different namespace to the second resx (via it's properties/Custom Tool Namespace) it compile.