4

I'm trying to write an Xml program on Visual Studio 2017 and have error on:

using System.Xml;
...
XmlWriter.Create("C:\\myxmlfile.xml", settings);

With this message: The type name 'Create' doesn't exist in the type XmlWriter.

I suspect that incomplete installation (which unfortunately didn't fixed yet) of my Visual Studio caused this problem. How can I fix it?

Mojee KD
  • 181
  • 1
  • 12

2 Answers2

6

My guess is that your code actually looks something like this:

var writer = new XmlWriter.Create("C:\\myxmlfile.xml", settings);

if it is then remove the new and it will work. The reason is that in the XmlWriter class Create is static so can not be newed.

Reznoir
  • 909
  • 1
  • 11
  • 27
0

In my case was due a conflict with another library. I had to specify it like :

System.Xml.XmlWriter.Create(sww)

Hope it work for you too.

Jim Vazquez
  • 33
  • 2
  • 7