|
by
kirupa | 16 April 2008
In the
previous page,
you learned how to create a new Silverlight project
and link a Web site to its output. In this page,
let's look at the other case where you already have
a Silverlight project created but don't have a
Web site associated with it.
You may be wondering how you could get into a
situation where you have a Silverlight project but
no Web site project. It's actually quite common.
Currently, in the beta version of Blend 2.5, if you
happen to create a new Silverlight project, you
create just a Silverlight project. You don't get the
option of having a Web site created as well.
Fortunately, the fix
for this is quite simple. Open your Silverlight
project in Visual Studio. Look in your Solution
Explorer where you only see your single Silverlight
project:

[ the Solution Explorer is your friend ]
Right click on your
Solution and go to Add | New Web Site:

[ you can easily add a new Web site project to an
existing solution ]
The Add New Web Site
window will appear. You will see several
preconfigured Web site templates for you to pick
from. Let's keep it simple and just go with the
Empty Web Site:

[ select the Empty Web Site template ]
Once you select your
Empty Web Site template and hit OK. Your Add New Web
Site window will close, and you will see your Web
site project appear in your Solution Explorer. Since
it is after all an empty Web site, you won't see
much.
Anyway, right click on
your web site project in the Solution Explorer, and
from the menu that appears, select the
Add Silverlight Link
item:

[ you want to add a link between your web-site and
your Silverlight project ]
The Add Silverlight
Link window will appear, and this window allows you
to either create a new Silverlight application or,
what we want, to link to an existing Silverlight
application that we already have:

[ since you already have a Silverlight app, go ahead
and link to it ]
The default selection
should already be "Link to an existing Silverlight
project in the solution" and the app I had already
created, MySilverlightApp, should be selected for
you. Keep all of the other selections the same,
especially the one for "Add a test page for
referencing the control" and click on the Add
button.
A few seconds later,
you will see that your once Empty Web Site now
contains a link to the XAP produced by your
Silverlight project:

[ you now have a properly configured Web site
project and Silverlight project ]
Now, you are at
exactly where we were in the previous page where
your solution now contains both a Silverlight
project as well as a Web Site project that listens
to the output produced by your Silverlight project.
Yay!
I hope the information helped.
If you have any questions or comments, please don't hesitate to post them on the
kirupa.com Forums. Just post your question and I, or our friendly
forum helpers, will help answer it.
The following is a list of related tutorial and help resources that you may find
useful:
|