View previous topic :: View next topic |
Anyone else modify the default namespace given for classes in subdirectories? |
Yes |
|
0% |
[ 0 ] |
No |
|
0% |
[ 0 ] |
Huh? |
|
0% |
[ 0 ] |
|
Total Votes : 0 |
|
Author |
Message |
TomClement
Joined: 22 Oct 2009 Posts: 8
|
Posted: Thu Oct 22, 2009 11:59 pm Post subject: Problem with subdirectories in the Visual Studio tree |
|
|
Hi,
To organize our controls and forms in our very large solution, we created subdirectories under each project with names like' "Controls",
"Forms", "Editors", or "Utilities" etc. Since all these files are in fact in the same namespace (let's say Serena.Framework), we've changed the default namespaces given to them from (e.g.) Serena.Framework.Controls to Serena.Framework. When I try to preview a form, I get an error E205, saying, for example:
"E205: Unable to locate the type (Serena.Framework.Controls.MyControl) in the compiled assembly Serena.Framework. Check that the Resx Resource Name matches the fully qualified type name of the associated control."
So apparently, unlike Visual Studio, Globalizer.NET makes the assumption that the namespace of an item corresponds to the project name and directory structure. Is there any way to correct this problem?
Currently, I have an in-house developed (i.e. I wrote it) utility that does some of what Globalizer.NET does, and I was really hoping I could dump it in favor of your product. To resolve the corresponding problem in that code, I parsed the corresponding .cs file to obtain the namespace of the file and that seemed to do the trick. Any chance you're considering a modification of your product to do the same? Without a workaround that doesn't involve changing hundreds of files in our solution, I don't think I'll be able to use it.
Thanks for your help.
Tom Clement[/code] |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Oct 23, 2009 7:28 am Post subject: |
|
|
Globalizer.NET determines the default resource name based on the default namespace for the project and the folder. This is the same as what Visual Studio will do by default when you add a new control to a sub-folder. This will by default set the namespace to include the folder name. To change this you have to modify the generated code in the designer as well as the control/form code.
It's OK to do this (as you have) but then Globalizer won't get the resource name right by default. You can however open the properties tab in Globalizer.NET, select the control target then change the Resource Name to remove the folder name. I realise that if you have a lot of controls this could be a bit of a pain - but you only need to do it once. Given that Globalizer.NET stores the workspace data in plain text XML file you could do this much quicker using a text editor and search and replace.
We will also consider your suggestion of parsing the file for the namespace - but if you need a quick solution I would suggest the above. _________________ Infralution Support |
|
Back to top |
|
|
TomClement
Joined: 22 Oct 2009 Posts: 8
|
Posted: Fri Oct 23, 2009 3:18 pm Post subject: |
|
|
Thanks for the quick reply. Yep it will be a pain, but it's great that you have a way around this one.
Tom |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Dec 01, 2009 5:42 am Post subject: |
|
|
Version 2.0.4 of Globalizer.NET has just been released and includes a fix for this issue. When scanning adding new resources for C# forms and controls to a project Globalizer.NET now checks the associated code file to determine the default resource name. _________________ Infralution Support |
|
Back to top |
|
|
|