I have a dotnet core project that I'm important sample data into from an XML.
XDocument sampleData = XDocument.Load(@"seed/Import_sampleData.xml");
In the terminal when I execute it with the command dotnet run it loads the data just fine as expected but in Visual Studio Code I get different results when I try to run the debugger:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not find file '/Users/Chris/Google Drive/Repos/project/project.api/seed/Import_sampleData.xml'.
I'm not sure what the issue is being that I thought that the debugger also uses dotnet run so why would it behave differently?
As suggested here's my copyToOutput settings in my project.json. The xml file now is copied to the bin folder on build but still returns a file not found exception:
"copyToOutput": {
"include": [
"config.json",
"Certificate.pfx",
"seed\\"
]
}