2
votes

I am new to C#, need help in debugging an error, nothing much on internet was helpful.

I Changed Target Framework from .net 2 to .net 4 for related projects, after this I started getting this error.

The error is:

''System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I found that this TargetFrameworkAttribute is not available in mscorlib 2.0.0.0 but available in mscorlib 4.0.0.0, but don't know from where it is picking mscorlib of version 2.0.0.0 .

I found the code which is causing problem, but now don't know what to look for here.

this.inCallWaitPictureBox.Image = ((System.Drawing.Image)resources.GetObject("inCallWaitPictureBox.Image")));

System.ComponentModel.ComponentResourceManager resources System.Windows.Forms.PictureBox PresetupForm.inCallWaitPictureBox

I also found that this func GetObject() is in mscorlib assembly.

plz give me some pointers to resolve this error.

1
Iirc you get this error if you reference a 4.0 assembly from a 2.0 assembly. I'd check all my references again, preferably even remove them all (from the bin folder) and make sure they aren't in the project anymore. There was also a way to check the assembly version from a DLL, but can't remember it; Google will give you that answer. - atlaste

1 Answers

1
votes
I solved the same problem switching "<NoStdLib>true</NoStdLib>" with "<NoStdLib>false</NoStdLib>" into my_project.csproj file