Visual Studio 2010 Property Grid Filtering

Web Development Tools Microsoft

Visual Studio 2010 improves .NET framework multi-targeting by applying framework-appropriate filtering to the property grid and Intellisense.

For example, if you select a button on a web form of a .NET 2.0 web project, in the Property Grid you  will see:

Button20

If you go to the Project Properties and change the Target Framework version to 4.0:

sel_framework

…the Property Grid display will change to display 4.0-specific properties:

Button40

While this looks simple and straight-forward, there’s actually an illusion at work!  Only one framework can be loaded into an AppDomain at a time, and Visual Studio uses .NET 4.0 specific capabilities.  So the actual controls displayed on the design surface are always 4.0 controls.  Their properties are filtered for display in the Property Grid and Intellisense to match the Target Framework displayed in the Project Properties.

Setting the Target Framework in the Project Properties writes to the targetFramework attribute of the compilation tag in web.config file as well.  The web.config setting is used by the build system, which is responsible for generating the errors and warnings that appear in the Error List.  So do not manually change the Target Framework by hand-editing the web.config file, use the Project Properties instead.  This will ensure that the entire project system is using the same setting.

0 comments

Discussion is closed.

Feedback usabilla icon