Visual Studio 2008 and .NET3.5 New Features (新特性)

Visual Studio 2008 and .NET3.5 New Features

Today we shipped Visual Studio 2008 and .NET 3.5.  You can download the final release using one of the links below:

  • If you are a MSDN subscriber, you can download your copy from the MSDN subscription site.
  • If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here.  A 90-day trial edition of Visual Studio 2008 Professional (which will be a slightly smaller download) will be available next week.  A 90-day free trial edition of Team Foundation Server can also be downloaded here.
  • If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here
  • If you want to just install the .NET Framework 3.5 runtime, you can download it here.

Quick Tour of Some of the New Features

Visual Studio 2008 and .NET 3.5 contain a ton of new functionality and improvements.  Below are links to blog posts I've done myself as well as links to videos you can watch to learn more about it:

VS 2008 Multi-Targeting Support

VS 2008 enables you to build applications that target multiple versions of the .NET Framework.  This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines.  You can learn more about how this works from my blog post here:

ASP.NET AJAX and JavaScript Support

.NET 3.5 has ASP.NET AJAX built-in (no separate download required).  In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like <asp:menu> and <asp:treeview>, WCF support for JSON, and many other AJAX improvements.

VS 2008 and Visual Web Developer 2008 also now have great support for integrating JavaScript and AJAX into your applications.  You can learn more about this from my blog posts here:

You can watch some videos that discuss ASP.NET AJAX and Visual Studio 2008 support for it here

I also highly recommend the excellent ASP.NET AJAX in Action book to learn more about ASP.NET AJAX (both client-side and server-side).

VS 2008 Web Designer and CSS Support

VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web).  This delivers support for split-view editing, nested master pages, and great CSS integration.  Below are some articles I've written that discuss this more:

ASP.NET 3.5 also has a new <asp:ListView> control that provides the ability to perform rich data scenarios with total control over the markup.  It works nicely with the new CSS support in VS 2008.  You can learn more about it from my article here:

You can watch some videos that discuss the new Visual Studio 2008 web designer features and the new ListView/DataPager controls here

Language Improvements and LINQ

The new VB and C# compilers in VS 2008 deliver significant improvements to the languages.  Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code.  These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET. 

Below are some of the articles I've written that explore these new language features using C#:

Here are a few additional blog posts I've written that show off some of the new VS 2008 code editing support and some cool ways to use these new language features:

The Visual Basic team has also created some great free videos that cover LINQ.  You can watch them here.

Data Access Improvements with LINQ to SQL

LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5.  It enables you to model relational databases using a .NET object model.  You can then query the database using LINQ, as well as update/insert/delete data from it.  LINQ to SQL fully supports transactions, views, and stored procedures.  It also provides an easy way to integrate business logic and validation rules into your data model.  Below are some of the articles I've written that explore how to use it:

I think you'll find that LINQ and LINQ to SQL makes it much easier to build much cleaner data models, and write much cleaner data code.  I'll be adding more posts to my LINQ to SQL series in the weeks and months ahead (sorry for the delay in finishing them earlier - so much to-do and so little time to-do it all!).

Scott Stanfield is also working on creating some great LINQ to SQL videos for the www.asp.net site based on my article series above (all videos are in both VB and C#).  You can watch the first 4 videos in this series here.

Browsing the .NET Framework Library Source using Visual Studio

As I blogged a few weeks ago, we will be releasing a reference version of the .NET Framework library source code as part of this release.  Visual Studio 2008 has built-in debugger support to automatically step-into and debug this code on demand (VS 2008 can pull down the source for the appropriate .NET Framework library file automatically for you).

We are deploying the source servers to enable this right now, and will be publishing the steps to turn this feature on in the next few weeks.

Lots of other improvements

The list above is only a small set of the improvements coming.  For client development VS 2008 includes WPF designer and project support.  ClickOnce and WPF XBAPs now work with FireFox.  WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data. 

Office development is much richer - including support for integrating with the Office 2007 ribbon, and with Outlook.  Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).

