Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type name 'Create' doesn't exist in the type XmlWriter

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?

like image 601
Mojee KD Avatar asked Sep 05 '25 03:09

Mojee KD


1 Answers

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.

like image 173
Reznoir Avatar answered Sep 07 '25 20:09

Reznoir