Convert a project.json to a csproj without using Visual Studio

旧街凉风 提交于 2019-12-21 07:08:15

问题


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

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

...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.

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

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

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


回答1:


There is a dotnet migrate command.

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

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



来源:https://stackoverflow.com/questions/40701432/convert-a-project-json-to-a-csproj-without-using-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!