Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a2bb104
Update with the minimal changes needed to align existing content to t…
StephenBonikowsky Jun 10, 2021
bc00ae7
Merge branch 'dotnet:main' into migrationdocsphaseone
StephenBonikowsky Jun 10, 2021
0d830c9
Adding the new page 'tooling-requirements.md' and adding initial cont…
StephenBonikowsky Jun 10, 2021
84c4cf4
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 10, 2021
60e6e19
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 10, 2021
1dc7471
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 10, 2021
0dd1b9f
Created additional pages needed for Phase 1 modifying the TOC as needed.
StephenBonikowsky Jun 10, 2021
f634263
Created additional pages needed for Phase 1 modifying the TOC as needed.
StephenBonikowsky Jun 10, 2021
f3b29c7
Fixed merge conflicts.
StephenBonikowsky Jun 11, 2021
9174190
Update docs/core/porting/premigration-needed-changes.md
adegeo Jun 11, 2021
fa12a00
Update docs/core/porting/premigration-needed-changes.md
adegeo Jun 11, 2021
2b965ec
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 11, 2021
3045cb0
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 11, 2021
56d1820
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 14, 2021
f1fb91e
Add breaking change page.
StephenBonikowsky Jun 14, 2021
1995634
Add breaking change page.
StephenBonikowsky Jun 14, 2021
4152705
Merge branch 'migrationdocsphaseone' of https://github.com/StephenBon…
StephenBonikowsky Jun 14, 2021
8d45d92
Update tooling requirements page based on feedback.
StephenBonikowsky Jun 23, 2021
d742ea4
Merge branch 'main' of https://github.com/dotnet/docs into dotnet-main
StephenBonikowsky Jun 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/core/porting/breaking-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Breaking changes
description: Breaking changes between releases of .NET and how it impacts compatibility.
author: stebon
ms.date: 06/14/2021
---
# Breaking Changes

Visit the following documentation to learn about and find breaking changes when moving from the .NET Framework to .NET and between releases of .NET.

## [What are breaking changes?](../compatibility/index.md)

## [Types of compatibility.](../compatibility/categories.md)

## [Find breaking changes.](../compatibility/breaking-changes.md)
86 changes: 86 additions & 0 deletions docs/core/porting/porting-approaches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: Porting approaches
description: Create a porting plan that best reflects your project and context.
author: stebon
ms.date: 06/10/2021
---
[Need more content and modify existing content]

### Deal primarily with the compiler

This approach works well for small projects or projects that don't use many .NET Framework APIs. The approach is simple:

01. Optionally, run ApiPort on your project. If you run ApiPort, gain knowledge from the report on issues you'll need to address.
01. Copy all of your code over into a new .NET project.
01. While referring to the portability report (if generated), solve compiler errors until the project fully compiles.

Although it's unstructured, this code-focused approach often resolves issues quickly. A project that contains only data models might be an ideal candidate for this approach.

### Stay on the .NET Framework until portability issues are resolved

This approach might be the best if you prefer to have code that compiles during the entire process. The approach is as follows:

01. Run ApiPort on a project.
01. Address issues by using different APIs that are portable.
01. Take note of any areas where you're prevented from using a direct alternative.
01. Repeat the prior steps for all projects you're porting until you're confident each is ready to be copied over into a new .NET project.
01. Copy the code into a new .NET project.
01. Work out any issues where you noted that a direct alternative doesn't exist.

This careful approach is more structured than simply working out compiler errors, but it's still relatively code-focused and has the benefit of always having code that compiles. The way you resolve certain issues that couldn't be addressed by just using another API varies greatly. You may find that you need to develop a more comprehensive plan for certain projects, which is covered in the next approach.

### Develop a comprehensive plan of attack

This approach might be best for larger and more complex projects, where restructuring code or completely rewriting certain areas of code might be necessary to support .NET. The approach is as follows:

01. Run ApiPort on a project.
01. Understand where each non-portable type is used and how that affects overall portability.

