This is a migrated thread and some comments may be shown as answers.

Minifier probles/questions/recomendations

5 Answers 110 Views
Telerik Minifier
This is a migrated thread and some comments may be shown as answers.
Edvin
Top achievements
Rank 1
Edvin asked on 14 Jan 2011, 11:43 AM

Hi,
I have some questions/problems regarding using minifier tool. I have tested both assembly and xap minifier. It looks like that assembly is working ok but the results are not as good as I need. As I understad assemly minifier works on control basis, so if I select GridView all needed classes for GridView are mantained. Xap minifier on the other hand works on classes and all not needed classes are removed and you get beter result. Is this correct?

The problem with xap minifier is that I have project where xap is very small only 20 kb for loader, then I have additional assemblies which are downloaded at startup or on demand. So for minifier I created xap file where all my and telerik assemblies are referenced and I try to minify it. But the problem is that, as I see, minifier only check classes that are inside assemly that is set in EntryPointAssembly (from AppManifest.xaml). So minifier strip way to much. Then I set EntryPointAssembly to assemly that reference most telerik controls and  I get running applicatiio but still some parts are not working. So how can I solve this problem?

Some recomendations:
It will be really great if this tool works also on other libraries! And for xap minifier is almost urgent that this tool is offline. Why? For example I deploy new version of software with xap minified versions of telerik assemblies. Than I discover that I make a bug and this bug requires changed minified telerik libraries and your site is down or some other kind of internet problem. Then I'm in big truble..;);)

The next interesting thing with minifier is that there is no need for separate telerik dlls. Maybe there should be one telerik.dll with all controls and after minifing it, you would probaly end with one assemly which is smaller because there is no overhead of every dll and also startup will be faster.

So ideal situation will be:
- take telerik assembly with all controls for specific theme
- build project
- use minifier
I think this will be the smallest and fastest solution.

Thanks for your answers and have a nice day
edvin

5 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 19 Jan 2011, 02:41 PM
Hello Edvin,

 You're understanding the tool correctly. 
About Xap Minifier - it checks only things that can be statically checked and resolved, which means all dynamic and Reflection stuff will break it. That's why in your scenario the xap minifier is not an option.

We'll definitely  consider your ideas. Thank you very much for the feedback and hope Assembly Minifier will work for you.

Best wishes,
Miro Miroslavov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Edvin
Top achievements
Rank 1
answered on 21 Jan 2011, 01:48 PM

Hi,
thanks for your replay.

I'm aware that dynamic on demand loaded assemblies cause a problem to minifier. But what about situation when all assemblies are included in xap file and are referenced by assembly set in  EntryPointAssembly and listed in AppManifest.xaml. In this situation I think it should work. You should just test types in all assembly (excluding telerik and system) not just the  one specified in EntryPointAssembly. Please correct me if I’m wrong?

I have also found problem with assembly minifier. I try to used it on recompiled telerik assemblies. The steps I have done are following. I have recompiled your source code for: Telerik.Windows.Controls.dll, Telerik.Windows.Controls.GridView.dll, Telerik.Windows.Controls.Input.dll, Telerik.Windows.Controls.Navigation.dll and Telerik.Windows.Data.dll. Then I try to minify them, so I uploaded them all and leave all controls checked. When I referenced those minified assemblies I get lot of compiling errors like:
- The type 'Telerik.Windows.Controls.HeaderedContentControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'Telerik.Windows.Controls, Version=2010.3.1321.1040, Culture=neutral, PublicKeyToken=d3625f8bf04286d7'
- The type 'Telerik.Windows.Data.IFieldDescriptor' is defined in an assembly that is not referenced. You must add a reference to assembly 'Telerik.Windows.Data, Version=2010.3.1321.1040, Culture=neutral, PublicKeyToken=d3625f8bf04286d7'

Just recompiled assemblies (not minified) works ok. Is this some version problem? Is it at all possible to use assembly minifier on recompiled assemblies?

Best regards and thanks in advance…

0
Miro Miroslavov
Telerik team
answered on 27 Jan 2011, 09:10 AM
Hi Edvin,

 In each case you have one starting point assembly and one starting point type, which is the type that must stay. After that every type that is statically used in C# or XAML from Telerik's assemblies is marked for used, and at the end the rest are excluded. It doesn't matter how you reference the assemblies, but how you use the types - statically or dynamically. 
Please let me know how you use the types and I'll check if we can do something for the future release.

About the recompiled assemblies - this shouldn't be a problem. It could be some problem with VS messing the assemblies. Try to reference them from different places, delete all binaries (Bin, Obj) and rebuild the solution. 

All the best,
Miro Miroslavov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Edvin
Top achievements
Rank 1
answered on 27 Jan 2011, 12:56 PM

Hi,
thanks for help.

about recompiled assemblies I have opened new ticket and sent you a sample project.

About XAP minifier:
A have a project like this: My.Loader.dll (startup), My0.dll, My1.dll.... Assemblies are loaded on demand and each assembly must define entry point which is called after assemly is loaded. So it is clear to me that this will not work. So I have prepared test project were all libraries were referenced in My.Loader.dll and I have also staticaly included entry point types of all referenced assemblies. I thought that this should work. But I get way to much minified telerik assemblies.

Maybe I don't undarstand all things correctly but I think that very simple solution will be:
1. Zip all assemblies including on demand loaded in one file
2. Upload this file
3. Select assemblies that you mark as All types used. So all types in this assembles are marked as used (including those in Xamls). Then do optimatisation as you do now.

I think that you will endup with working minified telerik assemblies and there will also be no/litle overhead, bacause those assemblies marked as All types used are custom and they include only types that are really needed.

Best regars
edvin

0
Tina Stancheva
Telerik team
answered on 28 Jan 2011, 03:20 PM
Hi Edvin,

Can you please have a look at the answer to your support thread and let us know how it goes. Thank you in advance.

All the best,
Tina Stancheva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Telerik Minifier
Asked by
Edvin
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Edvin
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or