<?xml version="1.0" encoding="utf-8"?>
<feed
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:at="http://www.sixapart.com/ns/at"
    xmlns:icbm="http://postneo.com/icbm"
    xmlns:rvw="http://purl.org/NET/RVW/0.2/"
    xml:lang="en">
    <title>Life, Opportunity, and Development</title>
    <link rel="self" type="application/atom+xml" title="Life, Opportunity, and Development (Atom)" href="http://cyberkruz.vox.com/library/posts/2008/03/page/1/atom.xml" />
    <link rel="alternate" type="text/html" title="Life, Opportunity, and Development" href="http://cyberkruz.vox.com/library/posts/2008/03/page/1/"/> 
    <link rel="service.post" type="application/atom+xml" title="Life, Opportunity, and Development" href="http://www.vox.com/services/atom/svc=post/collection_id=6a00c2251f2742604a00c2251f2743604a" /> 
    <link rel="service.subscribe" type="application/atom+xml" title="Life, Opportunity, and Development" href="http://cyberkruz.vox.com/library/posts/2008/03/atom.xml" />   
    <link rel="last" type="application/atom+xml" title="Life, Opportunity, and Development" href="http://cyberkruz.vox.com/library/posts/2008/03/page/1/atom.xml" />  
    <generator uri="http://www.vox.com/">Vox</generator>
    <updated>2008-03-28T01:59:42Z</updated> 
    <author>
        <name>Matthew Kruskamp</name>
        <uri>http://cyberkruz.vox.com/?_c=feed-atom-full</uri>
    </author> 
    <id>tag:vox.com,2006:6p00c2251f2742604a/2008/03/</id> 
    <subtitle>[witty comment]</subtitle>  
    
    <entry>
        <title>Publishing Silverlight 2 beta</title>   
        <link rel="alternate" type="text/html" title="Publishing Silverlight 2 beta" href="http://cyberkruz.vox.com/library/post/deploying-silverlight-2-beta.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Publishing Silverlight 2 beta" href="http://cyberkruz.vox.com/library/post/deploying-silverlight-2-beta.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Publishing Silverlight 2 beta" href="http://www.vox.com/atom/svc=post/asset_id=6a00c2251f2742604a00f48ce89cf20002" />                <id>tag:vox.com,2008-03-27:asset-6a00c2251f2742604a00f48ce89cf20002</id>
        <published>2008-03-27T16:09:20Z</published>
        <updated>2008-03-28T01:59:42Z</updated>
    
        <author>
            <name>Matthew Kruskamp</name>
            <uri>http://cyberkruz.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://cyberkruz.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p><strong><span style="font-size: 1em;">Overview</span></strong><br />Silverlight 2 Beta brings the wonders of Silverlight and removes the annoyance of Javascript. The question remains: How do I get Silverlight deployed on my webserver even though it isn&#39;t out yet? This article will walk through creating a simple &quot;hello world&quot; silverlight application and deploying it on your webserver. This article assumes you have Silverlight 2 installed with the Visual Studio 2008 templates.</p><p><strong>Create the Silverlight project</strong><br /><blockquote><ul><li>Open Visual Studio 2008</li><li>Click File-&gt;New Project</li><li>Under Visual C# click Silverlight</li><li>Select Silverlight Application, name it what you want, and click ok</li><li>When it asks you if you would like to create a web project, click add a new and click ok</li></ul></blockquote><br /><div at:enclosure="asset" at:xid="6a00c2251f2742604a00e398ea40ff0005 6a00c2251f2742604a00e398ea41010005" at:format="strip-horizontal" at:align="center" class="enclosure enclosure-center enclosure-strip enclosure-strip-horizontal"  style="text-align: center;">
<div class="enclosure-inner" style=" margin: 5px; border: 1px solid; text-align: center;"><a href="http://cyberkruz.vox.com/library/photo/6a00c2251f2742604a00e398ea40ff0005.html" class="enclosure-strip-link" title="Silverlight1"><img src="http://a7.vox.com/6a00c2251f2742604a00e398ea40ff0005-120pi" alt="Silverlight1" class="enclosure-strip-image" style="margin: 5px; border: 0;" /></a><a href="http://cyberkruz.vox.com/library/photo/6a00c2251f2742604a00e398ea41010005.html" class="enclosure-strip-link" title="Silverlight2"><img src="http://a1.vox.com/6a00c2251f2742604a00e398ea41010005-120pi" alt="Silverlight2" class="enclosure-strip-image" style="margin: 5px; border: 0;" /></a></div>
</div> <!-- end enclosure -->
 
 
 

