Live Framework – creating a Silverlight Mesh-enabled web application in 8 steps
After seeing what the new Mesh-enabled web applications can do during the last PDC in Los Angeles I couldn’t wait getting my hands on a token and creating something.
First of all, if you have not yet been using Live Mesh signup for an account here: http://www.mesh.com/. This is the public beta so you can start using the client application and Live Desktop to synchronize and share data.
In this post however, I’m talking about the developer Live Framework CTP which at this stage in on limited access. Read on…
In order to create your first Mesh-enabled project you need to install the Live Framework Tools CTP. You will be able to download this once you get your token.
Silverlight Mesh-enabled web application
1. I started by creating a new project of type “Silverlight Mesh-enabled Web Application”.
2. The Visual Studio template automatically generates two projects for this type of application:
- A Mesh host project, this is the actual Mesh application (with a .meshproj extension for Visual Studio)
- A Silverlight project, which will generate the XAP file to be included in the Mesh app.
At this moment the development experience is still not a fluent task: in order to debug your project you need to package it into a zip file and upload it to the cloud (manually). Once that is done the XAP file can be uploaded seamlessly by Visual Studio in order to debug remotely. Let’s review the steps to do this.
Publishing the project in order to debug and test
3. Developer portal, create the new project, choose “Mesh-enabled Web application”:
4. Once the project is created, keep the project details page open, you will need to get back to this page to upload the package and get the Application Self-Link further on.
5. Back in Visual Studio, build your project. Building the project will generate a .zip file with the name of your project. The zip file contains the files from the host project (the .meshproj in Visual Studio) as well as the .xap file of the Silverlight project).
Check the ProjectDir > Bin > Debug directory to retrieve the .zip file that was generated upon build. An easy way to get to the file system from within Visual Studio is by right-clicking on the project and choosing “Open Folder in Windows Explorer”.
6. Go back to the Developer portal and retrieve the project detail page. Click the Upload Package to upload your .zip file. This will deploy the Mesh-enabled web application and make it available on Live Mesh as well.
Once the package is uploaded you can click “Test Now” to try out your application on the Live Mesh site. Let’s not do that just yet.
7. Uploading .xap file through Visual Studio.
Back in Visual Studio, Press F5 to debug, this will launch the “Mesh publishing tool” from Visual Studio. Note: I’ve no idea if this is really called the Mesh Publishing tool, that’s just the name I’m giving to it. This popup will request you to upload the .zip file to the portal (which we have done in step 6). Copy and paste the “Application Self-Link” which can be found on the project’s properties page.
The XAP file will be published to the Mesh and once all these steps are completed your application will be launched in the browser. You may be required to login again.
8. Test your app and debug. The application will start launching the in on the Live Desktop, I set a breakpoint on the constructor and yes, my breakpoint is hit over the Mesh!
Breakpoint in Visual Studio:
The process of uploading the latest .xap to the Mesh happens at every time you debug the application. This is a good thing because it means you online need to go through the different steps once to upload the initial project. Visual Studio then does the work of uploading and deploying the new .xap file to the server every time you debug.
Note that throughout this post we are addressing the Developer CTP at developer.mesh-ctp.com, not Live Mesh in beta that is currently public.
This post does not yet use any Live Framework APIs or access any resources. That’s for another post where I will be saving some information to the Mesh and getting the offline and online experience.
How can you get started?
At his moment the CTP is limited, attendees of the PDC are one of the first to get tokens. But… I do have two tokens that I will give to the first two people replying on this post. Be quick and you might be able to start your own Live Fx & Mesh developments.
And if you want to get ideas on all that’s possible with the Live Framework, there are several sessions worth watching from PDC: http://www.microsoftpdc.com/