Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't run .Net Core based on project.json after VS 2017 installation

I've been working on a software for a while and always executed it using dotnet run. Today, I decided to install VS 2017 and after that (still not entirely sure if it's the root cause, though), I can't run my software anymore.

The pre-existing project is nowhere near the project I opened with VS 2017 so the only collision I suspect might be due to the Core version being changed. To be sure, I re-ran the installation from the page, the latest version.

dotnet --version
1.0.0-preview4-004233

I notice that when I execute dotnet new, the directory get a xxx.csproj file and not project.json and I've read somewhere that MS is going to drop support for it.

What can I do to get the pre-existing project running again? I'm kind of stuck in the middle of the whole thing and googling gave me precisely nothing. Apparently, I'm the first dude to do this stupid upgrade (if it's because of that to begin with).

like image 965
Konrad Viltersten Avatar asked Dec 30 '16 23:12

Konrad Viltersten


People also ask

What is the project assets json file?

The project. json file maintains a list of packages used in a project, known as a package management format. It supersedes packages.

How do I open project json in ASP.NET Core?

Right click your project and select "Edit ProjectName. csproj" to view the file.

What is project json?

Project. json is an automatically generated file which is included in the folder of each automation project made in Studio. The file holds information about the project dependencies, and web services loaded in libraries.

What are the json files in .NET Core?

json file is an application configuration file used to store configuration settings such as database connections strings, any application scope global variables, etc. If you open the ASP.NET Core appsettings. json file, then you see the following code by default which is created by visual studio.


1 Answers

What can I do to get the pre-existing project running again?

Add a global.json to your project or solution's root directory, with an SDK property that points at the previous SDK. For example:

{
    "sdk": {
        "version": "1.0.0-preview2-003131"
    }
}

View the SDK versions that you have installed like this:

PS> dir 'C:\Program Files\dotnet\sdk\' -name

1.0.0-preview2-003131               
1.0.0-preview2-003133               
1.0.0-preview2-003156               
1.0.0-preview2-1-003177             
1.0.0-preview3-004056               

Anything with preview2 will use project.json, anything with preview3 (or above) will use xxx.csproj.

See also: Announcing .NET Core Tools MSBuild “alpha” > Side by side install.

like image 93
Shaun Luttin Avatar answered Oct 23 '22 23:10

Shaun Luttin