Visual Studio 2005 开发 Silverlight 1.0 (转)

如果大家已经在使用Visual Studio 2005做开发,现在又需要学习开发Silverlight应用程序。下面我们简单的介绍一下如何在VS2005中开发Silverlight。

首先需要下载Silverlight 1.0 Beta SDK。安装Silverlight开发模板

方法如下:

1、确认VS2005已经安装SP1,如果没有安装请下载安装(强烈建议安装SP1)。下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyID=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&DisplayLang=en
2、安装Silverlight项目模板。确认关闭VS2005,将Silverlight1.0SDK/ SilverlightBetaToolsForVS2005.zip压缩包中的SilverlightJSApplication.zip复制到 <Documents>/Visual Studio 2005/Templates/ProjectTemplates/Visual C#目录下。
3、再次打开VS2005,打开新建项目对话框,你将看到Silverlight Javascript Application的项目模板

就这么简单,大家可以试一下。

注意:这个环境还不能开发Silverlight 1.1 alpha程序。如果需要建议安装Orcas beta




 使用Visual Studio 2005开发Silverlight 1.1应用

    * 1
    *

如果你想尝试开发 Silverlight 1.1 应用,又对下载/安装推荐的Visual Studio Orcas Beta 1有点怕怕的话,你可以使用Visual Studio 2005和Expression Blend 2 五月份的预览版 (25.5M)来开发。

根据Bryant Likes的博客,在安装Silverlight 1.1 alpha运行时后,你可以在Visual Studio 2005里,

1. 创建一个类库
2. 删除该项目所有的引用
3. 右击项目,选择属性
4. 在项目属性页的Build页上,点击“高级”按钮,选择“别引用mscorlib.dll”复选框
5. 手工添加对 Silverlight 1.1 alpha 运行时的安装文件夹 (/Program Files/Microsoft Silverlight/ ) 里的 mscorlib, agclr, System, System.Core, System.Silverlight, 和 System.Xml.Core程序集的引用

他有一个例程你可以试一下。
Silverlight Hello World in C# from VS 2005
Well I've been downloading the VS Orcas for a few days and it still isn't done. I really wanted to try out the .NET support in Silverlight 1.1 and so I asked if this could be done with VS 2005 and Scott Louvau replied:

    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

I tried it out and it work pretty well. If you're interested I've uploaded my project so that you can download it and try it out. You will need Silverlight 1.1 installed and VS studio 2005.

Download the sample code here

I've also posted the code to my server but I couldn't figure out how to setup IIS to allow DLL files to be downloaded. Maybe tomorrow.

猜你喜欢

转载自blog.csdn.net/xxben/article/details/6424701