Assign a namespace to a resource file in a Visual Basic project.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?RGljaw==?=

    Assign a namespace to a resource file in a Visual Basic project.

    Please can you tell me how to assign a namespace to a resource file in a
    Visual Basic project?

    In C# such resources file inherit their namespace based upon the folder
    hierarchy in which they are stored but in Visual Basic all such resources
    appear in the project's default namespace. This is fine when there are just a
    few resources but becomes cumbersome when there are lots.

  • Zhi-Xin Ye [MSFT]

    #2
    RE: Assign a namespace to a resource file in a Visual Basic project.

    Hi Dick,

    Thank you for using Microsoft Managed Newsgroup Service, my name is Zhi-Xin
    Ye, I'm assigned to help you on this issue.

    From your description, you mean VB.NET, right? If misunderstand you, please
    let me know.

    For VB.NET, it's a by design feature that all the global resource files
    will be assigned to My.Resources namespace. However, you can name the
    resources files in a manner that they're not corruptted.

    For example, you can create a file structure like this:

    --Resources
    - Res1
    + Res1_Resource1. resx
    + Res1_Resource2. resx
    + Res1_Resource3. resx
    - Res2
    + Res2_Resource1. resx
    + Res2_Resource2. resx
    - Res3
    + Res3_Resource1. resx
    + Res3_Resource2. resx
    + Res3_Resource3. resx

    If you have any problems or concerns, please feel free to let me know.

    Sincerely,
    Zhi-Xin Ye
    Microsoft Managed Newsgroup Support Team

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can

    improve the support we provide to you. Please feel free to let my manager
    know what you think of the level

    of service provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to

    http://msdn.microsoft.com/en-us/subs...#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the

    community or a Microsoft Support Engineer within 2 business day is
    acceptable. Please note that each follow

    up response may take approximately 2 business days as the support
    professional working with you may need

    further investigation to reach the most efficient resolution. The offering
    is not appropriate for situations

    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working

    with a dedicated Microsoft Support Engineer by contacting Microsoft
    Customer Support Services (CSS) at


    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.






    Comment

    • =?Utf-8?B?RGljaw==?=

      #3
      RE: Assign a namespace to a resource file in a Visual Basic projec

      OK, by "design feature" I guess you mean "design flaw". I bet if I suggested
      you dropped class namespaces and named all your classes in such a way you'd
      think I was mad. In any case, you've answered my question and I'll therefore
      stop looking for a way to do it, so thanks for that. Cheers.

      "Zhi-Xin Ye [MSFT]" wrote:
      Hi Dick,
      >
      Thank you for using Microsoft Managed Newsgroup Service, my name is Zhi-Xin
      Ye, I'm assigned to help you on this issue.
      >
      From your description, you mean VB.NET, right? If misunderstand you, please
      let me know.
      >
      For VB.NET, it's a by design feature that all the global resource files
      will be assigned to My.Resources namespace. However, you can name the
      resources files in a manner that they're not corruptted.
      >
      For example, you can create a file structure like this:
      >
      --Resources
      - Res1
      + Res1_Resource1. resx
      + Res1_Resource2. resx
      + Res1_Resource3. resx
      - Res2
      + Res2_Resource1. resx
      + Res2_Resource2. resx
      - Res3
      + Res3_Resource1. resx
      + Res3_Resource2. resx
      + Res3_Resource3. resx
      >
      If you have any problems or concerns, please feel free to let me know.
      >
      Sincerely,
      Zhi-Xin Ye
      Microsoft Managed Newsgroup Support Team
      >
      Delighting our customers is our #1 priority. We welcome your comments and
      suggestions about how we can
      >
      improve the support we provide to you. Please feel free to let my manager
      know what you think of the level
      >
      of service provided. You can send feedback directly to my manager at:
      msdnmg@microsof t.com.
      >
      =============== =============== =============== =====
      Get notification to my posts through email? Please refer to
      >
      http://msdn.microsoft.com/en-us/subs...#notifications.
      >
      Note: MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the
      >
      community or a Microsoft Support Engineer within 2 business day is
      acceptable. Please note that each follow
      >
      up response may take approximately 2 business days as the support
      professional working with you may need
      >
      further investigation to reach the most efficient resolution. The offering
      is not appropriate for situations
      >
      that require urgent, real-time or phone-based interactions. Issues of this
      nature are best handled working
      >
      with a dedicated Microsoft Support Engineer by contacting Microsoft
      Customer Support Services (CSS) at
      >

      =============== =============== =============== =====
      This posting is provided "AS IS" with no warranties, and confers no rights.
      >
      >
      >
      >
      >
      >
      >

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Assign a namespace to a resource file in a Visual Basic projec

        "Dick" <Dick@nospam.no spamschrieb:
        OK, by "design feature" I guess you mean "design flaw". I bet if I
        suggested
        you dropped class namespaces and named all your classes in such a way
        you'd
        think I was mad. In any case, you've answered my question and I'll
        therefore
        stop looking for a way to do it, so thanks for that.
        In VB the namespace a resource file belongs to fortunately isn't tied to the
        physical folder structure. Instead, you can specify the target namespace by
        selecting the resource file and assigning the desired target namespace to
        its "Namespace of the user-defined tool" (translated from the German version
        of VS 2008) property in the properties window.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

        Comment

        • Zhi-Xin Ye [MSFT]

          #5
          RE: Assign a namespace to a resource file in a Visual Basic projec

          Hi Dick,

          I'm sorry for the misleading.
          Herfried is right. You can change the "Custom Tool Namespace" property for
          the resource file to change its namespace.

          Sincerely,
          Zhi-Xin Ye
          Microsoft Managed Newsgroup Support Team

          Delighting our customers is our #1 priority. We welcome your comments and
          suggestions about how we can

          improve the support we provide to you. Please feel free to let my manager
          know what you think of the level

          of service provided. You can send feedback directly to my manager at:
          msdnmg@microsof t.com.

          This posting is provided "AS IS" with no warranties, and confers no rights.

          Comment

          • =?Utf-8?B?RGljaw==?=

            #6
            RE: Assign a namespace to a resource file in a Visual Basic projec

            Yup agreed, you can set this property, and of course I looked at this right
            at the beginning of my research, but unless I'm mistaken, this doesn't apply
            a namespace to the resource. Instead it simply saves a namespace to be used
            later by a custom tool, but I don't think the compiler is a custom tool and
            hence doesn't use the it. Perhaps you could demonstate it being used?

            "Zhi-Xin Ye [MSFT]" wrote:
            Hi Dick,
            >
            I'm sorry for the misleading.
            Herfried is right. You can change the "Custom Tool Namespace" property for
            the resource file to change its namespace.
            >
            Sincerely,
            Zhi-Xin Ye
            Microsoft Managed Newsgroup Support Team
            >
            Delighting our customers is our #1 priority. We welcome your comments and
            suggestions about how we can
            >
            improve the support we provide to you. Please feel free to let my manager
            know what you think of the level
            >
            of service provided. You can send feedback directly to my manager at:
            msdnmg@microsof t.com.
            >
            This posting is provided "AS IS" with no warranties, and confers no rights.
            >
            >

            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: Assign a namespace to a resource file in a Visual Basic projec

              "Dick" <Dick@nospam.no spamschrieb:
              Yup agreed, you can set this property, and of course I looked at this
              right
              at the beginning of my research, but unless I'm mistaken, this doesn't
              apply
              a namespace to the resource. Instead it simply saves a namespace to be
              used
              later by a custom tool, but I don't think the compiler is a custom tool
              and
              hence doesn't use the it. Perhaps you could demonstate it being used?
              I have tested it here in VS 2008 and it works automatically. Just take a
              look at the namespaces and classes in object browser. The program
              transforming the ResX files will emit the desired namespace based on the
              property's value.

              --
              M S Herfried K. Wagner
              M V P <URL:http://dotnet.mvps.org/>
              V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

              Comment

              Working...