Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you compile your Silverlight application, a number of critical actions are performed. Undoubtedly the most important step that compiler performs in verifying that your code is correct. Once that is finished, the compiler creates a Silverlight specific DLL. It is this DLL that is loaded by the Silverlight Runtime. It is rare these days to have a project so simple that all it needs is a simple Compiler Tool. Instead we create Build Automation scripts that control every step of the build process. Microsoft has their own sophisticated build tool called MSBuild, like other modern Build tools it uses an XML format for the script content.
You create the script that contains a set of instructions for the Build Tool. Instructions are arranged in the preferred build sequence. MSBuild then reads the build file and performs the tasks in the given order. There are hundreds of predefined tasks and if you can't find a task that you like, the system is extensible, which means you can create your own tasks. Under normal circumstances, Visual Studio creates the appropriate build steps for you. When you create a Visual Studio project, it generates an MSBuild file. You can open your CSPROJ file in a Text Editor and see the build instructions.
When you build your application in Visual Studio or an Expression Blend it calls MSBuild. MSBuild reads the build instructions contained in the CSPROJ and performs the requested build steps. One of these build tasks calls the Language Compiler. The Language Compiler then compiles your C# code into the finished executable. Even though it is really a build process, most developers still call it compiling the application. Let's go and see. I'm inside Visual Studio and I've opened the CompilingYourProject Solution. This is a simple Silverlight application that contains the default files.
If I want to compile as application or build as application using the correct phrase, I go to the Build menu and I choose Build Solution or Build the Project. This will run MSBuild. I can also use this keystroke Ctrl+Shift+B, let's do that. I just built my Solution. As the build's tasks are being processed, they will output information to this output window. I have the minimum output set, so I don't see a lot of details down here. Important line is down here where it says Build: 1 succeeded or was updated, I had 0 failed builds and I haven't configured Visual Studio to skip any of my builds.
If I have multiple project you might have one or two of your projects turned off during the build process for some reasons. Once you have compiled your application it generates some files that you can see. I'm going to go out to my file system and look at this. There is an easy way to see those files in Visual Studio. Go to Solution Explorer, right-click on your project and choose Open Folder in Windows Explorer. This shows my project files. It also shows some of the hidden folders, you do not see in Visual Studio, the obj folder and the Bin folder. Now when I compiled my application, I had the Debug configuration setting chosen.
We see it up here in the top of my Visual Studio window. There are two choices up here; Debug and Release. Since I had the Debug configuration set, it generated a subfolder underneath my Bin folder called Debug and that contains my five project files. If you'd like to see these in Visual Studio instead, you can configure Solution Explorer to show those to you. Return to Visual Studio, go to the top of your Solution Explorer and click on this button Show All Files. Now that Bin folder shows up, as a white ghost folder.
There's a reason why they don't show you the Bin folder normally, it's because the contents of this Bin folder are generated each time you do a build. We're going to open the Debug folder and talk about each of these files. The most critical of these files is your application DLL. This contains all your code for your application, and it is this file that is loaded by the Silverlight Runtime. If you're interested in debugging your application, you're going to want to have it generate the PDB file. PDB stands for Portable Debug and this contains the debugging symbols that are used by Visual Studio during a debugging session.
There is also an AppManifest.xaml file that contains information about your application. We'll look at that later, and there's also a file called CompilingYourProject.xap which is usually pronounced XAP. This is a compressed file that is downloaded to the user's computer. Since it is a ZIP file I can change this extension to ZIP and then double-click on it to see the contents. As you can see there are two files currently inside my compressed file. The last file I would like to talk about is TestPage.html.
In another movie I talked about how you can configure a Silverlight Stand-Alone project to use a test harness page. That is set in the Properties node under the Debug section. Right here it says Dynamically generate a test page. So this TestPage.html is the page that's generated because of this radio button selection. Let's see it. I'll press F5 to build my application, and also, start the application and attach a debugger. F5, my default browser loads and as you can see in the end of the URL is my TestPage.html.
With this movie I've shown you is that Visual Studio generates five different files for your output, every time you do a compile.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101462 Viewers
61 Video lessons · 88220 Viewers
71 Video lessons · 72102 Viewers
56 Video lessons · 103858 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.