简体   繁体   中英

Could not load System.Drawing V4.0.0.0 on a VB.Net Windows form in Visual Studio 2010

I've decided to learn Visual Basic .Net as this is what some of my colleagues work with, and this will allow me to work with them on projects.

I have purchased Microsoft Visual Basic 2010 Step by Step and downloaded the sample files. When I am trying to debug the first sample application (a Windows form), it is telling me that it can't load System.Drawing V4.0.0.0. However, if I create a new Windows Form application (C# or VB.Net) this works fine.

I had a look at the References tab in the project settings and System.Windows.Forms is referenced, but the version referenced is 2.0.0.0. I have removed and re-added this reference and it stays at 2.0.0.0 and I still get the error.

Does anybody have any ideas as to what may be going on?

I am using Visual Studio 2010 Professional.

Thanks

This is because of a discrepancy in the target framework. v4.0.0.0 is targeting .NET framework v4.0 - v2.0.0.0 is targeting .NET framework v2.0. You can change the framework target for your project in

Project -> 
   (myProject) Properties... -> 
      Compile -> 
         Advanced Compile Options -> 
            Target Framework...

不要以.Net 4.0客户端为目标,以.Net 4.0 FULL框架为目标

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM