dotnet-cli - 不使用 Visual Studio 将 project.json 转换为 csproj

标签 dotnet-cli .net-core

从预览版 3 开始,dotnet new 生成一个 csproj,并且 dotnet Restoredotnet build 对 project.json 和/或xproj。

例如,对同时具有 project.json 和 xproj 的目录运行 dotnet Restore 会出现此错误。

...xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

此外,针对仅包含 project.json 的目录运行它会出现此错误。

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

如果不使用 Visual Studio,我们如何将现有的 project.json 和/或 xproj 转换为 csproj?

最佳答案

有一个dotnet migrate command .

The dotnet migrate command will migrate a valid Preview 2 project.json based project to a valid Preview 3 csproj project.

我们可以通过运行 dotnet migrate -h 找到有关此命令的详细帮助(即使 dotnet -h 没有列出该命令)。

关于dotnet-cli - 不使用 Visual Studio 将 project.json 转换为 csproj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40701432/

相关文章:

.net - .NET Core 准备好在 Raspberry PI 3 上运行了吗?

.net-core - .Net Core 构建解决方案

dotnet-cli - EF Core 2.2 脚手架现有数据库和延迟加载

c# - SqlConnection.Open() 在 .NET Core Consol 项目中挂起,但在常规 C# 控制台项目中连接正常

c# - 升级到 .Net Core 2.1 时找不到版本为 (>= 2.1.0) 的包 Microsoft.Extensions.SecretManager.Tools

c# - ASP.NET核心: Why do we need IDesignTimeDbContextFactory?

.net - 使用 dotnet cli 通过 http 版本的 nuget.org 恢复项目的 nuget 包

c# - 如何使用 dotnetcore 命令行生成 Controller

c# - 表拆分 EF Core

c# - HttpResponseMessage 的处理是调用请求流的处理