user2037559
user2037559

Reputation: 135

Illegal character in VS 2017 Resource system

I have this line of code:

XDocument doc = XDocument.Parse(File.ReadAllText(Properties.Resources.settings));

AndI get this error message:

System.ArgumentException: 'Illegal characters in path.'

I have added the file "settings.xml" as a resource to my project in Visual Studio 2017 Community.

The path to my project is:

C:\Users\myname\OneDrive\Projects\Test\Test\Resources

Upvotes: 2

Views: 85

Answers (1)

nvoigt
nvoigt

Reputation: 77304

If settings is the file you already added, you will get the contents. That's the point of the resource system, that you don't need to read from files:

var doc = XDocument.Parse(Properties.Resources.settings);

Upvotes: 1

Related Questions