WPF 启动缓慢问题

Actually there's 2 main reasons that the default project type for WPF applications is x86.

  • Intellitrace debugging only works with x86 and that would look pretty bad if the default project templates didn't work with one of their star features.
  • Many developers were still not aware of the fact that their AnyCPU exe's would run as x64 on 64 bit machines and were surprised to find that 32 bit DLL's they relied on did not exist in 64 bit varieties such as OLEDB drivers, certain native DLL's, etc.

As for the startup time issues you're experiencing, it almost seems like an issue with NGEN. Since there are different NGEN caches for x64 and x86 processes, it could be that the 64 bit NGEN cache either needs to be rebuilt or updated. Try running the following from an elevated command prompt:

CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319
NGEN update

This is the command to re-build native images for assemblies that have already been marked for NGEN. It also probably won't do you any good to NGEN your application if the assemblies are not also in the GAC so I wouldn't bother trying to do that. But framework assemblies, toolkit assemblies, etc should all be NGEN'd.

(By the way, I did get several errors when I ran the above command about assemblies that could not be loaded. It was mostly SQL and Visual Studio assemblies.)

https://stackoverflow.com/questions/2947118/wpf-slow-to-start-on-x64-in-net-framework-4-0

posted @ 2019-10-22 16:45  dongzhaosheng73  阅读(905)  评论(0编辑  收藏  举报