How to use a Silverlight Solution - silverlight

I have a Silverlight app made in Visual Studio 2010 and I want to put it on a website but I don't have the slightest clue how.
I've looked at all the msdn documentation and they all mention a .xap file that is the file you use on the website but there is no .xap and I can't find out how to compile my code into a .xap file.
Also, when I run the App and look at the source in the browser, it has my code compiled into the .xap file, but there is no .xap file!
So my question is simply how do you go about getting a Silverlight app on a website because I've been trying for hours and I can't figure it out.

A sample html or aspx page is included when you create the solution. This is the page that the browser navigates to when you hit F5. You can take that page as a basic example of how to embed a Silverlight app in a page. You should find it in the project folder.
Silverlight projects are commonly built into a XAP file when you hit "Build" in VS. This file lives in the bin/Release or bin/Debug folder and basically contains your whole application.

Steps to create a silverlight application Hosted in a web site,
Select Silverlight Application Template while adding new project in VS2010
When you click Ok, ensure that Host the Silverlight application in a new web site is Checked.(It will create a new ASP.Net web application to host the Silverlight)
If you haven't checked the Host the Silverlight application in a new web site option, you can add a new ASP.Net Web application project and then go to its properties and select Silverlight Applications option in left pane. Then Click Add, select your Silverlight Application to be hosted and click ok. You are done now.
But If haven't selected the Silverlight Application Template, then you might have created a Silverlight Class Library. It wont generate any xap file. It just gives a dll. So you need to recreate a project as mentioned above.

I believe that in Silverlight whenever you create a project, right at the beginning, it will ask you if you want to create a web app automatically. If you chose yes, something like YOUR_PROJECT_NAME.web will be created, go into that folder, you will find a folder called ClientBin.
The .xap file will be inside that folder.
HTH

Related

.Xap file is not generated in Sivlerlight Web Application

I have two Applications - Silverlight + Web.. the thing is that in Web application .xap file is not generated during Build..
Is there anything i can solve this problem with?
Thanks
Right click on the Web project and select Properties. Navigate to the Silverlight Applications side tab on the properties page. What do you see?

What if we don't host our silverlight Application when we first Create it?

As we all know very well..
whenever we create application inside silverlight it is asking us for hosting it
by dialogue box at given below.
My question is what if i unchecked the check box[Host the silverlight application in a new web site].
Means what kind of problem we have to face later if I don't host our Silverlight Application in any of the option given by dialogue box.
Basically it is not a problem at all. You can add a website at any time later.
In the project settings of a website there is a Silverlight tab. Under that you will find the option to add Silverlight projects to the website. This will setup the links to generate the XAP in ClientBin as well as giving you the option to create test pages for each Silverlight app added. The test pages will give you the sample JS you need to host your Xap later.
You will have to eventually host your application somewhere otherwise it will stay on your local harddrive and hardly reach any clients. So if you have an existing web site you could simply copy-paste the necessary javascript to this site later in order to embed your Silverlight application. In this case you can uncheck this checkbox.

WPF installation

I'm new to WPF, and created a 1st simplistic WPF application that I want it to run in a webbrowser, IE or Fox.
1 - Within the Visual Studio project, I created a /Images folder with a few .jpg files
On the WPF xaml form I have 1 image and 1 button.
When application starts, the image displays /Images/img1.jpg
When User clicks the button the image must display /Images/img2.jpg
How can I force the VS publisher to include the Images folder? Apparently I can't see it in the ApplicationFiles ?
2 - Though I was able to program and run this small app on my local computer, I'm getting lost when it comes to deploying to my hosting ASP where I have a Windows hosting account that runs .NET 3.5!
From Microsoft WPF website they say I shall deploy 3 files:
"The Application Executable .exe
The Deployment Manifest .xbap
The application Manifest .manifest
The .xbap file contains the information that ClickOnce uses to deploy the application and has the .xbap extension."
But I can's see no .xbap files at all within the published stuff!!!
Any clue please?
To answer your first question:
The images will be embedded in the compiled application, so you will not see the images in the application files.
Note:
The build action of images added to your project is 'Resource' by default - leave this as is.
Do not use the resources tab in the Project properties window, just drop and drag the images into the Images folder in the solution explorer.
To help answer your second question:
Did you create the project as an WPF Browser Application?
In your .csproj file you should see the following:
<HostInBrowser>true</HostInBrowser>
<Install>False</Install>
<ApplicationExtension>.xbap</ApplicationExtension>
<TargetZone>Internet</TargetZone>
If not, just recreate the project as a WPF Browser Application and copy your files from the existing project to the new one.

TestPage.aspx in silverlight

I am a beginner in silverlight. I want to know what is TestPage.aspx and TestPage.html in silverlight. Actually i have google it but din't get enough information. Can any one give me answer??
TestPage.aspx and TestPage.html are the pages which will host your Silverlight content. As you might know, Silverlight is just a project (not a web application) and needs a page that can host it.
These pages are created by default and help you to test your XAML content during your development, which you can later remove from your project.
TestPage.html is dynamically generated by the Silverlight application as part of the Debug process. If you take a look at the Debug tab for the application properties you will see an option to Dynamically generate a test page. If this is selected then you TestPage.html is created in the /Bin/Debug folder of your Silverlight application.
A better solution is to create a web application in the same solution as your Silverlight application then in the properties for the web application go to the Silverlight Applications tab and add your existing Silverlight app to the web project. Also make sure that the Silverlight checkbox is ticked in the Debuggers section of the Web tab of your web application.

Silverlight client does not get copied on to the Silverlight Web project clientBin folder

Hi When trying to run the Build Locally Silverlight client files does not get copied on to the Silverlight web's ClientBin folder, any idea what to do? The Version of Silverlight is 3.0
More information needed. you can first go to you web site property to check if you set the silverlight application path to clientbin folder.
Go to the properties of the web application.
There is a group called "Silverlight Application"
Click the Add button
Select "Use an exisiting Silverlight project in the solution" and select the Silverlight project from the drop down.
Make sure that the Destination folder field is set to ClientBin.

Resources