resx bug(?)
-
I have a C# dialog app, and haven't realized until now that I want to translate it that some of the auto generated *.resx files aren't compiled into the output. (!) I haver verified the build type for them, I have looked into the .csproj file and found nothing unusual. I have also tried compiling the resx file with the resource compiler which worked right.:~ I would need help on this, or I can't proceed with my project. :zzz: Thanks in advance.
-
I have a C# dialog app, and haven't realized until now that I want to translate it that some of the auto generated *.resx files aren't compiled into the output. (!) I haver verified the build type for them, I have looked into the .csproj file and found nothing unusual. I have also tried compiling the resx file with the resource compiler which worked right.:~ I would need help on this, or I can't proceed with my project. :zzz: Thanks in advance.
Found the problem! (after several hours) The problem was that I had a namespace included in "the wrong place". Basically, I had a little util class in a different namespace in the dialog file. Therefore the compiled resource would be named after the util class, which was topmost in my source file. (!!) So to solve the problem, I only had to move this little bugger to the bottom of the .cs file. Ugly! design of Visual Studio I'd say.:mad:
-
Found the problem! (after several hours) The problem was that I had a namespace included in "the wrong place". Basically, I had a little util class in a different namespace in the dialog file. Therefore the compiled resource would be named after the util class, which was topmost in my source file. (!!) So to solve the problem, I only had to move this little bugger to the bottom of the .cs file. Ugly! design of Visual Studio I'd say.:mad:
It has nothing to do with VS.NET. If you instantiate a
ResourceManager
using the constructor that takes aType
, the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented. If you move classes or organize your files incorrectly in your project in VS.NET, this would be an issue that you've created.Microsoft MVP, Visual C# My Articles
-
It has nothing to do with VS.NET. If you instantiate a
ResourceManager
using the constructor that takes aType
, the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented. If you move classes or organize your files incorrectly in your project in VS.NET, this would be an issue that you've created.Microsoft MVP, Visual C# My Articles
Heath Stewart wrote: It has nothing to do with VS.NET. If you instantiate a ResourceManager using the constructor that takes a Type, the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented. IMO its VS.NET inserting namespaces et all into resource names that are "incorrect" behaviour. Adding a resource via command line will not prepend anything to the filename. top secret
-
Heath Stewart wrote: It has nothing to do with VS.NET. If you instantiate a ResourceManager using the constructor that takes a Type, the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented. IMO its VS.NET inserting namespaces et all into resource names that are "incorrect" behaviour. Adding a resource via command line will not prepend anything to the filename. top secret
Well, IMO its VS.NET doing what IDEs are typically for - making the life of coders easily. If you organize your projects into "folders", the default namespace of a source file uses that prepended with the default namespace configured in the project. If you add ResX files to that, the same thing happens, keeping with consistent behavior. This is especially important when adding ResX files to be scoped with the fully-qualified class name. If you don't want VS.NET doing things for you - or any IDE for that matter - use the command-line tools. I typically do when I need something quick and don't want VS.NET automating tasks such as this.
Microsoft MVP, Visual C# My Articles
-
Well, IMO its VS.NET doing what IDEs are typically for - making the life of coders easily. If you organize your projects into "folders", the default namespace of a source file uses that prepended with the default namespace configured in the project. If you add ResX files to that, the same thing happens, keeping with consistent behavior. This is especially important when adding ResX files to be scoped with the fully-qualified class name. If you don't want VS.NET doing things for you - or any IDE for that matter - use the command-line tools. I typically do when I need something quick and don't want VS.NET automating tasks such as this.
Microsoft MVP, Visual C# My Articles