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

时间:2023-01-17 14:11:55

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?

我可以将新的Silverlight 2.0项目添加到我的ASP.NET 2.0 Web应用程序中,并仍然在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 (i.e. pre-RTM).

Michael Scwartz在使用Visual Studio .NET 2005的Silverlight上的帖子以及如何使用Notepad创建Silverlight应用程序是指VS2005或Silverlight 1.1(即RTM之前)。

Has anyone else tried this yet?

还有其他人试过吗?

[UPDATE]

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

现在我已经升级了web项目,我开始使用Silverlight控件...

3 个解决方案

#1


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项目中的Post-Build步骤将构建的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文件添加到对象标记页面以获得更好的就地安装和插件检测。

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

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

#3


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>

#1


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项目中的Post-Build步骤将构建的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文件添加到对象标记页面以获得更好的就地安装和插件检测。

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

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

#3


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>