Now you should have two projects. Under the library, click and open up your Page.xaml file. You are going to add xaml to the Grid control so that it looks like this:</p>
<p><br />

<blockquote><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">UserControl</span><span style="font-size: 10pt; font-family: Consolas; color: red;"> x</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">:</span><span style="font-size: 10pt; font-family: Consolas; color: red;">Class</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;SilverlightDeploy.Page&quot;</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160; </span><span style="color: red;"><span style="">&#160;</span>xmlns</span><span style="color: blue;">=&quot;http://schemas.microsoft.com/client/2007&quot;</span>
</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160; </span><span style="color: red;"><span style="">&#160;</span>xmlns</span><span style="color: blue;">:</span><span style="color: red;">x</span><span style="color: blue;">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span>
</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160; </span><span style="color: red;"><span style="">&#160;</span>Width</span><span style="color: blue;">=&quot;400&quot;</span><span style="color: red;"> Height</span><span style="color: blue;">=&quot;300&quot;&gt;</span></span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);"><span style="">&#160;&#160;&#160; </span></span><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">Grid</span><span style="font-size: 10pt; font-family: Consolas; color: red;"> x</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">:</span><span style="font-size: 10pt; font-family: Consolas; color: red;">Name</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;LayoutRoot&quot;</span><span style="font-size: 10pt; font-family: Consolas; color: red;"> Background</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;White&quot;&gt;</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);"><span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">Button</span><span style="font-size: 10pt; font-family: Consolas; color: red;"> x</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">:</span><span style="font-size: 10pt; font-family: Consolas; color: red;">Name</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;BtnHelloWorld&quot;</span><span style="font-size: 10pt; font-family: Consolas; color: red;"> Content</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;Hello World&quot;</span><span style="font-size: 10pt; font-family: Consolas;"> </span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: red;"><span style="">&#160;</span>Width</span><span style="color: blue;">=&quot;100&quot;</span><span style="color: red;"> Height</span><span style="color: blue;">=&quot;50&quot;</span><span style="color: red;"> Click</span><span style="color: blue;">=&quot;BtnHelloWorld_Click&quot; /&gt;</span></span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);"><span style="">&#160;&#160;&#160; </span></span><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">Grid</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">&gt;</span></p><p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">&lt;/</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: rgb(163, 21, 21);">UserControl</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">&gt;</span><br /></p></blockquote>















<p class="MsoNormal"><br /></p><p class="MsoNormal">Then in the Page.xaml.cs file, you need to add the code for the button&#39;s Click event:</p><p class="MsoNormal"><br /></p><blockquote><p class="MsoNormal">

