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

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

问题描述

从Preview3开始,新的dotnet 产生一个csproj,并且 dotnet还原 dotnet 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.

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

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 Files\dotnet\sdk\1.0.0-preview3-004056\扩展名\Microsoft\VisualStudio\v14.0\DotNet\找不到Microsoft.DotNet.Props。确认声明中的路径正确,并且文件在磁盘上。

...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给出此错误。

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 migration 命令


dotnet migration命令将基于有效的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 migration -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天全站免登陆