在一个Asp.Net解决方案中集成Silverlight控件最佳实践 [英] Best practice for integrating a silverlight control in a Asp.Net Solution
问题描述
我需要关于Silverlight控件,我需要融入现有的网站,$ C $光盘Asp.Net的处理一些建议。
I need some advice regarding the handling of a Silverlight control that I need to integrate into an existing Website, coded with Asp.Net.
我使用SVN,Visual Studio 2010中,框架4.0。我需要创建一个简单的Silverlight控件,我需要把它嵌在我的asp.net页面之一。
I'm using SVN, Visual Studio 2010, Framework 4.0. I need to create a simple silverlight control and I need to have it embedded in one of my asp.net pages.
我的问题是,基本上,什么是对的地方把这个Silverlight控件的最佳做法?
My question is basically, what is the best practice on where to put this Silverlight control?
1)创建一个新的项目我的Silverlight控件,然后通过外部工具网站内引用它? (进口只有.xap文件?)
1) Creating a new project for my Silverlight control and then refer to it through an external tools within my website? (importing only the .xap?)
+重用
- 好像很多额外的工作的一个小控制
+ Reuse
- Seems lot of extra work for a small control
2)创建一个新项目withing我的网站解决方案,编译它旁边的我的网站,并创建一个后生成事件复制生成到的ClientBin文件夹中的.xap文件在我的网站?
2) Create a new project withing my website solution, compile it next to my website and create a post build event to copy the .xap generated into a ClientBin folders in my website?
- 缺乏可重用性的
+易使小的修改在我的Silverlight组件。
- Lack of reusability
+ Easy to make small modifications in my Silverlight component.
3)另一种解决方案我还不知道?
3) Another solution I don't know yet??
感谢您的意见
推荐答案
不要担心项目数量。重用是更为重要的(我们有超过100个项目的解决方案)。
Do not worry about number of projects. Reuse is far more important (we have solutions with over 100 projects).
创建一个新的Silverlight应用程序,然后添加网站和新的Silverlight应用程序之间的关系Silverlight的:
Create a new Silverlight application, then add a Silverlight relationship between the website and your new Silverlight application:
- 在您的网站项目点击右键并选择
属性
。 - 选择左侧的
Silverlight应用程序
标签 - preSS
添加...
- 将
在
检查该解决方案使用现有的Silverlight项目,然后选择你想从项目新增项目
下拉列表。 - 将
添加一个测试页面引用如果你想要一个单独的测试页为您的应用
检查控制。 - preSS
添加
和你做。
- Right-click on your website project and select
Properties
. - Choose the
Silverlight Applications
tab on the left side - Press
Add...
- Leave
Use an existing Silverlight project in the solution
checked and select the project you want to add from theProject
dropdown. - Leave
Add a test page that references the control
checked if you want a separate test page for your application. - Press
Add
and you are done.
现在的网站将建立你的Silverlight应用程序,并在其ClientBin目录输出XAP文件。
The website will now build your Silverlight application and include the output Xap file in its ClientBin folder.
如果您勾选添加一个测试页面,这将使你的样品HTML / ASPX页面和JavaScript,你需要在你的ASP.Net应用程序在任何地方运行Silverlight的组成部分。
If you check "add a test page", that will give you sample HTML/ASPX pages and the JavaScript you need to run the Silverlight component anywhere in your ASP.Net app.
这篇关于在一个Asp.Net解决方案中集成Silverlight控件最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!