1024programmer Asp.Net Migrate .NET Framework projects to .NET Core using try-convert

Migrate .NET Framework projects to .NET Core using try-convert

Use try-convert to migrate .NET Framework projects to .NET Core

Tool address: GitHub – dotnet/try-convert: Help .NET developers port their projects to .NET Core!

This is a simple tool that helps migrate .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 use this tool again, please make sure you are using the latest version: https://github.com/dotnet/try-convert/releases

How to use the tool

Nag to the root of the solution and just execute:

try-convert

Alternatively, you can do

try-convert -w .

If you only want to convert specific subfolders, solutions, or projects, type:

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

If you need more help with the tool, run:

try-convert -h

Since this is for converting older .NET Framework (Windows) projects, this tool is only available on Windows.

Note: Do not use this tool from the Visual Studio Developer Command Prompt. A special MSBuild resolution happened there that ended up being incompatible with the tool. Please use a normal terminal application.

How to build

Easy: clone the repository and run

build.cmd

To use the tool locally, you need to build it from source. Once the build is complete, the tool will exist at:

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

Alternatively, you can view the following directory and copy it to another location on your computer:

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

You can also call the tool from the release directory.

Support Policy

This toolis not supported. No one is bogged down to fix any problems with it, and no one is obligated to build this tool to add any requested features.

This is an open source project built by members of the .NET team in their spare time. The default answer to any issue submitted will be “We will review a pull request that implements this”, although we will work to fix issues and add features if people ask for it.

Who is this tool for?

This tool is for anyone who wants some help migrating their projects to .NET Core (or .NET SDK style projects).

As the name suggests, this tool does not guarantee a complete conversion of the project to a 100% working state. The tool is conservative and does its best to ensure that the converted project can still be loaded into Visual Studio and built. However, there are a number of factors that may cause a project to fail to load or build that are not explicitly covered by this tool. These include:

  • Possible complex custom builds in the solution
  • API usage incompatible with .NET Core
  • Unsupported project type (such as Xamarin, Web Forms, or WCF project)

This tool should help a lot if a large portion of your code base can typically be migrated to .NET Core (such as many class libraries that don’t have platform-specific code).

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

What does this tool do?

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

It performs a second evaluation in the same project folder so that items automatically picked up via wildcarding will also be known. It then applies information about known properties and itemsAs a rule, the difference between the two states is ultimately generated to identify the following:

  • Properties that can now be removed from the project because they are implicitly defined by the SDK and the project has a default value
  • Properties that need to remain in the project because they override default values ​​or are not defined in the SDK.
  • Items that can be removed because they are implicitly introduced by globs in the SDK
  • Items that need to be changed to syntax because, although they are introduced by the SDK, additional metadata is added. Update
  • Items that need to be preserved because they are not implicit in the SDK.

This diff is used to convert the given project file.

This article comes from Blog Garden, author: Gudao Qingfeng, please indicate the original link when reprinting: https://www.cnblogs.com/88223100/p/try-convert.html

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/migrate-net-framework-projects-to-net-core-using-try-convert/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索