在不使用Visual Studio的情况下将project.json转换为csproj

编程入门 行业动态 更新时间:2024-10-24 14:17:16
本文介绍了在不使用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

本文发布于:2023-11-10 06:29:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574608.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   情况下   Studio   Visual   csproj

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!