New WCF and Workflow projects and designers are now included in VS 2008.  Unit testing support is now much faster and included in VS Professional (and no longer just VSTS).  Continuous Integration support is now built-in with TFS.  AJAX web testing (unit and load) is now supported in the VS Test SKU.  And there is much, much more...

Installation Suggestions

People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008.  In general I'd recommend uninstalling the Beta2 bits explicitly.  As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately).  I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install.  You can then install the final release of VS 2008 and .NET 3.5 on the machine.

Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the "Reset Settings" option, and then re-pick your preferred profile.  This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

Note that VS 2008 runs side-by-side with VS 2005 - so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).

Silverlight Tools and VS Web Deployment Project Add-Ins

Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release.  These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio.  Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks.  If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available. 

PSVS 2008 Multi-Targeting Support

What is Multi-Targeting?

With the past few releases of Visual Studio, each Visual Studio release only supported a specific version of the .NET Framework.  For example, VS 2002 only worked with .NET 1.0, VS 2003 only worked with .NET 1.1, and VS 2005 only worked with .NET 2.0.

One of the big changes we are making starting with the VS 2008 release is to support what we call "Multi-Targeting" - which means that Visual Studio will now support targeting multiple versions of the .NET Framework, and developers will be able to start taking advantage of the new features Visual Studio provides without having to always upgrade their existing projects and deployed applications to use a new version of the .NET Framework library.

Now when you open an existing project or create a new one with VS 2008, you can pick which version of the .NET Framework to work with - and the IDE will update its compilers and feature-set to match this.  Among other things, this means that features, controls, projects, item-templates, and assembly references that don't work with that version of the framework will be hidden, and when you build your application you'll be able to take the compiled output and copy it onto a machine that only has an older version of the .NET Framework installed, and you'll know that the application will work.

Creating a New Project in VS 2008 that targets .NET 2.0

To see an example of multi-targeting in action on a recent build of VS 2008 Beta 2, we can select File->New Project to create a new application. 

Notice below how in the top-right of the new project dialog there is now a dropdown that allows us to indicate which versions of the .NET Framework we want to target when we create the new project.  If I keep it selected on .NET Framework 3.5, I'll see a bunch of new project templates listed that weren't in previous versions of VS (including support for WPF client applications and WCF web service projects):

If I change the dropdown to target .NET 2.0 instead, it will automatically filter the project list to only show those project templates supported on machines with the .NET 2.0 framework installed:

If I create a new ASP.NET Web Application with the .NET 2.0 dropdown setting selected, it will create a new ASP.NET project whose compilation settings, assembly references, and web.config settings are configured to work with existing ASP.NET 2.0 servers:

When you go to the control Toolbox, you'll see that only those controls that work on ASP.NET 2.0 are listed:

And if you choose Add->Reference and bring up the assembly reference picker dialog, you'll see that those .NET class assemblies that aren't supported on .NET 2.0 are grayed out and can't be added to the project (notice how the "ok" button is not active below when I have a .NET 3.0 or .NET 3.5 assembly selected):

So why use VS 2008 if you aren't using the new .NET 3.5 features?

You might be wondering: "so what value do I get when using VS 2008 to work on a ASP.NET 2.0 project versus just using my VS 2005 today?"  Well, the good news is that you get a ton of tool-specific value with VS 2008 that you'll be able to take advantage of immediately with your existing projects without having to upgrade your framework/ASP.NET version.  A few big tool features in the web development space I think you'll really like include:

  1. JavaScript intellisense
  2. Much richer JavaScript debugging
  3. Nested ASP.NET master page support at design-time
  4. Rich CSS editing and layout support within the WYSIWYG designer
  5. Split-view designer support for having both source and design views open on a page at the same time
  6. A much faster ASP.NET page designer - with dramatic perf improvements in view-switches between source/design mode
  7. Automated .SQL script generation and hosting deployment support for databases on remote servers

