In my WPF app I am trying to load an html file(from inside my project, name of html file is index.html) in to a WebBrowser component.
I followed an answer byghostJago from this question: Load local HTML file in a C# WebBrowser , but the problem is, the directory of the html file I get points to a Debug folder ( E.g C:\Users\user1\source\repos\AppName\AppName\bin\Debug ).
The first time I ran my project in debug mode, the html file wasn't in the debug folder, I had to paste it in there. So is it possible to load a html file from within visual studio project at runtime? If so, how do I do it?
Code that points to Debug folder:
string curDir = Directory.GetCurrentDirectory();
string myFile = System.IO.Path.Combine(curDir, "index.html");
WebView.Navigate("file:///" + myFile);