代码改变世界

VS2005下开发Silverlight 1.1翻译加补充

2007-07-19 20:49  Bryan Chow  阅读(2684)  评论(2编辑  收藏  举报

Well, in VS2005 you can create a class library which will build against the Silverlight runtime, but it's a little work.

1. Create a Class Library.
2. Remove all references from it.
3. Right-click on the Project and pick Properties.
4. On the Build tab, click Advanced and check 'Do not reference mscorlib.dll'
5. Manually add references to mscorlib, agclr, System, System.Core, System.Silverlight, and System.Xml.Core from the Silverlight install folder (\Program Files\Microsoft Silverlight\)

At this point your build outputs should be Silverlight consumable binaries. It looks like the equivalent command line call to csc.exe (the C# compiler) should include the references to the mentioned binaries and the /nostdlib option but may require others as well.

 -Scott

这是silverlight开发组Scott Louvau一个回复中写道的

1.创建一个类库
2.删除其中所有引用
3.右击项目选择属性
4.在“生成”选项卡中点击高级,并勾选中‘不引用mscorlib.dll'一项
5. 从Silverlight安装中文件夹(\Program Files\Microsoft Silverlight\)添加对mscorlib,agclr,System,System.Core,System.Silverlight和 System.Xml.Core的引用
6.在“生成”选项卡中,输出路径修改为ClientBin\
7.需要在iis中点击站点属性,在“HTTP Headers”标签页中,点击“MIME Types”,点击“新建”,加入以下条目(根据不同需要添加类似于mp4的条目):
mp4             video/mp4
xaml             application/xaml+xml
dll             application/x-msdownload

6和7是我自己补充的,这样就可以在vs2005下开发silverlight了,不过VS2005下不能够调试,如果实在需要调试,只好在虚拟机中安装Orcas,Orcas不可以跟VS2005并存也的确比较郁闷。


万事具备,最好在VS2005下还能有xaml的智能感知,其实这个很容易,只要找到Silverlight相应版本的SDK,在压缩包里可以得到一个schema (silverlight.xsd)文件,它对xaml文件作出了定义,只要将这个文件放入
C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas
就可以在写xaml文件的时候得到智能感知功能。

除了不能调试,VS2005几乎可以做一切Silverlight的工作。省却了庞大的Orcas,立刻Light up the web吧。