简体   繁体   English

是否可以将Silverlight 2.0项目添加到我的Web应用程序中,并且仍然以.NET Framework 2.0为目标?

[英]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? 我可以在我的ASP.NET 2.0 Web应用程序中添加新的Silverlight 2.0项目,并且仍将Visual Studio 2008中的.NET Framework 2.0作为目标吗?

ScottGu doesn't mention Silverlight in his post on multi-targeting . ScottGu 在多目标定位中没有提及Silverlight。

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). Michael Scwartz在有关使用Visual Studio .NET 2005进行Silverlight的文章以及如何使用记事本创建Silverlight应用程序的文章中提到了VS2005或Silverlight 1.1(即RTM之前的版本)。

Has anyone else tried this yet? 还有其他人尝试过吗?

[UPDATE] [UPDATE]

Now that I've upgraded the web project I started using the Silverlight control... 现在,我已经升级了Web项目,我开始使用Silverlight控件...

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

Yes you can. 是的你可以。 Because Silverlight runs only on the client, you can invoke the Silverlight plug-in with an object tag: 由于Silverlight仅在客户端上运行,因此可以使用对象标签调用Silverlight插件:

<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: Michael关于使用object标签是正确的,但是您还需要做另外两件事:

  • 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). 在Silverlight项目中使用“生成后”步骤将生成的xap文件复制到您的Web项目中(因为Silverlight链接不适用于ASP.NET 2.0项目)。
  • Add the Siverlight.js file to the object tag'd page to get better in-place installation and plugin detection. 将Siverlight.js文件添加到对象标签的页面中,以获得更好的就地安装和插件检测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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