Multiple identical named Resource-Files in a VB.NET project
Related: What could cause Visual Studio / C# error MSB3105: Duplicate resources
I'd like to have multiple identical named resource files in my project, all separated via the Namespace. The following setup:
Project
- Namespace1 [also a Folder]
- MyResourceFile.resx
- Namespace2.SubNamespace1 [two folders]
- MyResourceFile.resx
This is easily possible by setting Namespace
-property of the resource开发者_StackOverflow files to the correct namespaces. Unfortunately this will bring the compiler to a halt:
The item obj\x86\Debug\Project.MyResourceFile.resx was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
As it seems, Resource-Files are compiled into a file called ProjectNameSpace.Filename.resx
, which is a problem if you want to have multiple identical named resource files in different namespaces.
Does somebody know how I can change that behavior?
The reason why I want this is because I want to store SQl-Statements in resource files. The datalayer of my application is hidden behind interfaces which allow multiple implementations, therefor I thought of the following structure:
Project
- ModuleNamespace
- IData.vb
- Datas
- MySQL
- Data.vb (Implementation of IData)
- Queries.resx
- SQLite
- Data.vb
- Queries.resx
- and so on...
I would have added those queries to a simple class-file and used that, but in that Project I'm using VB.NET...which adds a little pain to have a string span multiple lines...
精彩评论