28 July 2015

The type or namespace name 'XmlNodeReader' could not be found (are you missing a using directive or an assembly reference?)

I had to download a Visual Studio 2015 RC solution to a VM and rebuild it. However, in the process, build errors popped up. They were similar to this one:

The type or namespace name 'XmlNodeReader' could not be found (are you missing a using directive or an assembly reference?) myapp.DNX Core 5.0

Lots of research and trial-and-error finally revealed the answer: The myapp project (an ASP.NET MVC app) had references to two frameworks -- DNX 4.5.1 and DNX Core 5.0. These were listed in the project.json file:

"frameworks": {
    "dnx451": {
      "frameworkAssemblies": {
        "System.Web": "4.0.0.0",
        "System.Xml": "4.0.0.0",
        "System.Xml.Serialization": "4.0.0.0"
      }
    }//,
    //"dnxcore50": { }
  },

This article had the answer. I needed to comment out the dnxcore50 in project.json; once done, the app compiled and all was well with Visual Studio. 

No comments: