I am running Visual Studio 2010. I just change the frame work of my project from 4.0 to 3.5. I removed the reference Microsoft.Framework that it asked me to remove then tried to compile. I now get the error:
Error 1 Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Line 123, position 5. C:\Users\\Documents\Visual Studio 2010\Projects\\\Properties\Resources.resx 123 5
I know that it is referring to code in my resources.resx file:
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pix-300x300" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\pix-300x300.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pix2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\pix2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pix4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\pix4.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pix3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\pix3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
How would i correct this now that my framework is 3.5?
You can try regenerating the file by right-clicking the .resx file and choosing 'Run Custom Tool' from the context menu.
Edit: before you do this, change the Access Modifier or add a new value to force a regeneration.
Another edit: See Downgrade an application from .net 4.0 to 3.5 for another possibility
I ran into a Visual Studio bug that caused me a similar problem. I used this workaround to solve it:
A fix that SEEMS to work is to manually alter one character in the image stream EVERY TIME the usercontrol or form is edited in the designer
<data name="icons_20.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> <value> AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
Change to
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
That is
00LjAuMC4w
back to0yLjAuMC4w
at the end of the line (00
back to0y
)
But I have to fix that every time I change something in that form.
Not sure about this, but since the other answers didn't help, try this. The Version=4.0.0.0
in your file is telling the compiler to use .net 4.0 assemblies. Try changing them to Version=3.5.0.0
or Version=2.0.0.0
and see if that solves it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With