How do you set the namespace for a form's resources in VS2005?

How do you set the namespace for a form's resources

I cleared out the root namespace setting in the project. I added the namespace to the source code in both form.vb and form.designer.vb. Then I added an icon to the form using the designer.

When the project is compiled, the namespace is applied to the form but not the resources. When I run the project, I get this error:

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. ...



Answer this question

How do you set the namespace for a form's resources in VS2005?

  • Carl Grainger

    Moving this thread into the IDE forum.

  • Avi29

    You need to make a project ;level reference to the assembly...

    Main Menu....Project....Add Reference

    And then from the top of the forms code file use an imports statement:(example)

    Imports System.IO



  • hanozo

    Yes, you're right. I had a VB keyword in my namespace. It looks like the compiler has a very serious bug in it where if you have a keyword in the form's namespace, the project builds without error but the resources do not have the correct namespace on them.

    I found that if I bracket the keywords in the namespace statement, the compiler works correctly.


  • Mark B .

    Hi, I'd like to understand this problem better so we can investigate it. I can repro a problem if you put a form in a non-default namespace (e.g. you place "Namespace Foo" before and after the form definition in Form1.vb and Form1.Designer.vb), and if that form contains local resources (it's localizable, or it contains an icon or other resources which are actually stored in a Form1.resx file). I have reported this problem internally; we'll investigate and see if there's a fix we can consider for a future release.

    But you also mentioned a problem with keywords in the namespace. Is there a problem with keywords in namespaces that isn't caused by a form being in a non-default namespace I haven't found such a problem yet, so if you know of one, could you please explain how to reproduce it

    If you would like to receive notifcation of the status of this bug, I suggest you enter it at http://connect.microsoft.com. Thanks for bringing this problem to our attention.

    Stephen



  • pkr2000

    Yes, you're right. I had a VB keyword in my namespace. It looks like the compiler will not put the correct namespace on the resources if it encounters a VB keyword in a form's namespace. It builds without error, but the resources are not correct.

    I found that if I add brackets around the keyword in the namespace statement, the compiler works correctly.


  • Will Merydith

    Does the test application refere to any other libraries, I don't think it does. Hopefully this experiment is done in a controled manor and is self contained Even if it did refere to other libraries what about loading dynamically, thus you never have project references, only file level at best.

    I think the probelm is your use of Shared in the name space. Shared is a reserved word, and should be replaced with a suitable synonym like Partake.

    Has any one seen a correlation to the number of nodes in the namespace to this error, like it works with

    namespace Fun

    but not with

    namespace Fun.House

    KoolAide


  • How do you set the namespace for a form's resources in VS2005?