Migration Guide to the .NET Framework 4

If you created your application using an earlier version of the .NET Framework, you can generally upgrade it to version 4 easily. Open your project in Visual Studio 2010. If your project was created in an earlier version, the Visual Studio Conversion Wizard automatically opens. For more information about upgrading a project, see How to: Upgrade Projects Created in Earlier Versions of Visual Studio.

However, some changes in the .NET Framework require changes to your code. You may also want to take advantage of functionality that is new in the .NET Framework 4. Making these types of changes to your application for a new version of the .NET Framework is typically referred to as migration. If your application does not have to be migrated, you can run it in the .NET Framework 4 without recompiling; for more information, see How to: Configure the .NET Framework 4 Runtime. For compatibility testing scenarios, see .NET Framework 4 Application Compatibility Walkthrough.

This topic describes tasks, resources, and issues related to migrating applications from the .NET Framework 3.5 to the .NET Framework 4.

Migration Resources

Review the following documents before you migrate your application:

Migration Issues Overview

The following table provides a summary of the key issues described in detail in .NET Framework 4 Migration Issues. These include fixes that have been made to resolve earlier issues as well as improvements that could help in your migration tasks.

Technology

Application development and resources

Configurations and other considerations

Controls and graphics

Security

Interoperability

Pertinent types and members

ASP.NET and Web

Support for child Web applications of different versions.

  • Updates to browser definition files.

  • Changes to HTML forms and requests, encoding syntax, and cache policies.

  • Stricter page parsing.

  • Reference to System.Web.Mobile.dll removed.

  • .config file updates.

  • URL routing and Web folder names.

  • New client ID mode.

  • New rendering capabilities.

  • XHTML 1.1 compliance.

  • Discontinued support for hosting Windows Forms controls in the browser. IEHost.dll and IEExec.dll have been removed from the .NET Framework.

  • Passport authentication superseded by the Live ID SDK.

  • Hash algorithm changes for encrypting data.

None.

HttpBrowserCapabilities, HttpUtility, HttpServerUtility, Menu, MenuRenderingMode, ControlRenderingCompatibilityVersion, PopOutImageUrl, StaticPopOutImageUrl, DynamicPopOutImageUrl, AppendHeader(String, String), PassportIdentity, HttpRequest, FilePath, AppRelativeCurrentExecutionFilePath, CurrentExecutionFilePath, PathInfo

Core

  • Considerations regarding in-process, side-by-side execution.

  • Assembly loading and hash algorithm improvements.

  • Global assembly cache location change.

  • C# code compiler classes replaced by CodeDOM.

  • The shell plugin viewer no longer supported by Gacutil.exe (Global Assembly Cache Tool).

  • .config file naming.

  • Date and time properties now use operating system rules instead of .NET Framework data.

  • Changes in handling exceptions for corrupted process states.

None.

  • New security model.

  • Some hosting activation types and members are deprecated.

  • JIT debugging changes.

  • Incorrect platform invokes now cause applications to fail.

  • Managed libraries no longer seen by native applications, such as the Windows Task Manager.

Date and time: Local, Now, TimeSpan

Globalization: CurrencyEnglishName, LongDatePattern, PMDesignator, CultureTypes, FrameworkCultures, WindowsOnlyCultures

Exceptions: HandleProcessCorruptedStateExceptionsAttribute, ExecutionEngineException

Reflection: HashAlgorithm, None, GetReferencedAssemblies(), ProcessModuleCollection, DeclaringType

Data

Hosting improvements.

  • View mapping improvements.

  • Row editing improvements.

  • POCO support.

  • Data Services support for batched binary content, headers, change interceptors for delete requests, merge operations, URI escaping, underlying streams, and JSON reader.

  • More useful exceptions.

None.

None.

None.

DataSet and SQL Client: IRelatedEnd, IEntityWithRelationships, DataView, PropertyChanged, RejectChanges(), DataSet, Prepare()

Entity Framework: Detach(Object), SaveChanges()

LINQ to SQL: EntitySet<TEntity>, ListChanged

WCF Data Services: TimeoutException, DataServiceRequestException, MergeOption, AppendOnly, PreserveChanges, OnStartProcessingRequest(ProcessRequestArgs), ServiceOperation

Globalization

Culture information obtained from operating system, starting with Windows 7.

  • New neutral and specific cultures and name changes.

  • Enhanced Unicode 5.1 standards support.

None.

None.

None.

None.

WCF

None

  • Service hosting configuration changes.

  • Support for merging across configuration files.

  • Obsolete culture types.

None.

None.

None.

None.

WPF

  • Freezable resource dictionaries.

  • Resource file location options.

  • XPS Viewer Essentials Pack installation.

  • Attributes can have only one period.

  • Markup extension fixes.

  • More useful exceptions.

  • Bitmap frames provide better rendering of downloaded images.

  • Child windows do not float.

  • Improved capabilities for child objects of menus, containers off screen, thumb handling, and tree view hierarchy.

  • ClearType in menus and pop-ups.

  • New UI automation interfaces.

  • CommonDialog.ShowStream and Microsoft.Win32.FileDialog execute on same thread.

  • Frame navigation without needless events.

  • Popup delegates can be called multiple times during a layout pass.

  • Property values can persist after triggers that affect their values.

  • Unnecessary re-layouts eliminated (invalidated).

  • You can now bind command instances that are based on a view model.

  • Unused key combinations are obfuscated.

  • WPF browser applications no longer process key events.

  • More window style settings.

  • Automated cut and paste in text boxes provides better security in partial trust.

None.

Applications: AllowsTransparency, WindowState

Controls: CollectionView, SetCurrentValue(DependencyProperty, Object), Copy(), Cut()

Graphics: DropShadowEffect, BlurEffect, ShaderEffect, DownloadFailed, InputBinding, DeadCharProcessed, DeadCharProcessedKey

UI Automation: TreeViewAutomationPeer, TreeViewItemAutomationPeer, IItemContainerProvider, ISynchronizedInputProvider, IVirtualizedItemProvider

XAML: ProvideValue(IServiceProvider)

XML

None.

  • Chameleon schemas cloned correctly.

  • Entity references are converted to an entity only once.

  • Namespace resolver fixes.

  • Reader and XPath navigation fixes.

  • Schema sets can include other sets.

None.

None.

None.

Schema and transforms: XmlReader, CreateReader(), XPathNavigator, XmlSchemaSet, Load(XmlReader)

Validation: ReadContentAs(Type, IXmlNamespaceResolver), IXmlNamespaceResolver, Create(Stream)

Writing: WriteEntityRef(String), XmlWriter, None

See Also

Tasks

How to: Configure the .NET Framework 4 Runtime

Reference

New Types and Members in the .NET Framework 4

Concepts

.NET Framework 4 Migration Issues

Migrating from the .NET Framework Version 1.1

Version Compatibility in the .NET Framework

What's New in the .NET Framework 4

.NET Framework Versions and Dependencies

Other Resources

What's Obsolete in the .NET Framework

.NET Framework Version and Assembly Information

Microsoft .NET Framework Support Lifecycle Policy