How to resolve “Error System.Object is not defined or imported”


Greetings Everyone ,
 
Today my heart almost stopped beating when my complete .aspx page  in my User Control  where i was working on it for 2 days was neither being build nor Deployed.
 
I was receiving the following error ” System.Object’ is not defined or imported” and when I Google it, I got no solution rather what I got was ” If you have receive this error, It is a bug and has been raised to the Microsoft. So to get your  code working, Kindly open up a new project and paste your HTML to the other project”.
 
After much of RnD, I got a clue that this issue is caused by a  reference named “mscorlib”. It happened because It might have got corrupted or removed from my reference.
So now me being happy went to add that reference back to to my project. I received an error that this .dll file is already being used by the project.
 
Back to my sadness, I went to close my project but then I opened my .csproj in notepad to see if this reference is present with all my reference in their, but I didn’t find it, so I added that reference (<Reference Include =”mscorlib”/>) under my References tags there, I saved my Notepad and I got an message that your project has been modified, Do you want to reload it, I did but again it did not work.
 
Lastly I closed the project and opened it again to see if some miracle would have occurred, and Yes the Miracle happened, it started working and I was relieved from all my worries. 🙂 
 
Enjoy SharePoint !!!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s