</p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: blue;">public</span><span style="font-size: 10pt; font-family: Consolas;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: rgb(43, 145, 175);">Page</span> : <span style="color: rgb(43, 145, 175);">UserControl</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">{</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">public</span>
Page()</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span>{</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>InitializeComponent();</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span>}</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">&#160;</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">private</span>
<span style="color: blue;">void</span> BtnHelloWorld_Click(<span style="color: blue;">object</span> sender, </span></p>

<p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: rgb(43, 145, 175);">RoutedEventArgs</span><span style="font-size: 10pt; font-family: Consolas;">
e)</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span>{</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">this</span>.BtnHelloWorld.Content = <span style="color: rgb(163, 21, 21);">&quot;You
Clicked Me!&quot;</span>;</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span>}</span></p>

<p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;">}</span></p></blockquote>

Now you can build the application, but it is not quite publish ready.</p><p><br /><strong>Publishing the application<br /></strong>First thing we need to do is create a publish version of the application.</p><p><br /><blockquote><ul><li>Right click on the web application and click &quot;Publish Website&quot;</li><li>Specify your publish location (I used the desktop), and click ok</li></ul></blockquote><br />
    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00c2251f2742604a00f48ce8acb00003" at:format="medium" at:align="center"
    class="enclosure enclosure-center enclosure-medium photo-enclosure" 
     style="text-align: center;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 10px auto;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://cyberkruz.vox.com/library/photo/6a00c2251f2742604a00f48ce8acb00003.html"><img src="http://a0.vox.com/6a00c2251f2742604a00f48ce8acb00003-200pi" alt="Silverlight3" title="Silverlight3" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://cyberkruz.vox.com/library/photo/6a00c2251f2742604a00f48ce8acb00003.html" title="Silverlight3">Silverlight3</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->



<br />Now the issue with publishing Silverlight 2 is that webservers don&#39;t recognize the xap file as a proper mime type. The good thing is xap files are essentially just zip files. With this in mind, we can use some wizard trickery to make it all work happily.</p><p><br /><blockquote><ul><li>Go to the folder where you published your web application<br /></li><li>There should be a .xap file in your ClientBin directory. Change the file extension file to .zip instead of .xap</li><li>Go to any pages that reference this file (Visual Studio will have created a [ProjectName]TestPage.aspx and .html file.</li><li>Open the SilverlightDeployTestPage.html and find the object section.</li><li>Rename the .xap reference to .zip as done in the ClientBin file</li></ul></blockquote><br /><blockquote>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">object</span><span style="font-size: 10pt; font-family: Consolas;"> <span style="color: red;">data</span><span style="color: blue;">=&quot;data:application/x-silverlight,&quot;</span>
</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: red;">type</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;application/x-silverlight-2-b1&quot;</span><span style="font-size: 10pt; font-family: Consolas;"> </span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: red;">width</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;100%&quot;</span><span style="font-size: 10pt; font-family: Consolas;"> <span style="color: red;">height</span><span style="color: blue;">=&quot;100%&quot;&gt;</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">param</span> <span style="color: red;">name</span><span style="color: blue;">=&quot;source&quot;</span> <span style="color: red;">value</span><span style="color: blue;">=&quot;ClientBin/SilverlightDeploy.zip&quot;/&gt;</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">param</span> <span style="color: red;">name</span><span style="color: blue;">=&quot;onerror&quot;</span> <span style="color: red;">value</span><span style="color: blue;">=&quot;onSilverlightError&quot;</span> <span style="color: blue;">/&gt;</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">param</span> <span style="color: red;">name</span><span style="color: blue;">=&quot;background&quot;</span> <span style="color: red;">value</span><span style="color: blue;">=&quot;white&quot;</span> <span style="color: blue;">/&gt;</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">a</span> <span style="color: red;">href</span><span style="color: blue;">=&quot;http://go.microsoft.com/fwlink/?LinkID=108182&quot;</span>
</span></p>

<p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: red;">style</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;text-decoration:
none;&quot;&gt;</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160; </span><span style="">&#160; </span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">img</span>
<span style="color: red;">src</span><span style="color: blue;">=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot;</span>
</span></p>

<p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: red;">alt</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;Get
Microsoft Silverlight&quot;</span><span style="font-size: 10pt; font-family: Consolas;"> </span></p>

<p class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: red;">style</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">=&quot;border-style:
none&quot;/&gt;</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">&lt;/</span><span style="color: rgb(163, 21, 21);">a</span><span style="color: blue;">&gt;</span></span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(163, 21, 21);">object</span><span style="font-size: 10pt; font-family: Consolas; color: blue;">&gt;</span></p></blockquote><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><br /></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;">You should be good to go. You can now ftp the site wherever your heart desires and it will work. For now, you have to do this for all of the references to your xap files. I&#39;ll keep you posted (No pun intended).<br /><span style="font-size: 10pt; font-family: Consolas; color: blue;"></span></p><blockquote>

</blockquote><blockquote><p class="MsoNormal"></p></blockquote>

</p>   <p style="clear:both;"> 
    <a href="http://cyberkruz.vox.com/library/post/deploying-silverlight-2-beta.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00c2251f2742604a00f48ce89cf20002?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="c#" scheme="http://cyberkruz.vox.com/tags/c%23/" label="c#" /> 
    <category term="asp.net" scheme="http://cyberkruz.vox.com/tags/asp.net/" label="asp.net" /> 
    <category term="silverlight" scheme="http://cyberkruz.vox.com/tags/silverlight/" label="silverlight" /> 
    </entry> 
</feed>


