Resource file not linked to the assembly error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Resource file not linked to the assembly error

  1. #1
    Sash Guest

    Resource file not linked to the assembly error


    Hi,

    I created a C# class library and added a .resx file. When I tried to access
    the values in the resource file, after compiling it I get the following error.
    It looks like the resource file is not linked to the assembly. What am I
    missing?

    Error:
    An unhandled exception of type 'System.Resources.MissingManifestResourceException'
    occurred in mscorlib.dll

    Additional information: Could not find any resources appropriate for the
    specified culture (or the neutral culture) in the given assembly. Make sure
    "Testapp.resources" was correctly embedded or linked into assembly "Testapp".
    baseName: Testapp locationInfo: <null> resource file name: Testapp.resources
    assembly: Testapp, Version=1.0.755.20778, Culture=neutral, PublicKeyToken=e79471838db4c67b

    Thanks in advance.

    Sash


  2. #2
    Phil Wright Guest

    Re: Resource file not linked to the assembly error

    You have to ensure the generated .resource filename includes the full
    namespace.

    So if your code is...

    namespace Test
    {
    class XXX
    {
    public XXX()
    {
    ResourceManager rm = new ResourceManager(typeof(XXX));

    Bitmap bm = (Bitmap)rm.GetObject("MyBitmap");
    }
    }
    }

    then your resx file which has a name of XXX.resx needs to called
    Test.XXX.resources when placed inside the assembly. So...

    resgen XXX.resx Test.XXX.resources

    ... then place Test.XXX.resources into the assembly.


    "Sash" <sashgeorge@yahoo.com> wrote in message news:3c51fa4d$1@10.1.10.29...
    >
    > Hi,
    >
    > I created a C# class library and added a .resx file. When I tried to

    access
    > the values in the resource file, after compiling it I get the following

    error.
    > It looks like the resource file is not linked to the assembly. What am I
    > missing?
    >
    > Error:
    > An unhandled exception of type

    'System.Resources.MissingManifestResourceException'
    > occurred in mscorlib.dll
    >
    > Additional information: Could not find any resources appropriate for the
    > specified culture (or the neutral culture) in the given assembly. Make

    sure
    > "Testapp.resources" was correctly embedded or linked into assembly

    "Testapp".
    > baseName: Testapp locationInfo: <null> resource file name:

    Testapp.resources
    > assembly: Testapp, Version=1.0.755.20778, Culture=neutral,

    PublicKeyToken=e79471838db4c67b
    >
    > Thanks in advance.
    >
    > Sash
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center