Helping .NET developers port their projects to .NET Core!
Перейти к файлу
Jonathon Marolf e77da83926
Merge pull request #461 from dotnet/dev/jmarolf/cert-fix
create HttpClient with CheckCertificateRevocationList enabled
2022-10-07 10:28:31 -07:00
eng fixup 2022-10-03 21:36:27 -07:00
src create HttpClient with CheckCertificateRevocationList enabled 2022-10-06 08:41:25 -07:00
tests skip tests for now 2022-10-03 20:40:58 -07:00
.editorconfig add editorconfig 2019-10-04 14:55:03 -07:00
.gitattributes Add .gitignore and .gitattributes. 2017-02-16 00:30:55 -08:00
.gitignore Handle imports better and fix some bugs 2020-10-12 12:24:28 -07:00
Build.cmd produce nuget package on build 2019-09-18 14:11:16 -07:00
CODE_OF_CONDUCT.md add eng folder 2019-09-18 13:28:09 -07:00
LICENSE.TXT add eng folder 2019-09-18 13:28:09 -07:00
NuGet.config fixup 2022-10-03 21:40:53 -07:00
README.md fix docs 2022-07-26 16:21:19 -07:00
THIRD-PARTY-NOTICES.TXT add eng folder 2019-09-18 13:28:09 -07:00
Test.cmd fix tests 2019-09-18 13:28:09 -07:00
global.json fixup 2022-10-03 18:17:27 -07:00
try-convert.sln adds separate project for MAUI tests 2021-06-09 17:27:16 -07:00

README.md

try-convert NuGet Badge

This is a simple tool that will help in migrating .NET Framework projects to .NET Core.

How to use it

Install it as a global tool here:

dotnet tool install -g try-convert

If you already have it installed, make sure to update:

dotnet tool update -g try-convert

If you're using the tool again, make sure you've got the latest release: https://github.com/dotnet/try-convert/releases

How to use the tool

Nagivate to the root of your solution and simply execute:

try-convert

Alternatively, you can do

try-convert -w .

If you only want to convert a specific subfolder, solution, or project, type:

try-convert -w path-to-folder-or-solution-or-project

If you want more help from the tool, run:

try-convert -h

Because this is for converting older .NET Framework (Windows) projects, the tool only works on Windows.

NOTE: Do not use this tool from the Visual Studio developer command prompt. There is special MSBuild resolution that happens there and it ends up being incompatible with the tool. Please use a normal terminal application.

Status

Unit Tests (Debug) Unit Tests (Release)
ci Build Status Build Status
official Build Status Build Status

How to build

Simple: clone the repo and run

build.cmd

To use the tool locally, you need to build it from source. Once it's built, the tool will live under:

/artifacts/bin/try-convert/Debug/net6.0/try-convert.exe

Alternatively, you can look at the following directory and copy that into somewhere else on your machine:

mv /artifacts/bin/try-convert/Debug/net6.0/publish C:/Users/<user>/try-convert

You can invoke the tool from the publish directory as well.

Support policy

This tool is not supported in any way. Nobody will be on the hook for fixing any issues with it, nor is anyone who builds this tool obliged to add any requested features.

This is an open source project built by members of the .NET team in their spare time. Although we'll strive to fix issues and add features if people ask for them, the default answer to any issue filed will be, "we'll review a pull request that implements this".

Who is this tool for?

This tool is for anyone looking to get a little help migrating their projects to .NET Core (or .NET SDK-style projects).

As the name suggests, this tool is not guaranteed to fully convert a project into a 100% working state. The tool is conservative and does as good of a job as it can to ensure that a converted project can still be loaded into Visual Studio and build. However, there are an enormous amount of factors that can result in a project that may not load or build that this tool explicitly does not cover. These include:

  • Complex, custom builds that you may have in your solution
  • API usage that is incompatible with .NET Core
  • Unsupported project types (such as Xamarin, WebForms, or WCF projects)

If the bulk of your codebase is generally capable of moving to .NET Core (such as lots of class libraries with no platform-specific code), then this tool should help quite a bit.

It is highly recommended that you use this tool on a project that is under source control.

What does the tool do?

It loads a given project and evaluates it to get a list of all properties and items. It then replaces the project in memory with a simple .NET SDK based template and then re-evaluates it.

It does the second evaluation in the same project folder so that items that are automatically picked up by globbing will be known as well. It then applies rules about well-known properties and items, finally producing a diff of the two states to identify the following:

  • Properties that can now be removed from the project because they are already implicitly defined by the SDK and the project had the default value
  • Properties that need to be kept in the project either because they override the default or are not defined in the SDK.
  • Items that can be removed because they are implicitly brought in by globs in the SDK
  • Items that need to be changed to the Update syntax because although they're brought in by the SDK, there is extra metadata being added.
  • Items that need to be kept because they are are not implicit in the SDK.

This diff is used to convert a given project file.

Attribution

This tool is based on the work of Srivatsn Narayanan and his ProjectSimplifier project.