vs2010及.netFramework资料整理

来源:互联网 发布:淘宝店铺现状分析 编辑:程序博客网 时间:2024/05/18 15:56

Visual Studio 2010 and .NET Framework 4 Training Kit

The Visual Studio 2010 and .NET Framework 4 Training Kit 包括演示,动手实践,例子。这些内容帮助你了解Visual Studio 2010特性和.Net4.0框架技术,包括以下内容:

  • C# 4.0
  • Visual Basic 10
  • F#
  • Parallel Extensions
  • Windows Communication Foundation
  • Windows Workflow
  • Windows Presentation Foundation
  • ASP.NET 4
  • Entity Framework
  • ADO.NET Data Services
  • Managed Extensibility Framework
  • Visual Studio Team System

这个动手试验包版本是Visual Studio 2010 Beta 1 and .NET Framework 4 Beta 1。

下载地址:http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=752cb725-969b-4732-a383-ed5740f02e93

VS 2010 Beta 2版,可能在2010年 H2推出,正式版则要......

 

.NET 4.0有別于 .NET 2.0~3.5的功能增强, .NET 4.0有很多新特性:

 

====================================


VS2010 CTP 初体验
再看看.NET FX4.0:


CLR 版本已经到4.0了,而2.0~3.5的CLR版本都是2.0。
安装的.NET版本挺全的:-)


下图可看出各个程序集都有了4.0的版本。


看看IIS,ASP.NET已版本有了4.0的。

上图还可以看出,镜像安装了SharePoint(WSS 3.0)

概况基本上就是这样,使用方法语言机制变化和FCL更新等慢慢研究。

=========================

 

asp.net4.0的新特性入门概述

前言:asp.net4.0出来很长一段时间了,可是笔者自己还在学习和使用2.0做项目。为了不至于目光太短浅,在学习能力还没有被废掉之前,看了几篇介绍4.0的文章。现在总结一下,做个笔记,入门学习一下。如果将来将每个新特性都深入使用一遍最好^_^。
1、控制ViewState -- 现在EnableViewState这个属性默认是True,很多时候即使我们并不需要它,但是很多开发人员极少去将它设置为False(怕出现问题或者根本不知道,这点笔者也要检讨),asp.net的资源很大一部分是浪费在这个上面的。在4.0中,改变了这种做法,EnableViewState默认是False,这其实也变相提高了开发者的要求,因为开发者必须清楚知道哪些ViewState需要设置为True。
英文原文是这么说的:
 Control over View State -- Currently, view state is enabled for all controls by default. Most developers are pretty lazy about disabling view state when they don't need it. In ASP.NET Web Forms 4.0, you can invert the normal state of things and disable view state by default.
2、控制客服端IDs -- 这个特性将大大减少客户端工作量,你可以在服务器端生成html标签用javascript与css。对于很多从事asp.net的开发者而言,js操作服务器控件是很不爽的(和jsp及php比起来,这或者是asp.net被人诟病的一个短板),估计是群众的呼声让ms最后妥协了。有了4.0,获取服务器控件id就像其他动态页面技术一样轻松(忘掉讨厌的绑定和ClientID获取dom元素的id吧)。
英文原文: 
Control over client IDs -- This is a welcome feature for those of us who do a lot of client-side programming.
This change will make it much easier to target HTML tags rendered by server-side controls with JavaScript
and Cascading Style Sheets.
3、更好的支持web开发标准 -- 这个估计ms也是顺应潮流吧,ie7,8都向web标准靠拢设计出来了。不过ms还保留有很多自己的标准,所以才说“更好的支持”而没有说“完全兼容”,想统一标准,难哪。
英文原文:
Better support for web standards -- Several improvements have been made to the ASP.NET Web Forms 4.0 framework that enable you to more easily build websites that are compliant with web standards such as XHTML and Accessibility standards. For example, you can prevent a FormView control from rendering an HTML table automatically.
4、QueryExtender 控件 --每次ms出新东西,似乎总有让程序员变得更傻的创举。 用新的QueryExtender控件能使你更容易过滤数据检索EntityDataSource或者LinqDataSource控件。对于拖控件的开发者而言,再轻松不过了。
英文原文: 
 QueryExtender Control -- The new QueryExtender control enables you to easily filter data retrieved by
