[.NET Core 24]把project.json遷移到.csproj

來源:互聯網
上載者:User

標籤:basic   pen   orm   fail   current   x64   oba   .com   sha   

連結:https://blog.jetbrains.com/dotnet/2017/04/04/rider-eap-update-csproj-based-net-core-support-migrate/

how to migrate from the (deprecated) project.json format to the new .csproj format.

First, Microsoft greatly simplified the .csprojformat. In minimal format, this is what it looks like:

首先,微軟大大簡化.csproj格式。最小的格式,如下:

<Project Sdk="Microsoft.NET.Sdk">   <PropertyGroup>    <TargetFramework>netstandard1.4</TargetFramework>  </PropertyGroup> </Project>

Second, the good things of project.json were ported over to the new .csproj format:

其次,project.json 的優點都移植到了新的csproj格式:

支援萬用字元(如果一個檔案被添加到專案檔,沒有更多的合并衝突)。
命令列工具如dotnet.exe可以跟他們一起工作。
Multi-targeting很簡單:只需指定目標框架(target frameworks),就可以了。
包引用和項目引用很容易添加。
從項目中構建包也更容易(see full reference)。

遷移:

Let’s look at how we can move from project.json (and the old .xproj) to the new and shiny. Before starting, make sure that the required toolsets are installed. On Windows, you currently need a Visual Studio 2017 install (we’re working on that). On Mac OS / Linux, the Mono tooling is required.

qiongyanzhudeMacBook-Pro:BeibeiCore.Services qiongyanzhu$ dotnet --info.NET Command Line Tools (1.0.0-preview2-003121)Product Information: Version:            1.0.0-preview2-003121 Commit SHA-1 hash:  1e9d529bc5Runtime Environment: OS Name:     Mac OS X OS Version:  10.10 OS Platform: Darwin RID:         osx.10.10-x64

執行命令出現錯誤

iongyanzhudeMacBook-Pro:BeibeiBasic qiongyanzhu$ dotnet migrateNo executable found matching command "dotnet-migrate"

Note: If you get an error “No executable found matching command dotnet-migrate”, edit the solution’s global.json file and change the SDK version to 1.1.0. The dotnet migratecommand requires .NET Core CLI RC3 or higher.

qiongyanzhudeMacBook-Pro:BeibeiBasic qiongyanzhu$ dotnet migrateProject BeibeiWeb.FlowUITest migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiWeb.FlowUITest).Project BeibeiWeb.FlowUI migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiWeb.FlowUI).Project BeibeiCore.Services migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.Services).Project BeibeiCore.Utility migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.Utility).Project BeibeiCore.EF.Test migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.EF.Test).Project BeibeiCore.EF migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.EF).Project BeibeiCore.Domain.P2P migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.Domain.P2P).Project BeibeiCore.Component.IData migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.Component.IData).Project BeibeiCore.ADO.Flow migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiCore.ADO.Flow).Project BeibeiBasic.Web migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiBasic.Web).Project BeibeiBasic.Services migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiBasic.Services).Project BeibeiBasic.Models migration succeeded (/Users/qiongyanzhu/RiderProjects/BeibeiBasic/BeibeiBasic.Models).SummaryTotal Projects: 12Succeeded Projects: 12Failed Projects: 0The project migration has finished. Please visit https://aka.ms/coremigration to report any issues you‘ve encountered or ask for help.Files backed up to /Users/qiongyanzhu/RiderProjects/BeibeiBasic/backup/qiongyanzhudeMacBook-Pro:BeibeiBasic qiongyanzhu$

  Once finished, existing project.json and .xproj will be converted to .csproj. Depending on the project type, Rider will automatically reload the solution after migration completes (worst case, you may have to close and re-open Rider).

Further details on migrating projects from project.json to .csproj can be found on Microsoft’s documentation site:

  • Migrating .NET Core projects to the .csproj format
  • The dotnet migrate command line tool

[.NET Core 24]把project.json遷移到.csproj

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.