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

链接: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:  1e9d529bc5

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.10
 OS Platform: Darwin
 RID:         osx.10.10-x64

执行命令出现错误

iongyanzhudeMacBook-Pro:BeibeiBasic qiongyanzhu$ dotnet migrate
No 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 migrate

Project 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).
Summary
Total Projects: 12
Succeeded Projects: 12
Failed Projects: 0

The 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:

时间: 2024-10-24 21:30:50

[.NET Core 24]把project.json迁移到.csproj的相关文章

.NET Core项目从xproj+project.json向csproj迁移简介

3月7日,微软发布了Visual Studio 2017 RTM,与之一起发布的还有.NET Core Runtime 1.1.0以及.NET Core SDK 1.0.0,尽管这些并不是最新版,但也已经从preview版本升级到了正式版.所以,在安装Visual Studio 2017时如果启用了.NET Core开发的相关功能,那么在安装完成后,你可以在命令行直接执行dotnet.exe,此时你可以看到.NET Core版本是1.1.0,而如果是执行dotnet.exe --version命

[.NET Core 4]继续第三篇

一 使用数据库,生成原始数据 原文链接:http://www.cnblogs.com/dotNETCoreSG/p/aspnetcore-2_4_5-working-with-sql.html 基础知识:ApplicationDbContext 类负责连接数据库并将 Movie 对象和数据记录进行映射. Startup.cs 文件中,数据库上下文是在 ConfigureServices 方法中用 Dependency Injection 容器进行注册的. 我在ApplicationDbConte

[.NET Core 32]升级vs code之后,vs code无法调试net core web项目

错误提示&处理方法 参考链接:https://github.com/OmniSharp/omnisharp-vscode/issues/1742 错误:The .NET Core debugger cannot be installed. The debugger requires macOS 10.12 (Sierra) or newer 方法:You can set the option to disable auto extension updates in VS Code, and th

Ubuntu-Docker[1]安装Docker,通过Docker部署net core代码,需要结合[.NET Core 18]发布、ASP.NET Core Docker部署

1)通过系统自带包安装 通过自带包安装,可能Docker版本较旧 $ sudo apt-get update Reading package lists... Done $ sudo apt-get install -y docker.io {{{-y表示同意.没有-y也可执行,系统会问是否安装,输入y回车即可 apt-get -y install这个指令则是跳过系统提示,直接安装.}}} Adding group `docker' (GID 121) ... Done. docker star

[.NET Core 4]测试验证功能(相较于core教程属于新增)

sqllite 的数据库迁移功能有限制 1)新增如下model,执行数据库迁移不能成功,参考此链接“http://stackoverflow.com/questions/35797628/ef7-generates-wrong-migrations-with-sqlite” 初步判断有限制,所以删除数据库,删除迁移文件,重建数据库“http://www.atove.com/Article/Details/87E62DFDDBF9EC0C5350E7ACD43BADDF”(这篇文章是非.net c

.NET Core 工具从 project.json 移动到基于 MSBuild 的项目后的使用

.NET Core 从preview 4 开始弃用project.json 可以从这下载最新版本: https://github.com/dotnet/cli 使用VS2017 RC新建.net core项目已经从project.json转为msbuild了 打开vs2017,新建.net core 控制台项目: 项目自动生成的代码: using System; class Program { static void Main(string[] args) { Console.WriteLine

.NET Core系列 : 2 、project.json 这葫芦里卖的什么药

.NET Core系列 : 1..NET Core 环境搭建和命令行CLI入门 介绍了.NET Core环境,本文介绍.NET Core中最重要的一个配置文件project.json的相关内容.我们可以使用.NET Core 的dotnet 命令行接口(CLI)dotnet new命令创建一个应用,也可以用Visual Studio 2015 update 3创建一个应用,他们都有一个project.json ,它是项目的配置文件,类似之前的*.csrpoj文件.Project.json 是一个

[asp.net core]project.json(1)

摘要 前面介绍了使用vs2015新建asp.net core web的内容,这篇文章学习下project.json文件的内容. project.json 原文:https://docs.microsoft.com/zh-cn/dotnet/articles/core/tools/project-json project.json文件用来定义asp.net core项目的元数据,编译信息和依赖.在本篇文章中,你可以看到你能在project.json中定义的所有属性列表. Note .NET Cor

[asp.net core]project.json(2)

摘要 上篇文章介绍了project.json中的一部分属性.属性真的比较多,所以分开了,考虑到其中的英文比较简单,也不再进行翻译了,从英文原文中,直接粘贴过来了. project.json(1) project.json publicSign Type: Boolean true to enable signing of the resulting assembly; otherwise, false. The default is false. For example: { "buildOpt