the EntityDataSource or LinqDataSource controls. You can use it to easily create search pages.
5、搜索引擎的优化 (SEO) -- 更加友好的URLs使得搜索引擎更容易去索引你的网页。
英文原文:
Search Engine Optimization (SEO) -- There are several new features added to the ASP.NET framework
that make it easier to get your website pages indexed by search engines. For example, the new ASP.NET Web Forms Routing framework enables you to expose your ASP.NET pages with more intuitive URLs.
6、动态数据的改进 -- Entity模板使你能创建模板为显示、修改,还有创建新的实体对象,一如既往,方便的一塌糊涂。
英文原文:
Improvements to Dynamic Data -- Several great new features are being added to Dynamic Data. My favorite new feature is Entity Templates which enable you to create templates for display, editing, and inserting new instances of an entity (such as a Product entity).

 

==============================================

This is the third in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release.

Today’s post discusses VS 2010’s enhanced multi-targeting support – which allows you to use and target multiple versions of .NET.  We did significant architectural work in the VS 2010 release to enable a number of new multi-targeting features, and provide a much better experience.

Understanding Side-by-Side

VS 2010 can be installed “side by side” with previous versions of Visual Studio.  What this means is that you can install it on the same machine as VS 2008/VS 2005/VS 2003 – and use all of the versions at the same time if you’d like.

.NET 4.0 can also be installed “side by side” with previous versions of .NET on the same machine.  .NET 4.0 has a new version number for both the framework libraries and CLR engine – which means it runs completely independently from .NET 2.0, 3.0 and 3.5.  What this means is that you can install .NET 4.0 on a machine that has .NET 2.0/3.0/3.5 installed, and configure some applications to run using .NET 4.0 and others to run using the older .NET versions (the IIS admin tool allows you to configure this for ASP.NET applications).  This allows you to use .NET 4.0 for new applications - without having to necessarily test and upgrade all your existing ones.

VS 2008’s Multi-Targeting Support

VS 2008 was the first release of Visual Studio that included multi-targeting support for .NET.  What this meant was that you could use VS 2008 to create and edit not only .NET 3.5 projects, but also .NET 3.0 and .NET 2.0 projects as well.  This allowed developers to more quickly upgrade and take advantage of new Visual Studio tooling features – without having to necessarily require the newer version of .NET to be installed on the clients and production servers running their applications.

VS 2008’s multi-targeting support was able to take advantage of the fact that .NET 2.0, .NET 3.0, and .NET 3.5 all ran on top of the same version of the CLR – and that the primary difference between the .NET versions was in their framework libraries.  As a result, Visual Studio’s compilers were able to generate the same IL output, the debugger was able to debug against the same CLR engine, and the IDE support for multi-targeting was primary focused on filtering out new assemblies and project templates from showing up when they weren’t supported with a given .NET version.

This multi-targeting experience worked – although it wasn’t perfect.  Intellisense within VS 2008 always shows the types and members for the .NET 3.5 version of a framework library (even if you are targeting .NET 2.0).  This means that you can sometimes inadvertently end up using a method that is only in ASP.NET 3.5 even when you are working on a ASP.NET 2.0 project.

VS 2010’s Multi-Targeting Support

We made some pretty major architectural changes with VS 2010 to enable much better and more accurate multi-targeting support.

VS 2010 now ships what we call “reference assemblies” for each version of .NET.  A “reference assembly” contains only the metadata of a particular framework assembly – and not its actual implementation (making it much smaller in size on disk).  This metadata is enough, though, to ensure that VS 2010 can always provide 100% accurate intellisense when targeting a particular version of the .NET framework. It also means that properties exposed through the property grid within designers, API listings within the Object Browser, and all the other various places within the IDE accurately reflect the exact API version signature.