- Understand the nature of those types. Are they small in number but used frequently? Are they large in number but used infrequently? Is their use concentrated, or is it spread throughout your code?
- Is it easy to isolate code that isn't portable so that you can deal with it more effectively?
- Do you need to refactor your code?
- For those types that aren't portable, are there alternative APIs that accomplish the same task? For example, if you're using the <xref:System.Net.WebClient> class, use the <xref:System.Net.Http.HttpClient> class instead.
- Are there different portable APIs available to accomplish a task, even if it's not a drop-in replacement? For example, if you're using <xref:System.Xml.Schema.XmlSchema> to parse XML but don't require XML schema discovery, you could use <xref:System.Xml.Linq> APIs and implement parsing yourself instead of relying on an API.

01. If you have assemblies that are difficult to port, is it worth leaving them on .NET Framework for now? Here are some things to consider:

- You may have some functionality in your library that's incompatible with .NET because it relies too heavily on .NET Framework or Windows-specific functionality. Is it worth leaving that functionality behind for now and releasing a temporary .NET version of your library with fewer features until resources are available to port the features?
- Would a refactor help?

01. Is it reasonable to write your own implementation of an unavailable .NET Framework API?

You could consider copying, modifying, and using code from the [.NET Framework reference source](https://github.com/Microsoft/referencesource). The reference source code is licensed under the [MIT License](https://github.com/Microsoft/referencesource/blob/master/LICENSE.txt), so you have significant freedom to use the source as a basis for your own code. Just be sure to properly attribute Microsoft in your code.

01. Repeat this process as needed for different projects.

The analysis phase could take some time depending on the size of your codebase. Spending time in this phase to thoroughly understand the scope of changes needed and to develop a plan usually saves you time in the end, particularly if you have a complex codebase.

Your plan could involve making significant changes to your codebase while still targeting .NET Framework 4.7.2. This is a more structured version of the previous approach. How you go about executing your plan is dependent on your codebase.

### Mixed approach

It's likely that you'll mix the above approaches on a per-project basis. Do what makes the most sense to you and for your codebase.

## Port your tests

The best way to make sure everything works when you've ported your code is to test your code as you port it to .NET. To do this, you'll need to use a testing framework that builds and runs tests for .NET. Currently, you have three options:

- [xUnit](https://xunit.net/)
- [Getting Started](https://xunit.net/docs/getting-started/netcore/cmdline)
- [Tool to convert an MSTest project to xUnit](https://github.com/dotnet/codeformatter/tree/main/src/XUnitConverter)
- [NUnit](https://nunit.org/)
- [Getting Started](https://github.com/nunit/docs/wiki/Installation)
- [Blog post about migrating from MSTest to NUnit](https://www.florian-rappl.de/News/Page/275/convert-mstest-to-nunit)
- [MSTest](/visualstudio/test/unit-test-basics)

## Recommended approach

Ultimately, the porting effort depends heavily on how your .NET Framework code is structured. A good way to port your code is to begin with the *base* of your library, which is the foundational components of your code. This might be data models or some other foundational classes and methods that everything else uses directly or indirectly.

01. Port the test project that tests the layer of your library that you're currently porting.
01. Copy over the base of your library into a new .NET project and select the version of .NET Standard you wish to support.
01. Make any changes needed to get the code to compile. Much of this may require adding NuGet package dependencies to your *csproj* file.
01. Run the tests and make any needed adjustments.
01. Pick the next layer of code to port over and repeat the prior steps.

If you start with the base of your library and move outward from the base and test each layer as needed, porting is a systematic process where problems are isolated to one layer of code at a time.
37 changes: 37 additions & 0 deletions docs/core/porting/premigration-needed-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Needed changes before porting code
description: Make the necessary changes to build targeting .NET Core.
author: stebon
ms.date: 06/10/2021
---
# Overview

Make the needed changes to build and run a .NET application before beginning the work to port your code. All of these changes can be done while still building and running a .NET Framework application.

## Upgrade to required tooling

Upgrade to a version of MSBuild/Visual Studio that supports the version of .NET you will be targeting. See [Tooling Requirements](tooling-requirements.md) for more info.

## Update .NET Framework target version

If your code isn't targeting .NET Framework 4.7.2, we recommended that you retarget to .NET Framework 4.7.2. This ensures the availability of the latest API alternatives for cases where .NET Standard doesn't support existing APIs.

For each of the projects you wish to port, do the following in Visual Studio:

01. Right-click on the project and select **Properties**.
01. In the **Target Framework** dropdown, select **.NET Framework 4.7.2**.
01. Recompile the project.

Because your projects now target .NET Framework 4.7.2, use that version of the .NET Framework as your base for porting code.

## Change to PackageReference format

Convert all references to the [PackageReference](/nuget/consume-packages/package-references-in-project-files) format.

## Convert to SDK style project format

Convert your projects to the [SDK-style format](../project-sdk/overview.md).

## Update dependencies

Update dependencies to their latest version available, and to .NET Standard version where possible.
6 changes: 3 additions & 3 deletions docs/core/porting/third-party-deps.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Analyze dependencies to port code
description: Learn how to analyze external dependencies to port your project from .NET Framework to .NET.
author: cartermp
ms.date: 03/04/2021
author: stebon
ms.date: 06/14/2021
---
# Analyze your dependencies to port code from .NET Framework to .NET

To port your code to .NET or .NET Standard, you must understand your dependencies. External dependencies are the NuGet packages or `.dll` files you reference in your project, but that you don't build yourself.
To identify the unsupported third-party dependencies in your project you must first understand your dependencies. External dependencies are the NuGet packages or `.dll` files you reference in your project, but that you don't build yourself.

Porting your code to .NET Standard 2.0 or below ensures that it can be used with both .NET Framework and .NET. However, if you don't need to use the library with .NET Framework, consider targeting the latest version of .NET.

Expand Down
45 changes: 45 additions & 0 deletions docs/core/porting/tooling-requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Tooling requirements
description: Learn about the versioning relationship between the .NET SDK and MSBuild/VS.
author: stebon
ms.date: 06/10/2021
---
# Overview

Understanding the versioning of the SDK and how it relates to Visual Studio and MSBuild can frequently be confusing. MSBuild versions with VS but is also included in the SDK. The SDK has a minimum version of MSBuild that it works with and it won't load in a VS that is older than it supports.

## Versioning

The first part of the SDK matches the .NET version that it includes, runs on, and targets by default. The feature band starts at 1 and increases for each quarterly VS minor release. The patch version increments with each month's servicing updates.

For example, 5.0.203 ships with .NET 5.0, is the 2nd minor VS release since 5.0.100 first came out, and is the 3rd patch since 5.0.200 released.

## Lifecycle

The support timeframe for the SDK typically matches the VS it's included in.

| SDK Version | MSBuild/VS version | Minimum required MSBuild/VS Version | Ship date | Lifecycle |
|------------------|--------------------|-------------------------------------|--------------|-----------|
| 2.1.5xx | 15.9 | 15.3 | Nov '18 | Aug '21* |
| 2.1.8xx | 16.2 (No VS) | 16.0 | July '19 | Aug '21 |
| 3.1.1xx | 16.4 | 16.3 | Dec '19 | Dec '22 |
| 3.1.4xx | 16.7 | 16.7 | Aug '20 | Dec '22 |
| 5.0.1xx | 16.8 | 16.8 | November '20 | Mar '21 |
| 5.0.2xx | 16.9 | 16.8 | March '21 | Aug '22 |
| 5.0.3xx | 16.10 | 16.8 | May '21 | Aug '21 |
| 5.0.4xx | 16.11 | 16.8 | Aug '21 | Feb '22* |
| 6.0.100-preview4 | 16.10 (No VS) | 16.10-preview3 | May '21 | N/A |
| 6.0.100-preview5 | 17.0-preview 1 | 16.10 | June '21 | N/A |
| 6.0.100 | 17.0 | 16.10** | Nov. '21 |

*MSbuild/VS supported for longer

**Customers should not have to upgrade to 17.0 on the day .NET 6 releases, this is the current value and will likely be 16.11 by release.

We expect breaking changes requiring new MSBuild and VS versions expected at least once a year for new SDK version bands. We do not anticipate version compat breaking changes in feature bands anymore.

## Reference

- [.NET Core and .NET 5 official support policy](/platform/support/policy/dotnet-core)
- [Microsoft .NET and .NET Core](/lifecycle/products/microsoft-net-and-net-core)
- [.NET Downloads (Linux, macOS, and Windows)](/download/dotnet)
17 changes: 17 additions & 0 deletions docs/core/porting/unsupported-apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Unsupported APIs
description: Learn about unsupported APIs and what to do about them.
author: stebon
ms.date: 06/10/2021
---
# Find unsupported APIs in your code

APIs in your .NET Framework code may not be supported in .NET for a number of reasons that range from the simple to fix, such as a namespace change; to the more challenging to fix such as an entire technology not being supported. The first step is to determine which of your APIs are no longer supported and then identify the proper fix.

## .NET Portability Analyzer

The .NET Portability Analyzer is a tool that analyzes assemblies and provides a detailed report on .NET APIs that are missing for the applications or libraries to be portable on your specified targeted .NET platforms.

To use the .NET Portability Analyzer in Visual Studio, install the [extension from the marketplace](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer).

For more information, see [The .NET Portability Analyzer](../../standard/analyzers/portability-analyzer.md).
83 changes: 51 additions & 32 deletions docs/fundamentals/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2470,36 +2470,55 @@ items:
items:
- name: Overview
href: ../core/porting/index.md
- name: .NET Upgrade Assistant tool
- name: General Information
items:
- name: Overview
href: ../core/porting/upgrade-assistant-overview.md
- name: Telemetry
href: ../core/porting/upgrade-assistant-telemetry.md
- name: ASP.NET Core
href: ../core/porting/upgrade-assistant-aspnetmvc.md
- name: Windows Presentation Foundation
href: ../core/porting/upgrade-assistant-wpf-framework.md
- name: Windows Forms
href: ../core/porting/upgrade-assistant-winforms-framework.md
- name: Breaking changes
displayName: app compatibility
href: ../core/compatibility/
- name: Analyze third-party dependencies
href: ../core/porting/third-party-deps.md
- name: Port libraries
href: ../core/porting/libraries.md
- name: Organize projects for .NET
href: ../core/porting/project-structure.md
- name: Unavailable technologies
href: ../core/porting/net-framework-tech-unavailable.md?toc=/dotnet/fundamentals/toc.json&bc=/dotnet/breadcrumb/toc.json
- name: Use the Windows Compatibility Pack
href: ../core/porting/windows-compat-pack.md
- name: Port Windows Forms projects
href: /dotnet/desktop/winforms/migration/?view=netdesktop-5.0
- name: Port WPF projects
href: /dotnet/desktop/wpf/migration/convert-project-from-net-framework?view=netdesktop-5.0
- name: Port C++/CLI projects
href: ../core/porting/cpp-cli.md
- name: Choose between .NET 5 and .NET Framework for server apps
href: ../standard/choosing-core-framework-server.md
<<<<<<< HEAD
- name: About .NET
items:
- name: Choose between .NET 5 and .NET Framework for server apps
href: ../standard/choosing-core-framework-server.md
- name: .NET Upgrade Assistant tool
items:
- name: Overview
href: ../core/porting/upgrade-assistant-overview.md
- name: Windows Presentation Foundation
href: ../core/porting/upgrade-assistant-wpf-framework.md
- name: Windows Forms
href: ../core/porting/upgrade-assistant-winforms-framework.md
- name: ASP.NET Core
href: ../core/porting/upgrade-assistant-aspnetmvc.md
- name: Breaking changes
displayName: app compatibility
href: ../core/porting/breaking-changes.md
- name: Pre-Migration
items:
- name: Analyze & Asses the portability of your project
items:
- name: Tooling Requirements
href: ../core/porting/tooling-requirements.md
- name: Unsupported Dependencies
href: ../core/porting/third-party-deps.md
- name: Use the Windows Compatibility Pack
href: ../core/porting/windows-compat-pack.md
- name: Unavailable technologies
href: ../core/porting/net-framework-tech-unavailable.md?toc=/dotnet/fundamentals/toc.json&bc=/dotnet/breadcrumb/toc.json
- name: Unsupported APIs
href: ../core/porting/unsupported-apis.md
- name: Needed changes before porting code
href: ../core/porting/premigration-needed-changes.md
- name: Migration
items:
- name: Create a porting plan
items:
- name: Approaches
href: ../core/porting/porting-approaches.md
- name: Project structure
href: ../core/porting/project-structure.md
- name: Application Porting Guides
items:
- name: Windows Forms
href: /dotnet/desktop/winforms/migration/?view=netdesktop-5.0
- name: Windows Presentation Foundation
href: /dotnet/desktop/wpf/migration/convert-project-from-net-framework?view=netdesktop-5.0
- name: Port C++/CLI projects
href: ../core/porting/cpp-cli.md