不使用 Visual Studio 将 project.json 转换为 csproj [英] Convert a project.json to a csproj without using Visual Studio

查看:22
本文介绍了不使用 Visual Studio 将 project.json 转换为 csproj的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 preview3 dotnet new 生成一个 csproj,并且 dotnet restoredotnet build 都针对 project.json 和/或xproj.

As of preview3 dotnet new produces a csproj, and both dotnet restore and dotnet build fail against a project.json and/or an xproj.

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

For instance, running dotnet restore against a directory that has both a project.json and an xproj gives this error.

...xproj(7,3):错误 MSB4019:导入的项目C:Program Filesdotnetsdk1.0.0-preview3-004056ExtensionsMicrosoftVisualStudiov14.0DotNet未找到 Microsoft.DotNet.Props".确认声明中的路径正确,并且该文件存在于磁盘上.

...xproj(7,3): error MSB4019: The imported project "C:Program Filesdotnetsdk1.0.0-preview3-004056ExtensionsMicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

此外,对只有 project.json 的目录运行它会出现此错误.

Further, running it against a directory that has only a project.json gives this error.

MSBUILD:错误 MSB1003:指定项目或解决方案文件.当前工作目录不包含项目或解决方案文件.

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?

Without using Visual Studio, how can we convert an existing project.json and/or xproj to a csproj?

推荐答案

有一个 dotnet migrate 命令.

There is a dotnet migrate command.

dotnet migrate 命令会将有效的基于 Preview 2 project.json 的项目迁移到有效的 Preview 3 csproj 项目.

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没有列出命令).

We can find detailed help on this command by running dotnet migrate -h (even though dotnet -h does not list the command).

这篇关于不使用 Visual Studio 将 project.json 转换为 csproj的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