runtime: System.IO.FileNotFoundException: Could not find file

Hello,

i have migrated my projet from .NET framework to .NET Core, and when i build my project in RedHat, I had this error System.IO.FileNotFoundException: Could not find file ‘/home\VSMP_Setting.xml’. i used this code below to get file

private static string Xml_Settings_Path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + @"\VSMP_Setting.xml";
````````
I have changed Parent.Parent.Parent, but itstill have same error

Cordially

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Your code is using \ as a directory separator. It isn’t on Unix. Use / or Path.Combine.