We also updated the VS 2010 debugger, profiler and compilers to be able to target multiple versions of the CLR.

Using VS 2010’s Multi-Targeting Support

To get a better understanding of how these new multi-targeting features work, let’s create a new ASP.NET Web Application using VS 2010.  To-do this we can use the “File->New Project” menu command to bring up the “New Project” dialog.  We’ll use the version drop-down at the top of the dialog to filter the project templates to only show those supported with .NET 2.0.  We’ll then create a new ASP.NET 2.0 web application project:

step1

Because we are targeting .NET 2.0 with this project, VS 2010 will automatically filter the toolbox and markup intellisense to only allow us to use those controls that shipped in ASP.NET 2.0.  Unlike VS 2008, the VS 2010 property grid now automatically filters to only show those properties that were supported on the ASP.NET 2.0 button control: 

step2

When writing code, VS 2010 will also now only show code intellisense for those types and methods/properties/events supported with .NET 2.0.  Below you can see intellisense for the ASP.NET 2.0 “Response” object when we type “Response.Re”:

step3

When we run the application using the built-in VS web-server, it will run using the ASP.NET 2.0 version (and the VS 2010 debugger will debug the CLR 2.0 process):

step5

Moving a Project from .NET 2.0 to .NET 4.0

We can optionally retarget our project to work with a later version of .NET by right-clicking on the project within the solution explorer and by bringing up its properties dialog.  We can select the “target framework” dropdown within it and select the version of the .NET Framework we want to target:

stp8

We can choose from a variety of different .NET versions above.  Included in the list is the "Server Core” profile that supports the GUI-less version of Windows Server 2008 R2 – and which does not support certain APIs.  Because the reference assemblies we use for metadata and intellisense can support any version or release, we’ll even be able to distribute versions of them with future service packs if they introduce any new APIs (enabling 100% accuracy).

For this walkthrough, we’ll choose to move the project to use .NET 4.0.  When we do this, VS 2010 will automatically update the project reference assemblies and the web.config file of our project to properly reflect the new version.

Once we do this, VS 2010 will filter the toolbox and markup intellisense to show us all of the new controls and properties available in the ASP.NET 4.0 version.  For example, the property grid below now displays the new “ClientIDMode” property available on all controls in ASP.NET 4.0 - which gives you the ability to control how client id’s are output and avoid ugly client ids (a new ASP.NET 4.0 feature I’ll cover in a later blog post):

stp9

Now that we’ve upgraded the project to use .NET 4.0, VS 2010 will also now show us code intellisense for the new types and methods/properties/events on types in .NET 4.0.  For example, below you can see some of the new redirect methods available on the ASP.NET 4.0 “Response” object (which previously did not show up when the project was targeting .NET 2.0):

step7

The new Response.RedirectPermanent() method above makes it easy to issue “HTTP 301 Moved” responses – which can avoid your site accumulating stale links in search engines. The URL Routing engine is now supported by both ASP.NET Web Forms and ASP.NET MVC based applications, and the new Response.RedirectToRoute() method allows you to easily redirect to a route declared with it.

And lastly when we run the application using the built-in VS web-server, VS 2010 will now run it using the ASP.NET 4.0 version:

step9

Summary

VS 2010’s multi-targeting support enables you to work on projects that target .NET 4.0, .NET 3.5, .NET 3.0 and .NET 2.0.  It will allow you to start taking advantage of the new tooling features, without having to immediately upgrade the clients and servers running your application’s to .NET 4.0.  The improved multi-targeting support will ensure that this experience is even better and more accurate than before. 

Hope this helps,

Scott

P.S. In addition to blogging, I have been using Twitter more recently to-do quick posts and share links.  You can follow me on Twitter at: http://www.twitter.com/scottgu (@scottgu is my twitter name)