DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  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
    >




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links