WPF performance and .NET Framework Client Profile related blogs provided by Jossef Goldberg.
Hopefully folks have seen Soma’s blog announcing the availability of Beta 2 of Visual Studio 2010 and .NET Framework 4. In .NET Framework 4 we have introduced a streamlined subset and more compact version of the .NET Framework called the Microsoft .NET Framework 4 Client Profile (aka NET4 Client Profile). The Microsoft .NET Framework 4 which is the Full Framework (aka NET4 Full) still exists and it is a superset of the Client Profile.
The Client Profile is smaller in size and its goal is to improve the deployment size, time, reliability and overall deployment experience for client applications.
The Client Profile contains the functionality that most common desktop client applications (including Windows Forms and WPF applications) would need, so we expect that many client application developers will target it. This will improve the overall application deployment experience when the application requires .NET Framework 4 to be installed.
One of the most important improvement over NET 3.5 SP1 Client Profile, is NET4 Client Profile is now supporting all platforms and OS's that are supported by the Full Framework including Vista, XP, Win2k3, Win2k8, Windows7, x86/x64 (excluding IA64).
Few desktop applications may still need to target the NET4 Full if they must use features that are not included in the NET4 Client Profile.
My previous blog discussed Beta1, in this blog I will focus on Beta 2.
Keeping the Client Profile small provides:
Below are the redistributable download size improvements since NET 3.5 SP1. This shows that on x86, with NET4 Client Profile you can save up to 86% of the Framework deployment size compare to 3.5 SP1 Full. Note that if you are downloading from the Web, the actual download size could be smaller since some components may already be on your machines (for example, Windows Imaging Components, Software Rasterizer (rgb9rast) , etc ) 3.5 SP1 4.0 Beta1 4.0 Beta2 32 bit Client Profile Online: ~28 MB** Offline: 255 MB 34.2 MB 30.9 MB 32 + 64 bit Client Profile N/A 71.3 MB 47.1 MB 32 bit Full N/A 76.5 MB 37.7 MB 32 + 64 bit Full N/A 157 MB 54.5 MB 32 + ia64 bit Full N/A 161.6 MB 56.4 MB 32 + 64 + ia64 bit Full 231 MB N/A N/A ** NET 3.5 SP1 Client Profile web download install ~28mb on XP machines that have no framework, it otherwise installs the NET 3.5 SP1 Full. See more here.
Below are the redistributable download size improvements since NET 3.5 SP1. This shows that on x86, with NET4 Client Profile you can save up to 86% of the Framework deployment size compare to 3.5 SP1 Full.
Note that if you are downloading from the Web, the actual download size could be smaller since some components may already be on your machines (for example, Windows Imaging Components, Software Rasterizer (rgb9rast) , etc )
3.5 SP1
4.0 Beta1
4.0 Beta2
32 bit Client Profile
Online: ~28 MB**
Offline: 255 MB
34.2 MB
30.9 MB
32 + 64 bit Client Profile
N/A
71.3 MB
47.1 MB
32 bit Full
76.5 MB
37.7 MB
32 + 64 bit Full
157 MB
54.5 MB
32 + ia64 bit Full
161.6 MB
56.4 MB
32 + 64 + ia64 bit Full
231 MB
** NET 3.5 SP1 Client Profile web download install ~28mb on XP machines that have no framework, it otherwise installs the NET 3.5 SP1 Full. See more here.
Client Profile: We recommend that the NET4 Client Profile be utilized as the primary framework for most client desktop applications (including Windows Forms and WPF apps). Since we are considering to make the NET4 Client Profile available broadly to desktops via Windows Update, most client desktops may have NET4 Client Profile soon after NET4 releases making it ubiquitous*. Until that time, NET4 apps can chain-install the NET4 Client Profile which is smaller and faster to install. *Note: This plan is not final.
Client Profile: We recommend that the NET4 Client Profile be utilized as the primary framework for most client desktop applications (including Windows Forms and WPF apps). Since we are considering to make the NET4 Client Profile available broadly to desktops via Windows Update, most client desktops may have NET4 Client Profile soon after NET4 releases making it ubiquitous*. Until that time, NET4 apps can chain-install the NET4 Client Profile which is smaller and faster to install.
*Note: This plan is not final.
Full framework: The Full framework is a superset of the Client Profile. It should mainly be used for:
In Beta2 we made some significant changes to the NET4 Client Profile. The main changes include:
Visual Studio 2008 introduced multi-targeting for application projects to target 2.0 and 3.x versions of the .NET Framework. Visual Studio 2010 has improved multi-targeting in order to allow developers to easily target the new NET4 Client Profile. As a matter of fact, starting in Beta2 many of the client projects are targeting the NET4 Client Profile by default.
These projects are now target the NET4 Client Profile by default: Windows Project (C# and VB) - WPF Application - WPF Browser Application - WPF Custom Control Library - WPF User Control Library - Windows Forms Application - Windows Forms Control Library - Console Application - Empty Project - Window Service Visual F# - F# Application - F# Tutorial Workflow (C# & VB) - Activity Designer Library - Activity Library - Workflow Console Application WCF (C# & VB) - WCF Service Library Office 2007 & 2010 templates (C# & VB) - All Projects All other projects, including Class Library, target the Full Framework by default. Mixed-target scenarios using Class Library may provide build errors, read more here.
These projects are now target the NET4 Client Profile by default: Windows Project (C# and VB) - WPF Application - WPF Browser Application - WPF Custom Control Library - WPF User Control Library - Windows Forms Application - Windows Forms Control Library - Console Application - Empty Project - Window Service
Visual F# - F# Application - F# Tutorial
Workflow (C# & VB) - Activity Designer Library - Activity Library - Workflow Console Application
WCF (C# & VB) - WCF Service Library
Office 2007 & 2010 templates (C# & VB) - All Projects
All other projects, including Class Library, target the Full Framework by default. Mixed-target scenarios using Class Library may provide build errors, read more here.
To change targeting of your project, open the project properties, select the "Application" page, and change the “Target framework” drop-down. C# project example: VB project example (Project Properties > Compile tab > “Advanced Compile Options…”): Note that if you right-click the project and select “Add References…”, the dialog shows only the .NET Framework assemblies that are part of the selected profile. This is accomplished by using reference assemblies (metadata-only versions of assemblies). The .NET Framework 4 Client Profile Reference Assemblies are located in: %programfiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client At compile time, the reference assemblies are matched up against the known "Client List" assemblies that are included in the Client Profile. If a project targeting the Client Profile has a reference to a .NET assembly that is not included in the "Client List", Visual Studio displays compile-time errors in the Error List.
To change targeting of your project, open the project properties, select the "Application" page, and change the “Target framework” drop-down.
C# project example:
VB project example (Project Properties > Compile tab > “Advanced Compile Options…”):
Note that if you right-click the project and select “Add References…”, the dialog shows only the .NET Framework assemblies that are part of the selected profile. This is accomplished by using reference assemblies (metadata-only versions of assemblies). The .NET Framework 4 Client Profile Reference Assemblies are located in: %programfiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client
At compile time, the reference assemblies are matched up against the known "Client List" assemblies that are included in the Client Profile. If a project targeting the Client Profile has a reference to a .NET assembly that is not included in the "Client List", Visual Studio displays compile-time errors in the Error List.
Some other VS 2010 projects such as Managed C++ (Visual C++/CLR) still target the Full Framework by default. VS 2010 unfortunately does not provide UI to change the targeting. Fortunately, you can still edit the project file manually in order to change the profile targeting. To do so: Right click “Unload Project” Right-Click “Edit <project_name>” Set the appropriate project property to target Client Profile. e.g. <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkProfile>Client</TargetFrameworkProfile> Right click “Reload Project” In addition, for these projects, notice that VS does not create an <app.config> file for your project. If your project does not add references or access assemblies that are included in the Full Framework but are not part of the Client Profile, there is nothing to worry about. Your app will run on machines with either NET4 Client Profile or Full Framework just fine. Otherwise, if you do access assemblies from the Full Framework, you should add <app.config> to indicate to CLR not to load your app if it is launched on the NET4 Client Profile. E.g. add this <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> If you don’t do so, your app may crash at random when it needs to load the assemblies that are missing from the Client Profile.
Some other VS 2010 projects such as Managed C++ (Visual C++/CLR) still target the Full Framework by default. VS 2010 unfortunately does not provide UI to change the targeting.
Fortunately, you can still edit the project file manually in order to change the profile targeting. To do so:
In addition, for these projects, notice that VS does not create an <app.config> file for your project. If your project does not add references or access assemblies that are included in the Full Framework but are not part of the Client Profile, there is nothing to worry about. Your app will run on machines with either NET4 Client Profile or Full Framework just fine. Otherwise, if you do access assemblies from the Full Framework, you should add <app.config> to indicate to CLR not to load your app if it is launched on the NET4 Client Profile. E.g. add this
<?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>
If you don’t do so, your app may crash at random when it needs to load the assemblies that are missing from the Client Profile.
The project Publish property page allows you to select the prerequisite needed for your ClickOnce deployment. In Beta2, VS2010 automatically selects the correct profile (Client Profile or Full) depending on your primary project target.
The same prerequisite dialog from above appears when you create “Setup and Deployment” (under “Add New Project”/“Other Project Types”). The NET4 Client Profile prerequisite entry is checked by default in this case.
If you create a new “Visual Studio Installer” setup project (under “Setup and Deployment“) and add the output of your NET4 Client Profile to it (do: Right-Click ->“Add”-> “Project Output…”’ select “Primary output”) , VS2010 adds a new “Launch Condition”. (Right-click on your new Setup project and then do “View->Launch Conditions”) By default VS2010 will add NET4 Client Profile as a launch condition. Note that a Beta2 bug still shows the Full Framework as the default launch condition; you can and should use the drop-down box to change it. What this means is that once all prerequisites are installed and before the main installation launches, setup checks whether all the launch conditions are met. If not, setup blocks and displays an error message.
Important notes:
In order to enable most (if not all) client apps to only require the NET4 Client Profile, in Beta2 we added some additional functionality. The main components/features that were included in the Full Framework in Beta1 and moved to the NET4 Client Profile Beta2 are:
In general, other than ASP.Net, tools (like MSbuild, Web admin tools) and legacy components that are becoming deprecated (e.g. Workflow 3.0, Oracle data client) almost everything else is now included in Client Profile in Beta2.
Although the concept of a Client Profile is not new and was introduced in .NET Framework 3.5 SP1, the NET4 Client Profile contains important improvements:
.NET Framework 4 Client Profile
.NET Framework 3.5 SP1 Client Profile
Supported OS
Supported on all platforms and OS's that are supported by the .NET Framework (excluding IA64 and the Server Core role in W2K8)
Supported only on Windows XP 32-bit machines that did not have any .NET Framework version installed.
(Client Profile setup silently installs the full 3.5 SP1 Framework otherwise)
Redistributable
Supports redistributable as well as web download
Supports web download only
Add Remove Programs entries
The full Framework comprises the Client Profile and another part called “Extended”. Thus it has two entries in the Add/Remove Programs dialog (or Programs and Features window).
To remove (or repair) the Full Framework you must remove the Extended part first, then the Client part.
If you installed the Full Framework, you can switch to the Client Profile by simply removing “Extended” from Add/Remove Programs.
Single entry in Add Remove Programs
Visual Studio
Improved support for Client Profile targeting in Visual Studio 2010.
By default many Visual Studio 2010 Beta2 Client project target the NET4 Client Profile.
Single checkbox in Visual Studio 2008 Service Pack 1 “Application” Project properties for .NET Framework 3.5 projects. Client Profile support unavailable in out-of-the-box VS 2008.
Features
Includes new .NET 4 features (such as Managed Extensibility Framework (MEF), C# 4 Dynamic Keyword, etc) as well as features previously included in NET 3.5 SP1 Full (Speech, WPF Spell Check, etc)
Subset of features in .NET 3.5 SP1 Full
Full Framework
Client Profile
Common Language Runtime
Can be installed side-by-side with older versions of the Framework
•
In-process side by side support
Improved COM interop
Innovations in the Visual Basic and C# languages
statement lambdas
implicit line continuations
dynamic dispatch
named/optional parameters
Base Class Library Improvements
Managed Extensibility Framework
Additional core data structures
I/O Improvements
Parallel Computing Innovations
Task Parallel Library (TPL)
Parallel LINQ (PLINQ)
ADO.NET
REST-based exposure of relational data
○
Entity Framework, LINQ to Entities
SqlClient, OLEDB, ODBC Managed Providers
XML, LINQ to XML
OracleClient
x
LINQ to SQL
Runtime design libraries for Entity Framework and ADO.NET Data Services
ASP.NET Innovations
ASP.NET AJAX Improvements
XAML Parser
Faster
More extensibility during XamlReader.Load and XamlWriter.Save
Ability to use generics
Better References by Name
Windows Presentation Foundation
New line-of-business controls including charting control, smart edit, data grid, and others that improve the experience for developers who build data centric applications
Support in for Windows 7 multi-touch, ribbon controls, and taskbar extensibility features
Added support in WPF for Surface 2.0 SDK
Windows Communications Foundation
WCF Client Component
Service discovery
Router service
Simplified configuration
Improved queuing
REST support
Improved performance
Windows Workflow Foundation
Improved activity programming model
Improved designer experience
New flowchart modeling style
Expanded activity palette
Workflow-rules integration
New message correlation features
Significant performance gains for WF-based workflows
WF3 and WF3.5 in .NET 4
Miscellaneous
Speech support
Various perf counters
MSBuild support
Visual Basic compiler and other compilers
• Full Support ○ Partial Support X no support
You can get .NET Framework 4 by click on “Download the Beta” from this site: http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx
Web Download: For online scenarios, your application setup can chain-install the NET4 Framework from the Microsoft Download Center (or direct install by navigating to the download page).
When you use a web download, the .NET web bootstrapper is launched. The bootstrapper can determine your CPU architecture, locale, and components already existing on the machine, and can install only the components that are required. This is also known as ‘homesite’ deployment.
The .NET web bootstrapper also chain-installs the correct .NET Framework 4 Language Pack if your machine has a non-English locale.
Redist: For offline scenarios, you can also re-distribute (“redist”) the NET4 Framework on your own media (e.g. DVD) also known as ‘samesite’ deployment.
You can install the following flavors of the .Net Framework:
(The listed sizes are the package size, the space required on disk will be larger)
Note that above sizes are for ‘redist’ packages. With the Web installer the download size will likely be smaller since some of the components that are needed for NET4 may be already on your machine (e.g. rgb9rast.msi).
Please provide us with feedback. We really would love to know:
Hi,
When do you update Client Profile Configuration Designer for .NET Framework 4.0 Client Profile?
Thanks.
Martin