Ways to speed up the startup of a ClickOnce application

时光怂恿深爱的人放手 提交于 2019-12-03 16:35:15
Paul Alexander

Spend some time analyzing the assemblies loaded by your application. That's going to have the greatest effect on the load time of your application. If you have types that are only used on occasion, move them to another assembly. ClickOnce can optimize the download of assemblies on demand so reducing the required number of assemblies at load time will make it load faster.

You can also have a sort of "stub" launcher with bare minimum assembly dependencies that loads the other assemblies dynamically (Assembly.Load) and invokes the real processing after they are loaded.

Peter Lillevold

You can use ClickOnce file groups to split your application into manageable pieces and then use the ClickOnce API to download groups when needed. The article ClickOnce File Groups explains how to do this.

Make sure you get .NET 3.5 SP1 as there are significant performance improvements in the area of startup. Particularly with WPF applications.

And as for the web service call, you can speed that up if you make sure you generate a serialization assembly when you compile. From what I can remember, Visual Studio is not very smart about knowing when to generate this file automatically but you can do it with SGEN.EXE.

It create a separate assembly such as MyApp.XmlSerializer.dll which contains all the serialization code for the web service call. Without this, your app will do a failed probe for the assembly then dynamically generate the code and compile it in-memory which is why your first web service call is slow.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!