Object reference not set to an instance of an object in resx resource file

2011-05-12


We have a Windows Forms solution which includes multiple sub projects, and since long time, we used Visual Studio 2005, and then 2008, now we are using Visual Studio 2010 to develop this solution.

We never gotten this kind of compile error on Windows XP when we convert the solution from lower Visual Studio version to higher Visual Studio version. But this year we moved OS from Windows XP to Windows 7 64-bit OS, we got some compile issues, one of the error is the following one:

There were some .resx files bring error:  Object reference not set to an instance of an object

resxBuildError00

We searched lots of reference help information through internet, finally we found a solution but we are not sure the exact reason ( but some people think it  might be the Visual Studio 2010 bug on Windows 7 64-bit):

Our Windows Form Solution was from old version of Visual Studio, and also we have multiple team members, so some of sub project set the target .NET platform is 2.0, other sub project might be 3.5 or 4.0, the error came from the project which we set to 2.0:

resxBuildError00_1

But in our .resx file, we found the following code:

resxBuildError01

Some reason lead our code has lots of "Version = 4.0.0.0" lines of code.

So all what we did is** change all "Version = 4.0.0.0" to "Version = 2.0.0.0"**

That is , simple . And we no more got the same compile error.