0

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...

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
rohancragg
  • 5,030
  • 5
  • 36
  • 47

3 Answers3

2

The targeting is a per project, there is no reason why you can't include multiple projects that target different frameworks in the same solution.

AnthonyWJones
  • 187,081
  • 35
  • 232
  • 306
1

Yes you can. Because Silverlight runs only on the client, you can invoke the Silverlight plug-in with an object tag:

<object width="300" height="300"
    data="data:application/x-silverlight," 
    type="application/x-silverlight-2" >
    <param name="source" value="SilverlightApplication1.xap"/>
</object>
Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
1

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.
Shawn Wildermuth
  • 7,318
  • 3
  • 23
  • 28