Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# change framework error

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?

like image 925
toosweetnitemare Avatar asked May 13 '11 15:05

toosweetnitemare


3 Answers

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

like image 68
stuartd Avatar answered Sep 19 '22 20:09

stuartd


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 to 0yLjAuMC4w at the end of the line (00 back to 0y)

But I have to fix that every time I change something in that form.

like image 30
R. Martinho Fernandes Avatar answered Sep 19 '22 20:09

R. Martinho Fernandes


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.

like image 41
Jeff Avatar answered Sep 19 '22 20:09

Jeff