R – add Silverlight 2.0 projects to the web app and still target .NET Framework 2.0

.net-2.0multi-targetingsilverlightvisual-studio-2008

Can I add new Silverlight 2.0 projects to my ASP.NET 2.0 web app and still target .NET Framework 2.0 in Visual Studio 2008?

ScottGu doesn't mention Silverlight in his post on multi-targeting.

Michael Scwartz's posts on Silverlight with Visual Studio .NET 2005 and How to create Silverlight Applications with Notepad refer to VS2005 or to Silverlight 1.1 (i.e. pre-RTM).

Has anyone else tried this yet?

[UPDATE]

Now that I've upgraded the web project I started using the Silverlight control…

Best Answer

Michael is right about using the object tag, but you'll also want to do two other things:

  • Use a Post-Build step in the Silverlight project to copy the built xap file to your web project (as Silverlight links don't work with ASP.NET 2.0 projects).
  • Add the Siverlight.js file to the object tag'd page to get better in-place installation and plugin detection.