title: .NET: Resgen Tutorial
body: <p>First off I have <a href="http://msdn.microsoft.com/en-us/library/ccec7sz1(VS.80).aspx" rel="nofollow noreferrer">RFM</a> and <a href="http://msdn.microsoft.com/en-us/library/aa309367(v=VS.71).aspx" rel="nofollow noreferrer">RFM</a> and I have tried to follow a few sites but I cannot grasp the concept of the Resource Manager.</p>
  
  <p>Can someone please explain to me how to generate a resource manager similar to that of the VS IDE.</p>
  
  <p>For example if I compile with VBC from the commandline I can see all my resource files.</p>
  
  <blockquote>
    <p>vbc /t:exe myfile.vb /res:res1 /res:res2</p>
  </blockquote>
  
  <pre><code>Dim a as Assembly = Assembly.GetExecutingAssembly()
  For Each i as string in a.GetManifestResourceNames()
      Console.writeline(i)
  Next i
  </code></pre>
  
  <blockquote>
    <p>res1</p>
    
    <p>res2</p>
  </blockquote>
  
  <p>If I compile with the VS IDE I only see:</p>
  
  <blockquote>
    <p>myprogram.Resources.resource</p>
  </blockquote>
  
  <p>How do I create a resource manager manually from the command line so that I can use the resource manager like I would with the VS IDE?</p>
  
  <pre><code>Dim CurrentResourceManager As New ResourceManager(_
  "myprogram.Resources", CurrentAssembly)
  Dim CurrentResourceSet As ResourceSet = CurrentResourceManager.GetResourceSet( _
  CultureInfo.CurrentCulture, True, True)
  </code></pre>
  
  <p>When I do try to use resgen it complains about my file extention</p>
  
  <blockquote>
    <p>C:...>resgen image.bmp myfile.Resource.resource source</p>
    
    <p>ResGen : error RG0000: The file named "image.bmp" does not have a known extension.  Managed resource files must end in .ResX, .txt, or .resources.</p>
  </blockquote>
  
  <p>In the Manual it states to use <a href="http://msdn.microsoft.com/en-us/library/aa309388(v=VS.71).aspx" rel="nofollow noreferrer">RESXGEN</a> for images, but I do not believe that is available in VS2008. I am stuck.</p>
  
  <p>Update: Found this : <a href="http://msdn.microsoft.com/en-us/library/ekyft91f(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ekyft91f(VS.80).aspx</a> 
  Explains how to write a ResX file. Seems like a repeatable process. I am not sure why they would not include a utility with visual studio to create it.</p>
  
  <p>I attempted to use the example of the ResourceWriter. Resgen puked upon using the MS Provided ResourceWriter Class.</p>