Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core 1.1 can't Publish App

I'm trying to run a simple dotnet publish command so I can compile my web application on my linux server. It tells me that my project.json is missing.

Before you answer, there have been some recent changes below you should consider. Correct me if I'm wrong but I don't need project.json because my web application is a higher version that doesn't require it:

I'm currently running on ASP.NET Core 1.1 and .NET Core 1.1. As I am aware in November 2016 they depreciated project.json in favor of project.csproj so projects created in Visual Studio 2017 will no longer generate this file any longer.


ASP.NET Core 1.0 uses project.json
ASP.NET Core 1.1 uses project.csproj

How I created my web application project:

  • Visual Studio 2017 RC
  • ASP.NET Core 1.1 (web application)
  • .NET Core 1.1

I only displayed how I created my project because it shows people I don't need to dotnet migrate into 1.1 since the project never begun as a 1.0 project

Locally my project runs fine, it restores, it publishes it runs. It does all the fun things dotnet commands should do perfectly fine.

The more specific question:
On a linux server with the latest dotnet --version running dotnet publish gives me the error saying project.json is required. Why does the latest version of .NET Core (1.1) require project.json when clearly its depreciated in version 1.1 and should be looking for .csproj instead?

like image 454
Ollie Cee Avatar asked Feb 26 '17 19:02

Ollie Cee


1 Answers

While we're in this crossover period where project.json is being replaced by .csproj, there are two versions of the SDK. There is still a version of the SDK based around project.json for v1.1, and you must have that installed on your linux server.

This mess should be going away very soon (with the release of VS2017 in roughly a week's time) when the tooling goes to RTM. From that point onwards everything will be .csproj based and project.json is fully deprecated.

like image 153
Polynomial Avatar answered Sep 29 '22 16:09

Polynomial