从预览版 3 开始,dotnet new
生成一个 csproj,并且 dotnet Restore
和 dotnet 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?
最佳答案
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/