|
||||||||
Deploying Silverlight Applications First, create a folder in your hard drive, say C:\MyFirstSilverlightApp. Create an HTML page named Default.html and populate it with the following:
As you observe, you can simply copy the content from the TestPage.html (from the Visual Studio 2008 project) and paste it into Default.html. The important elements are highlighted in bold.
This HTML file references two JavaScript files: Silverlight.js and Default.html.js. Like before, you can also copy them directly from the files in Visual Studio 2008 project (after copying, simply rename TestPage.html.js to Default.html.js). By default, the Default.html.js file uses Page.xaml as the UI for your Silverlight application (see Listing 5). Hence, copy the Page.xaml from your Visual Studio 2008 project into the C:\MyFirstSilverlightApp folder. If you look into the content of Page.xaml, you will see that the Silverlight application is expecting to find the compiled assembly in the ClientBin folder. The name of the compiled DLL is OurFirstSilverlightProject.dll:
Hence, in C:\MyFirstSilverlightApp, create a new folder named ClientBin and copy the compiled DLL from the ClientBin folder of your Visual Studio 2008 project's folder.
Figure 17 shows the content of the C:\MyFirstSilverlightApp folder. As you can see, you do not need to deploy the source code of your VB program, just the assembly.
You can now configure the C:\MyFirstSilverlightApp folder as a virtual directory in IIS. Launch IIS (you can use the inetmgr command), right-click on the Default Web Site link and select New | Virtual Directory…. Give it the alias of Silverlight and specify C:\MyFirstSilverlightApp as the location of the folder. That's it! You can now load the page using this URL: http://localhost/Silverlight/default.html. You've seen how to create a Silverlight application using Visual studio 2008. You define Silverlight application UIs using XAML, which you can produce with Visual Studio 2008, Expression Blend 2, or manually. Hopefully, you've been inspired to explore Silverlight more deeply.
* This article originally appeared in the DevX Special Report: "A New Era for Rich Internet Applications."
|
||||||||
Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
| ||||||||
|
Submit article to:
|