Professional, Software

47 Bytes

I tried another approach to get it smaller and this approach has same output but has size of 2,402 Bytes instead of 2,449 with earlier approach so it wins by 47 bytes 🙂

  1. I created a new project in VS (Chose “Generate HTML Test Page to host Silverlight…” option)
  2. Deleted following files
    1. AssemblyInfo.cs from Properties
    2. Only references I kept were (mscolib, System and System.Windows)
    3. Deleted Page.xaml (& Page.xaml.cs)
    4. Also marked App.xaml to be of type Resource rather than silverlight page so that partial class generation does not happen.


<Application xmlns=""
            <TextBlock Text="Hello Silverlight"/>


   1: using System;
   2: using System.Windows;
   4: namespace SilverlightApplication4
   5: {
   6:     public partial class App : Application
   7:     {
   8:         public App()
   9:         {
  10:             System.Windows.Application.LoadComponent(this, new System.Uri("/SilverlightApplication4;component/App.xaml", System.UriKind.Relative));
  11:         }
  12:     }
  13: }

Manifest looks exactly the same.

you can not get rid of the partial class all together. Since app class is like a main for silverlight application, only things activation code knows is the application class to be instantiated. This class is supposed to find the xaml  (in this case, XAML also defines what goes in Visual root).

here is the sample project.


Leave a Reply

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

You are commenting using your 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