You'll be able to use all of the above features with any version of the .NET Framework - without having to upgrade your project to necessarily target newer framework versions.  I'll be blogging about these features (as well as the great new framework features) over the next few weeks.

So how can I upgrade an existing project to .NET 3.5 later?

If at a later point you want to upgrade your project/site to target the NET 3.0 or NET 3.5 version of the framework libraries, you can right-click on the project in the solution explorer and pull up its properties page:

You can change the "Target Framework" dropdown to select the version of the framework you want the project to target.  Doing this will cause VS to automatically update compiler settings and references for the project to use the correct framework version.  For example, it will by default add some of the new LINQ assemblies to your project, as well as add the new System.Web.Extensions assembly that ships in .NET 3.5 which delivers new ASP.NET controls/runtime features and provides built-in ASP.NET AJAX support (this means that you no longer need to download the separate ASP.NET AJAX 1.0 install - it is now just built-in with the .NET 3.5 setup):

Once you change your project's target version you'll also see new .NET 3.5 project item templates show up in your add->new items dialog, you'll be able to reference assemblies built against .NET 3.5, as well as see .NET 3.5 specific controls show up in your toolbox. 

For example, below you can now see the new <asp:listview> control (which is an awesome new control that provides the ability to do data reporting, editing, insert, delete and paging scenarios - with 100% control over the markup generated and no inline styles or other html elements), as well as the new <asp:linqdatasource> control (which enables you to easily bind and work against LINQ to SQL data models), and <asp:datapager> control show up under the "Data" section of our toolbox:

