getting CS1566 (Error reading resource file) when adding a resource in VS2008


  • I can compile projects without a resource without any problems, but as soon as i add a resource or create a new project which includes a resource file (e.g. windows Forms application) i get a

    Error reading resource file 'K:\TestProject\' -- 'Das System kann den angegebenen Pfad nicht finden. '

    (translation: 'The system cannot find the file specified.'). But as i look into the project folder there are Resource1.resx and Resource1.Designer.cs so they are there...

    the Error help tells me, its the Compiler Error CS1566

    After deleting the resource file I dont get the error anymore...

    Other files, like Classes or windows forms don't make any trouble.

    Any Ideas about what the problem is or how to solve it?

    Thanks for your help!

    PS: I'm still a beginner so that could be any very trivial problem.

    Wednesday, June 23, 2010 7:33 AM

All replies

  • Welcome to the MSDN Forums.

    Maybe it doesn't mean the resource file itself but a file which have been mentioned in it and doesn't exist currently.

    Please verify this. Thank you.



    Walkthrough: Displaying multi column ComboBox by using Windows Presentation Foundation (WPF) data templating
    Wednesday, June 23, 2010 7:48 AM
  • In my test application there is emty Main method and an empty resource file.

    I also tried adding some resources.

    IntelliSense finds the resource file and the content (as i added some)

    The problem seems to be in the "Resources" parameter or deeper. It gets empty strings only instead of the needed file names. It is not the tab in the Project's Properties called "Resources".
    This is the reason why the /resource: command of the compiler gets no resource file and handles the folder itself as a resource file... Cannot work :(

    Has anyone got an idea where to look at this "Resources" parameter or how to change it or why it is empty...


    Wednesday, June 23, 2010 8:13 AM
  • Taking a look at the csproj file everything looks fine:

    <Compile Include="Resource1.Designer.cs">


        <EmbeddedResource Include="Resource1.resx">

    Thursday, June 24, 2010 12:11 PM
  • Hi Metapsychologe,

       Welcome to MSDN forums! I'm glad to see your active participation and discussion in MSDN forums.Based on my understanding your issue was wanted to access Resources files. If it's true I suggest you use class ResourceManager. It in the namespace System.Resources.  Please refer to

    http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx ,


    get more details about ResourceManager.

      Hope this will help you!  

       If you still have any doubt and concern about this issue, please let me know. If I misunderstood you, please kindly elaborate your question.

    Please Mark as Answered If this is helpful Or Un-Mark as Answered if it is not helpful.

    Best Regards,
    Yan Jun
    Microsoft Online Community Support

    Tuesday, June 29, 2010 9:36 AM
  • Thanks for your reply! But its not exactly what i mentioned

    I have to create a foo.resx (in VS2008 Solution Explorer -> ProjectName -> right click -> add -> new item -> Resources File). Then i can edit the resouce file. After this i have to use the windows command prompt, go to the folder and execute 'resgen foo.resx'. This creates the foo.resources file. Back to VS2008 I delete the foo.resx and add foo.resources.

    But shouldn't it work without me creating the foo.resources file manually?

    If i don't convert it manually, I can see the compiler arguments on Output -> Build screen:

    c:\WINNT\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\Error.exe /resource: /target:exe Program.cs Properties\AssemblyInfo.cs Resource.Designer.cs

    And he tells what the problem is:

    error CS1566: Error reading resource file 'K:\ResourceFileFehler\Error\' -- 'Das System kann den angegebenen Pfad nicht finden. '

    Its the emtpy /resource: Argument, so it searches the folder itself as the resource file (Resource file would be "'K:\ResourceFileFehler\Error\Resource.resx") Its the same if I create the resx file in a sub folder (again K:\ResourceFileFehler\Error\ instead of K:\ResourceFileFehler\Error\subfolder\Resource.resx"). With a second resx it even says there are 2 resources with the name "".

    Is there any setting that could prevent the program from giving the path of the resource files to the compiler?

    Thursday, July 15, 2010 1:29 PM