C#变化框架错误框架、错误

2023-09-05 22:59:52 作者:半夏半微凉

我正在运行Visual Studio 2010的。 我只是我的项目的框架工作变动,从4.0到3.5。我删除了参考Microsoft.Framework,它要求我删除,然后试着编译。我现在得到的错误:

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:

错误1未能加载文件或   集'System.Drawing中,   版本= 4.0.0.0,文化=中立,   公钥= b03f5f7f11d50a3a或   它的一个依赖。系统   找不到指定的文件。线   123,位置   5. C:\用户\\的文档\ Visual Studio中   2010 \项目\\\属性\ Resources.resx 123 5

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

我知道,它是指code在我resources.resx文件:

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>

如何,我会纠正这个,现在我的框架是3.5?

How would i correct this now that my framework is 3.5?

推荐答案

您可以尝试通过重新生成文件,用鼠标右键单击该.resx文件,然后从上下文菜单中选择运行自定义工具。

You can try regenerating the file by right-clicking the .resx file and choosing 'Run Custom Tool' from the context menu.

编辑:你这样做之前,更改访问修饰符或添加一个新值来强制再生

before you do this, change the Access Modifier or add a new value to force a regeneration.

另一个编辑:见Downgrade从.NET 4.0的应用程序,以3.5 以另一种可能性

Another edit: See Downgrade an application from .net 4.0 to 3.5 for another possibility