Note that in addition to changing your framework version "up" in your project properties dialog, you can also optionally take a project that is currently building against .NET 3.0 or 3.5 and change it "down" (for example: move it from .NET 3.5 to 2.0).  This will automatically remove the newer assembly references from your project, update your web.config file, and allow you to compile against the older framework (note: if you have code in the project that was written against the new APIs, obviously you'll need to change it).

What about .NET 1.0 and 1.1?

Unfortunately the VS 2008 multi-targeting support only works with .NET 2.0, .NET 3.0 and .NET 3.5 - and not against older versions of the framework.  The reason for this is that there were significant CLR engine changes between .NET 1.x and 2.x that make debugging very difficult to support.  In the end the costing of the work to support that was so large and impacted so many parts of Visual Studio that we weren't able to add 1.1 support in this release. 

VS 2008 does run side-by-side, though, with VS 2005, VS 2003, and VS 2002.  So it is definitely possible to continue targeting .NET 1.1 projects using VS 2003 on the same machine as VS 2008. 

What is compatibility like moving from VS 2005 to VS 2008 and .NET Framework 2.0 to 3.5?

We are trying to make sure that .NET Framework 3.5 is a super compatible upgrade from .NET 2.0, and not require you to change any code in order to target the new framework version.  We've deliberately made only non-breaking modifications to existing .NET assemblies in the .NET 3.5 release, and where possible added new features in separate assemblies to minimize the chance of breaking changes.

We are also not making project model or build changes with VS 2008.  I, like you, hope to never to go through that again!  Both the "web site" and "web application project" models will be fully supported going forward.

一些开发新特性之快速指南

VS 2008的多定向支持

VS 2008允许你构建针对多个.NET框架版本的应用。你可以从下面的博客贴子里进一步了解其中的工作原理:

VS 2008 Web设计器和CSS支持

VS 2008包含一个显著改进的HTML web设计器。该设计器提供了分割视图编辑,嵌套母板页,以及出色的CSS集成。下面是我对此作了详述的2篇文章:

ASP.NET还提供了一个新的<asp:ListView>控件,不久的将来我将在博客里讨论该控件。该控件对数据UI场景提供了非常灵活的支持,允许对输出的标识做完全的定制,与VS 2008中的新CSS支持还有良好的协作。

ASP.NET AJAXJavaScript支持

.NET 3.5 内置提供ASP.NET AJAX,还添加了支持WebPartUpdatePanel,支持JSONWCF,以及N个缺陷修补和性能改进等方面的新特性。VS 2008还对集成JavaScriptAJAX进你的应用提供了极棒的支持:

在接下来的几天内,我将撰写一个博客贴子,讨论其中几个特定于ASP.NET AJAX的改进,以及如何将现有ASP.NET AJAX 1.0应用升级来使用这些改进。

语言改进和LINQ

VS 2008中的新VBC#编译器对这些语言做了显著的改进。两者都添加了函数式编程概念的支持,允许你编写更干净,更简洁,更具有表达性的代码。这些特性还促成了我们称之为LINQ(语言级集成查询)的新编程模型,使得查询和操作数据成为.NET中的一等编程概念。

下面是我撰写的一些讨论这些新语言特性的文章(用C#作为示例):

LINQ to SQL中的数据访问改进

LINQ to SQL.NET 3.5中内置的OR/M (对象关系映射器)。它允许你使用.NET 对象模型对关系数据库进行建模。然后你可以使用LINQ对数据库进行查询,以及更新、插入,删除数据。LINQ to SQL完整支持事务,视图和存储过程。它还提供了一个把业务逻辑和验证规则结合进你的数据模型的简易方式。下面是一些我讨论如何使用LINQ to SQL的文章:

我会在以后的几周内再往这个系列里添加几篇文章。我认为你会发现LINQ to SQL显著地简化了构建非常干净的数据模型以及编写极其干净的数据代码。

说不尽的其他改进

上面的列表只是所做改进的一小部分。针对客户端开发,VS 2008 包含了WPF设计器和项目支 持。ClickOnce WPF XBAPs现在在FireFox中也工作了。WinFormsWPF项目现在也能使用ASP.NET 应用服务(成员,角色和用户数据)来漫游用户数据了。办公开发也更加丰富了,包括对Office 2007 Ribbon的集成支持。WCFWorkflow项目和设计器也包括在VS 2008中了。单元测试的速度大为提高,而且单元测试的支持现在包括在VS Professional版本(而不仅仅是VSTS版了)中了。连续集成支持现在也内置于TFS中了。AJAX web测试(单元和压力)现在也由VS Test产品支持了。还有许许多多多的改进,这里无法一一提及了。

重要的安装注意事项 - 务必阅读一下!

在安装VS 2008 .NET 3.5 Beta2之后,还有2件重要的事情你应该马上做:

1) 你应该下载和运行这个批文件。这只要几秒钟就可以运行完,它修补了这个星期早些时候我们发现的System.Web.Extensions.dll版本政策的问题,该程序集包含了 ASP.NET AJAX。如果你不运行这个批文件,那么用ASP.NET AJAX 1.0 VS 2005构建的现有的ASP.NET 2.0项目就会自动地运载随 .NET 3.5 Beta2发布的新ASP.NET AJAX 版本。这会工作而且运行良好,但会不小心导致你的VS2005应用依赖于.NET 3.5。运行这个批文件会改变新的System.Web.Extensions.dll 程序集的版本绑定政策,确保你只在你明确构建.NET 3.5项目时才使用新的.NET 3.5 ASP.NET AJAX版本。

2) 假如你曾经在你的机器上安装过OrcasVS 2008的早期版本(Beta1 或某个CTP 版本)的话,你需要在安装Beta2后重新设定你的VS 2008设置。如果你不这么做的话,有些设置会非常奇怪(一些窗口在出现在奇怪的地方),你也有可能看到一些IDE性能问题。你可以在命令行上对VS 2008IDE版本键入“DevEnv /resetsettings”来重新设定你的配置:

结语

VS 2008.NET 3.5中,我希望你会发现许许多多非常有用的新改进和功能增强。敬请在下几个星期里收看我的博客,我将对这些新特性做详细讨论以及讨论如何充分利用这些新特性。

文章来自:Scott的blog

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值