none
ResourceReader, resource not found

    Question

  • I have some resource files, set to Embedded Resource, and Custom Tool of ResXFileCodeGenerator.  The ".resources" files are being created automatically into the UI project directory\obj\debug\, and the satellite dll is being generated in ""\en-US\ directory.

    However, when I use the code to read the resource with the ResourceReader() class, it returns an error saying it cannot find the resource in startup app shell project\bin\debug\ directory.

    I don't want to specify the full path to read the resource, because the click once deployment path will be different then my local development tfs path. 

    I want the ResourceReader() class to know where to look on it's own.  I thought when .net uses the custom tool to build the .resources files/satellite assembly, you could access those resources natively without any special config.

    Thanks for any expertise you might offer,

    John

    Thursday, August 10, 2006 5:09 PM

All replies

  •  

    If you want to specify the path dynamically to the application.

    Application.StartupPath

    This might help you load the resources without having to worry about static paths.

    Can I also ask a quick question which version of .NET are we working in ?

    James

     

    Friday, August 11, 2006 6:37 AM
  • The solution I ended up with was to move the project files to the shell project, changed the build action from Embedded Resource to Content, and set it to Copy Always.  Then to get the path, I used

    AppDomain.CurrentDomain.BaseDirectory

    I read that resx files provided a static class I could access when using the ResXFileCodeGenerator custom tool, and for some reason all though it created that codebehind class, it was always empty.  Even though I also tried right clicking on it and clicking Run Custom Tool.  So I never could get access to static properties with something like Resources.MyResxClass.property.

    Anyhow, using .net 2.0.

    Thanks,

    John

    Monday, August 14, 2006 1:45 PM