【发布时间】:2017-01-15 23:25:04
【问题描述】:
我正在制作我的第一个 .net 核心应用程序。我刚刚在 Visual Studio 模板中创建了默认的 asp.net core web 应用程序,然后尝试了dotnet publish,但我收到了这个错误:
PM> dotnet publish
dotnet : 'D:\Projects\coreTest\CoreTest' does not contain a project.json file
At line:1 char:1
+ dotnet publish
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ('D:\Projects\co...oject.json file:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
我没有改变任何东西。默认模板包括一个project.json 文件,其中列出了依赖项。为什么它不想发布?
【问题讨论】:
-
您能否验证
project.json文件存在且有效? -
它存在。 Visual Studio 在我创建默认 Web 应用项目时创建了它并填写了依赖项。路径是
D:\Projects\coreTest\CoreTest\src\CoreTest,所以我认为当我在包管理器控制台中运行它时它的路径是错误的。 -
dotnet restore和dotnet build是否在该文件夹上工作? -
@GerardoGrignoli
dotnet restore在嵌套文件夹中的 projects.json 文件上工作正常,但dotnet restore和dotnet build都抱怨没有 projects.json 文件,因为它看起来更上一层。我可以从菜单构建项目,也可以通过点击播放来预览它。只是包管理器控制台中的这些命令似乎看错了地方。