How to create extensions for LightSwitch


Prologue:

In this article, we shall discuss how to create extensions for LightSwitch 2011 using Microsoft's Visual Studio LightSwitch 2011 Extensibility Toolkit.

Visual Studio LightSwitch 2011 Extensibility Toolkit:

Microsoft Visual Studio LightSwitch gives you a simpler and faster way to create high-quality business applications for the desktop and the cloud. We can extend the functionality of LightSwitch by creating extensions using Visual Studio 2010 or higher, the Visual Studio SDK, and the Visual Studio LightSwitch 2011 Extensibility Toolkit.
Requirements:

The following pre-requisites are required in order to create LightSwitch extensions. You cannot create extensions using LightSwitch alone.

Installing the Toolkit:

  1. Download and extract the LightSwitch Extensibility Toolkit .exe file to your local machine. You will see the extraction window as shown in the below figure.

    ExLS1.gif

    Once you click on the OK button, you will be getting the success message as shown in the below figure.

    ExLS2.gif
     
  2. Double-click the Microsoft.LightSwitch.Toolkit.vsix file. You will get the below installation window.

    ExLS3.gif
     

Once you click on the Install button, you will get the success message as shown in the below figure.

ExLS4.gif

Then you need to copy the Microsoft.LightSwitch.Toolkit.targets file which is in the folder where you extracted the toolkit into:

\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0, if you're running a 32-bit machine, or
\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0, if you're running a 64-bit machine.

Types of LightSwitch extensions:

There are six types of extensions for LightSwitch:

  1. Business types
     
    • Let you wrap a base data type in a semantic type, providing additional validation and display capabilities in LightSwitch while continuing to store the data in its underlying type. They can include a Silverlight control for displaying data.
       
  2. Custom controls
     
    • Silverlight user controls with additional attributes to make them usable in and better integrated with LightSwitch.
       
  3. Data sources
     
    • Domain service adapter class that enables LightSwitch to work with other data sources.
       
  4. Screen templates
     
    • Can be used to create screens that have common layout patterns different from the standard screen layouts provided by LightSwitch.
       
  5. Shells
     
    • Let you create an application shell with a different layout and capabilities than the standard LightSwitch application shell.
       
  6. Theme
     
    •  Let you create a different appearance and behavior for LightSwitch applications and controls.

The Visual Studio LightSwitch 2011 Extensibility Toolkit includes templates that contain the necessary files for each extension type.

More information regarding these extensibility points can be found here.

LightSwitch 2011 Extensibility Toolkit Project Templates:

The Visual Studio LightSwitch 2011 Extensibility Toolkit installs two new project templates, LightSwitch Extension Library (Visual Basic) and LightSwitch Extension Library (Visual C#), that can be used to create extensions. When you select one of these project types, a solution with seven projects is generated:

  • The projects with names that end in .Client, .Client.Design, .Common, .Design, and .Server contain the various parts of the extension items that will be added to the library.
  • The .Lspkg project packages the previous five projects so that LightSwitch can unpack and reference them when the package is installed.
  • The .Vsix project packages the generated .Lspkg file into a .Vsix package so that it can be added to LightSwitch through the Extension Manager.

Summary:

In this article, we have seen how to create extensions for Visual Studio LightSwitch 2011 using Visual Studio LightSwitch 2011 extensibility tool kit. In my next article we shall discuss creating extensions.

Thanks for spending your precious time here. Please provide your valuable feedbacks and comments, which make me to give a better article next time.
 

Up Next
    Ebook Download
    View all
    Learn
    View all