Building Silverlight content into a VS 2k8 web app

Last post 04-03-2008 7:39 PM by FoolongC. 2 replies.

Sort Posts:

  • Building Silverlight content into a VS 2k8 web app

    04-03-2008, 10:12 AM
    • Loading...
    • FoolongC
    • Joined on 08-23-2007, 9:12 PM
    • Posts 40

    I created a Silverlight project in VS 2k8 and chose the option to add a website to the solution. Within the website there is a ClientBin folder that holds the .xap file that contains the Silverlight content from your Silverlight class library (sort of a .dll I'm thinking). The Silverlight class library starts off with a single xaml file (Page.xaml) that you can add your Silverlight controls to. When doing a build this content is what's added to the .xap file in your website. You then reference this .xap file in your aspx markup to display your Silverlight content. Here's my problem:

    I added a second xaml file to the project but I'm trying to figure out how to display it's content in the website. After adding the second xaml file and doing a build I still only get one .xap file in the ClientBin folder and the content from both pages shows up where I'm referencing it in my aspx markup.

     Any idea what the correct process is?

  • Re: Building Silverlight content into a VS 2k8 web app

    04-03-2008, 12:00 PM
    • Loading...
    • ClayCo
    • Joined on 06-14-2002, 10:11 AM
    • United States
    • Posts 244
    • AspNetTeam

    Hi Foolong,

    This article explains the Silverlight Application model in more detail than I can give here, but a .xap file contains application metadata that limits the application to a single entry point (that is, a single starting class) and the XAML files in that .xap are connected to a class by an x:Class attribute on the root element.  It sounds like your application is inadvertently loading both XAML files in your .xap, and my guess is that this is because the x:Class attributes in both files are the same.  Could you check to see whether this is the case?

    Thanks,
    Clay

  • Re: Building Silverlight content into a VS 2k8 web app

    04-03-2008, 7:39 PM
    • Loading...
    • FoolongC
    • Joined on 08-23-2007, 9:12 PM
    • Posts 40

    Clay, 

    Your link actually helped me find this page:

    http://msdn2.microsoft.com/en-us/library/cc221369(vs.95).aspx

    I found the answer I was looking for there (under the 'Developing a Silverlight Library Assembly' topic). So the answer looks like it is this:

    Add another Silverlight project to your solution. Size accordingly and add the Silverlight controls you want. Do a rebuild. A second .xap file will be added to ClientBin and that file can be referenced using an <asp:Silverlight tag in you aspx markup.

Page 1 of 1 (3 items)