[解決]WPF 在 win7 系統無法運行:FileNotFoundException


開發環境:VS2015 + .NET 4.6.2 

開發項目1:WPF + CefSharp 

開發項目2:WPF

情況:兩個項目編譯的程序都無法在客戶環境的 win7上運行,事件查看器中如下日志:

1 The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException
2  at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
3  at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
4  at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
5  at System.Reflection.Assembly.Load(System.Reflection.AssemblyName)

解決流程:在重裝.NET 4.0,.NET4.5.2,.NET4.6.2后,依然無法運行。后,根據網上查到的資料,說是.NET4.x + win7 的大坑。決定把版本退回到.NET4.0,在項目1重裝cefsharp時,看到一句:

1 Deployment:
2   - Make sure `Visual C++ 2013` is installed (`x86` or x64` depending on your build) or you package the runtime dlls with your application, see the FAQ for details.
3   

依賴  Visual C++ 2013  的運行環境。

解決方案: 安裝了   Visual C++ 2013  解決。

 

相關其他鏈接:

在.Net4.5下編譯的WPF程序在Windows7下無法運行 

ps:不知道我的解決方案是否適用於 上述鏈接作者遇到的問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM