If you create Windows Phone 8 App in Visual Studio and reference any libs with XML documentation files supplied from nuget or manually, Visual Studio will automatically pack those XML files into output XAP as well.
In our case this weird behavior of Visual Studio increases XAP size almost twice. (We have 8Mb of xml docs in total.)
There is no such problem for WP7 app projects.
How to reduce the size of the xap file by forcing Visual Studio not to pack unnecessary documentation files?
Update 14/02/2013:
Steps to reproduce the issue:
You will find there lots of unnecessary XML doc files like “System.Reactive.Core.xml”
I believe this is security issue, because if you enable XML doc generation for your project (or other projects in solution), those XML docs will be packed into XAP as well – this is highly undesirable when anyone may read comments to your code.
Updated on 20/02/2013
As @A-student pointed out in the comments, my previous solution would force you to add the MSBuild stuff in each and every project in a solution.
This one only requires you enter it on the projects that actually have a XAP/APPX file output:
<PropertyGroup>
<FilesToXapDependsOn>$(FilesToXapDependsOn);AfterFilesToXapDependsOn</FilesToXapDependsOn>
</PropertyGroup>
<Target Name="AfterFilesToXapDependsOn">
<ItemGroup>
<FilteredPackagingOutputs Remove="@(FilteredPackagingOutputs)" Condition="'%(FilteredPackagingOutputs.OutputGroup)' == 'CopyLocalFilesOutputGroup' AND '%(FilteredPackagingOutputs.Extension)' == '.xml'" />
</ItemGroup>
</Target>
It's a bit of a hack and should be used carefully (not sure right now of what implications this might actually have), but seems to do the job perfectly for now!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With