简体   繁体   中英

Can I add Silverlight 2.0 projects to my web app and still target .NET Framework 2.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 (ie pre-RTM).

Has anyone else tried this yet?

[UPDATE]

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

定位是针对每个项目的,因此没有理由不能在同一解决方案中包含针对不同框架的多个项目。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM