3

I am making my first .net core app. I just created the default asp.net core web app inside visual studio template and then tried dotnet publish but I get this error:

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

I haven't changed anything. The default template includes a project.json file with dependencies listed. Why doesn't it want to publish?

4
  • Can you verify that the project.json file exists and is valid? Commented Jul 28, 2016 at 0:07
  • It exists. Visual studio created it and filled in dependencies when I created the default web app project. The path is D:\Projects\coreTest\CoreTest\src\CoreTest so I think its looking in wrong path when im running this in package manager console. Commented Jul 28, 2016 at 0:09
  • Does dotnet restore and dotnet build work on that exact folder? Commented Jul 28, 2016 at 0:35
  • @GerardoGrignoli dotnet restore works fine on the projects.json file in nested folder but both dotnet restore and dotnet build complain there is no projects.json file as it is looking one level up. I am able to build project from menu and also preview it fine by hitting play. It's just these commands in package manager console seem to be looking in wrong place. Commented Jul 28, 2016 at 0:41

2 Answers 2

1

This seems to be a bug with package manager. I managed to publish the project by right clicking the project and selecting publish.

Sign up to request clarification or add additional context in comments.

Comments

1

For anyone running into this and ending up on this answer, it is possible that you have a mismatch between dotnet --version on different machines where you are trying to compile.

There is a breaking change in transitioning from project.json back to MS Build.

I was trying to compile an app built for the MS Build version on an environment with the project.json version and ran into this. As a noob when it comes to new .NET stuff, and having not followed the changes too closely, I didn't realize this was the culprit for some time.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.