Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Silverlight applications are client-side programs. In order for them to work the code must be available on the customer's computer. The mechanism for deploying code in .NET is called an Assembly, which is nothing more than a specially configured executable file. In Silverlight that will be a DLL file. This DLL file must be downloaded to the customer's computer before your application can start. Your code also uses other .NET classes. When you compile your app you take on dependencies to other .NET Assemblies, this means that these additional assemblies must also be available on the customer's computer.
Any assembly you use must be compiled specifically for Silverlight use, none of the standard .NET libraries work with Silverlight applications. This applies to your libraries too, they must be recompiled for Silverlight use. You can use non-core and non-SDK assemblies too. You can create your own satellite assemblies, it is common for companies to create standard libraries that they use across different Silverlight projects. You can use controls written by third-party vendors like Telerik or Infragistics, plus the Silverlight team includes a number of useful assemblies.
Microsoft provides two sets of assemblies, the first set is the Core assemblies, the second is the SDK assemblies. The Core assemblies or essential libraries aren't preinstalled on the client's computer. When the user installs Silverlight the Core assemblies are copied to their machine. I've highlighted the Core assemblies on the right side of this slide. There are five of them. Your application does not need to download these files to the user's computer. The Silverlight Core libraries are intentionally kept small and lean to reduce install time. Microsoft also provides additional Silverlight assemblies called the SDK assemblies.
These are additional Silverlight-specific libraries, they are useful but not critical. They're specifically compiled to work with Silverlight but they are not automatically added to the user's computer. If you want to use something that's in the SDK assemblies you have to do some additional work. First, you must add them to your project in Visual Studio or Expression Blend by using the References dialog. Second, these files must be downloaded to the user's computer. This means that your application download is bigger because it contains the SilverLight SDK assemblies. SilverLight does cache the assemblies locally however.
So the download time is reduced on future requests. Let's see how this works. I've switched back to Visual Studio, I have loaded a solution called CoreRuntimeAndOtherAssemblies, this is a simple default Silverlight application and has the default reference list. When I compile my application all the non-core assemblies will be included in my XAP file. Let me show you what I mean. I'll compile my application, then I'll go to Solution Explorer, click the Show All Files button. I'll look in the Bin folder and the Debug folder, and what I want to do is look at the contents of this XAP file.
Remember that this is just a compressed file, so I can change the extension to ZIP. When I look inside the ZIP file, there is my Manifest file and my DLL from my application. Next, let me add a reference to another assembly; delete this file by pressing the Delete key, and I will go to my References folder and right-click on it and choose Add Reference. In the .NET tab in the Add Reference dialog are listed all of the Silverlight compatible assemblies.
I am going to try this one down here called System.Xml.Linq, click on OK. In my References folder I now see a new item, System.Xml.Linq, and when I build my application and look in the Bin folder and take a look inside my XAP file, you'll see I now have a second DLL in there. This will be downloaded to the user's computer via the XAP file.
Another way I can add a reference is to go to a designer like this MainPage.xaml file and take a control like this TabControl or the TreeView Control and drag that over and drop it on my designer surface. A couple of things happen when I do that, one it'll modify my XAML file in the bottom to include a new directive, it also adds a reference to my References folder automatically, I've added this reference here System.Windows.Controls. Another way to add a reference is to import an existing DLL.
I am going to use one of the DLLs that I used throughout this course called the Essential Library. I am going to add that by right-clicking on the References folder, choosing Add Reference and I am going to click over here on the Browse tab and I'm going to walk thru my hard drive and find a folder in my Exercises File, those are on my Desktop>Exercise Files. And folder I'm looking for is down at the bottom in this EssentialTrainingLib, let's open this one up. I will drill down into the Bin folder and the Debug folder and then I am going to choose this EssentialTrainingLib.dll file.
Okay, notice in my Reference list I now have Essential Training Library (EssentialTrainingLib) this will also be included in my XAP. The last kind of reference I can use is a Project reference. To create a project reference I'm going to add another project to my Solution, right-click the Solution, choose Add> New Project and I'm going to build a Silverlight Class Library, this means it will compile a set of classes that are available to Silverlight, they will be contained in this project called LyndaLib. Select the Silverlight 5 version.
Now to add a reference to Lynda library I go to my original project, not the LyndaLib project, go to my References folder, right-click, choose Add Reference. Then I click on the Projects tab and then choose LyndaLib. And now all these files; Essential Training Lib, LyndaLib System.Xml.Linq and the others will all be downloaded to the user's computer and made available to my application.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 92834 Viewers
82 Video lessons · 104227 Viewers
71 Video lessons · 75927 Viewers
56 Video lessons · 107285 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.