Reputation: 1354
I've already wasted a few hours on this one:
XmlSerializer serializer;
YES, the using
is there, the reference is there, I made the entire solution in VS2010 using .NET 4.0 so it's not any of those things. If I go in Object Explorer I can find the XmlSerializer
class I want in the correct namespace but if I try typing the above line in to my code file and compiling I get the dreaded
The type or namespace name 'XmlSerializer' could not be found (are you missing a using directive or an assembly reference?)
warning of death. I don't get it on IntelliSense either. All other threads/websites I've looked on have come up blank or with one of the solutions I've already ruled out. What am I missing? Cheers
Upvotes: 10
Views: 14277
Reputation: 1
I had the same problem.
Go to Object Explorer
, select XmlSerializer
and choose copy. Then, paste into code
This helped me with some weird reason (no there wasn't a typo or anything like that).
Upvotes: 0
Reputation: 268293
Do you build a Silverlight app?
Silverlight has XmlSerializer
defined inside System.Xml.Serialization.dll
assembly which is not referenced by default.
This often leads to confusion because other framework versions have it defined in System.Xml.dll
.
You need to add System.Xml.Serialization.dll
to project references to wire it up.
Upvotes: 27