1
Answer

Fix publishing of Visual Studio Winforms CefSharp Applicatio

Hi,
 
I have an issue when publishing my VS WinForms CefSharp application. After installing it, when it launches, it does not show the web page that gets loaded on launch. I get a plain white screen.
 
This code is working fine during debug mode but when i publish then show blank page.
 
I am using this code to open the web page.
  1. public Form1()  
  2. {  
  3. InitBrowser();  
  4. InitializeComponent();  
  5. }  
  6. public ChromiumWebBrowser browser;  
  7. public void InitBrowser()  
  8. {  
  9. string curDir = Directory.GetCurrentDirectory();  
  10. string temp = Path.GetTempPath();  
  11. var settings = new CefSettings();  
  12. Cef.Initialize(settings);  
  13. //browser = new ChromiumWebBrowser(AppDomain.CurrentDomain.BaseDirectory + @"mainhtml\index.html");  
  14. browser = new ChromiumWebBrowser(@"E:\Sources\Shahzaib-Source\BMOFlow\BMOFlow\BMOFlow\mainhtml/index.html");  
  15. this.Controls.Add(browser);  
  16. browser.Dock = DockStyle.Fill;  
  17. browser.DownloadHandler = new DownloadHandler();  
  18. }
Answers (1)