locked
Resource Full File Path RRS feed

  • Question

  • How does one reference the full (file) path of a resource that is either Managed (part of a .resx file) or Embedded?  "Full Path" is listed under File Properties when you click on it in the Solution Explorer, there must be some way to reference this value in code.

    Wednesday, June 17, 2009 3:44 PM

Answers

  • I believe that information is for the compiler for when it builds the assembly it knows where to get the file that will be copied or embedded. That info is probably lost once the assembly is already compiled.
    I always try to Keep it Sharp & simple.
    • Proposed as answer by David M Morton Wednesday, June 17, 2009 3:50 PM
    • Marked as answer by d_troyer Wednesday, June 17, 2009 3:54 PM
    • Edited by Fernando Nicolet Thursday, June 18, 2009 1:56 PM typos
    Wednesday, June 17, 2009 3:49 PM

All replies

  • I should mention that I have tried looking around Assembly.GetManifestResourceInfo(...) to no avail.
    Wednesday, June 17, 2009 3:45 PM
  • I believe that information is for the compiler for when it builds the assembly it knows where to get the file that will be copied or embedded. That info is probably lost once the assembly is already compiled.
    I always try to Keep it Sharp & simple.
    • Proposed as answer by David M Morton Wednesday, June 17, 2009 3:50 PM
    • Marked as answer by d_troyer Wednesday, June 17, 2009 3:54 PM
    • Edited by Fernando Nicolet Thursday, June 18, 2009 1:56 PM typos
    Wednesday, June 17, 2009 3:49 PM
  • I believe than information if for the compiler for when it biulds the assembly it know where to get the file that will be copied or embedded. That info is probably lost once the assembly is already compiled.
    I always try to Keep it Sharp & simple.

    Makes sense.  Do you understand what I'm trying to do?  I need the full path and I don't want to have to update a string constant everytime the project is moved.  Any ideas?
    Wednesday, June 17, 2009 3:59 PM
  • I believe than information if for the compiler for when it biulds the assembly it know where to get the file that will be copied or embedded. That info is probably lost once the assembly is already compiled.
    I always try to Keep it Sharp & simple.

    Makes sense.  Do you understand what I'm trying to do?  I need the full path and I don't want to have to update a string constant everytime the project is moved.  Any ideas?

    If it's an embedded resource, there's no need to change the string path.  You don't use the path. 

    <AppName>.Properties.Resources.NameOfResource

    That's how you would refer to it in code, of course, replacing the <AppName> with the name of the assembly containing the resources.
    David Morton - http://blog.davemorton.net/ - @davidmmorton - ForumsBrowser, a WPF Forums Client
    Wednesday, June 17, 2009 4:00 PM