本文主要分析winforms cefsharp應用通過Vs Installer做成安裝包後,安裝程序後,啓動程序導致應用崩潰,提示System.IO.FileNotFoundException
應用程序: WinformsCustomInstall.exe Framework 版本: v4.0.30319 說明: 由於未經處理的異常,進程終止。 異常信息: System.IO.FileNotFoundException 在 WinformsCustomInstall.Program.Main(System.String[])
原因大致是通過Vs nuget安裝CefSharp後,並生成項目時,CefSharp會寫入項目所需的關鍵依賴項,這是CefSharp自己完成的,而通過Vs Installer生成安裝包時,則需要手動添加Cef的關鍵依賴項.
具體參考官方的Issue https://github.com/cefsharp/CefSharp/issues/1428
加載Cef所需的文件依賴參考官方的文檔 https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution) 按照表格的內容將所有的依賴項加入到Vs Installer的Application Folder中即可