Shrinking a LightSwitchV3 project for file transfer

Introduction

A small LightSwitch solution can take quite some diskspace, ~150MB.

Since the LSv1 beta version, there’s a batch file made by Oscar Agreda for shrinking some redundant folders that Visual Studio creates when building in debug or release.

With the current version of LightSwitch, you have 2 options for cleaning your project: using an update of this batch, or by using the Clean Solution functionality of Visual Studio.

LSCleanV3.bat

Here’s an update of the script that works with the current version of LightSwitch, having a Desktop and/or a HTML Client:

 rd /q /s Bin\Debug
 rd /q /s Bin\Release
 rd /q /s _Pvt_Extensions

for /d %%p in (*Client) do (
 rd /q /s "%%p\Bin\Debug"
 rd /q /s "%%p\Bin\Release"
 rd /q /s "%%p\obj\Debug"
 rd /q /s "%%p\obj\Release"
 )

for /d %%p in (*Server) do (
 rd /q /s "%%p\Bin\Debug"
 rd /q /s "%%p\Bin\Release"
 rd /q /s "%%p\obj\Debug"
 rd /q /s "%%p\obj\Release"
 )

Remember to close your solution first, then run the script from your LS project folder.
With this script you can shrink the project folder to ~15MB, compressable to 3MB.

Clean Solution

With the first LightSwitch version, cleaning up the solution didn’t work for the LightSwitch project.
The current version has fixed this so you can also remove the redundant build files by cleaning your solution, do this once for each build configuration you used. This also cleans up the build files of additional projects, for instance your RIA Service class library project, which the batch file doesn’t.

After the clean, you can manually delete the _Pvt_Extensions folder.

Enjoy!
Michiel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s