Compiler Issue in Windows 7: A generic error occurred in GDI+

后端 未结 6 1297
一个人的身影
一个人的身影 2021-01-16 04:10

We have an application that we need to begin testing and developing in Windows 7 environment. It works fine compiling under WinXP in VS2008, no problems. However when I went

相关标签:
6条回答
  • 2021-01-16 04:39

    Delete the resources from the resource manager (right click on each and delete) then add them back. for me it solve the problem.

    0 讨论(0)
  • 2021-01-16 04:43

    After hours of troubleshooting, I opened and built the project using the VS 2010 command line prompt using MSBUILD "my solution file path here". This provided a more visible sequence of build events, and I found my project was failing just after it compiled form 16. The forms compiling appeared to be going in order of the objects in the solution explorer. So I checked the next form and found it contained a picture box. I also checked the form after that one and found I could not open the designer without errors(object reference not set to instance of object). So apparently, the problem was now two-fold.

    To resolve I had to remove the picture box object from the first form I identified as problematic (it was not being used any way) as it appeared to be corrupted. I found the second form with the null reference exception was using a user control. The code for the constructor of the user control was attempting to pass an object to a container before calling InitializeComponent(). This created the null reference since the container hadn't event been created in InitializeComponent when the problematic code was called.

    After resolving the issues in the above paragraph my solution compiled under Windows 7.

    0 讨论(0)
  • 2021-01-16 04:48

    Do you use TIFF images in your app?

    Some time ago, I also had a problem with TIFF images as part of reports that wouldn't compile under Win7 x64 although it compiled like a charm under Vista x86. The error message also involved GDI+. I saved the images under a different format (PNG) and the problem vanished.

    At the time (around March 2011), I first ensured that my Windows was up-to-date but it didn't solve the problem. So maybe there is such an update as mentionned by Erik but it didn't come through Windows Update back then (Maybe it's newer).

    0 讨论(0)
  • 2021-01-16 04:55

    There is a GDI update for Windows 7, I think, if I'm not mistaken. Maybe that will solve the issue. Does your solution build using Msbuild on the commsnd line?

    0 讨论(0)
  • 2021-01-16 04:56

    I compiled using the command line msbuild and that identified the problem location.

    It was a resx file in a class which had one unused image in it. I removed that and all was good again. Can build fine now.

    0 讨论(0)
  • 2021-01-16 05:01

    i had same problem. i just used msbuild myProject.sln command and it fixed and built successfully with no errors! now i can manually build my solution. no need to reAdding my resources

    0 讨论(0)
提交回复
热议问题