4

I m getting this error :

error CS1566: Error reading resource file 'V:\Software\Applications\xx\xx\xx\obj\x86\Release\xx.Form1.resources' -- 'The system cannot find the file specified. '

The problem started when the Visual studio was open and the pc restarted, and somehow the csproj got corrupted. I did another new solution and replaced the file, and also added the links

Rahul
  • 5,603
  • 6
  • 34
  • 57
user2029200
  • 93
  • 1
  • 1
  • 10
  • Does that form open up in the Visual Studio designer without any issues? – Arran Jun 03 '13 at 12:19
  • You could open the csproj file and edit it for a fix, it's a xml file. Or is that what you meant by having added the links? – Geeky Guy Jun 03 '13 at 12:20
  • I think you used the wrong path when you were replacing the form's resources. The `.resources` file should be in the same folder as the corresponding `Form.cs` file. – Matthew Watson Jun 03 '13 at 12:20
  • Is V:\ a local hard drive? I would expect to see a problem like this if V: is a mapped network drive to a computer that is offline. – VeeTheSecond Jun 03 '13 at 12:21
  • @Arran: before modifying the csproj, the solution could not be opened, now at least I can open an include again the files in the projects – user2029200 Jun 03 '13 at 12:22
  • @Matthew: I did not moved anything, except the csproj file from a newly created dummy solution to the original solution. I saw this in another post. http://stackoverflow.com/questions/11171322/how-can-i-recover-a-corrupt-csproj-file-in-visual-studio-2010 – user2029200 Jun 03 '13 at 12:23
  • @VeeTheSecond: it is on a server yes, but it is always online, since Im doing other stuff on it – user2029200 Jun 03 '13 at 12:25
  • I have a similar problem, in my case VS is generating an extra corrupt /resources parameter in the CSC command. I don't have a solution, but I've posted the details here: http://stackoverflow.com/questions/17750270/error-reading-resource-file-for-any-wpf-project-in-vs2012 – Jeff Jul 19 '13 at 15:48

5 Answers5

7

Probably you created a file. After that you deleted it. and the *.csproj file didn't update automatically. Sometimes, the file name cannot delete from *.csproj file. Actually, when you deleted the file, *.csproj file has to be updated.

The solution is: Open your *.csproj file and delete related file name. After deleting "Form1" name from your *.csproj, your solution will be built

Mahmut EFE
  • 5,137
  • 5
  • 46
  • 56
1

For me it was a matter of deleting these of *.csproj of <None Remove> tag:

<ItemGroup>
    <None Remove="myfile.json" />
</ItemGroup>

And keep only the <EmbeddedResource > tag only.

<ItemGroup>
    <EmbeddedResource Include="Settings\myfile.json" />
</ItemGroup>
0

You can set property "Copy to Output Directory" to "Copy always"

Copy to Output Directory Property

This property specifies the conditions under which the selected source file will be copied to the output directory. Select Do not copy if the file is never to be copied to the output directory. Select Copy always if the file is always to be copied to the output directory.

MSDN article

Community
  • 1
  • 1
LaoR
  • 1,278
  • 1
  • 10
  • 19
0

I had this exact same problem. I was working in the Debug Solution configuration at the time and my file was missing in the ...obj\x86\Debug folder.

What I did to get it running was to change the configuration to Released, then try to build the solution. Then I copied the Form1.resources file from the ...obj\x86\Release folder into the ...obj\x86\Debug folder.

BLong
  • 69
  • 4
0

Try cleaning the solution. Also sometimes you need to get rid of other errors before this error clears.

Philip
  • 638
  • 1
  • 8
  • 22