Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open dotnet-core CLI project in Visual Studio 2017

I have been developing a simple application using dotnet Core (for an API) and Angular2 for the purpose of learning both.

I created the project using Yeoman on the command line and have been happily coding away in Visual Studio Code (on Windows). All seems to hang together well and it's been an enjoyable experience.

I thought I might try out Visual Studio 2017 and see what the experience of developing a dotnet Core project in VS is like for a while.

However, having installed VS2017 and cloned the project from github I am unsure how to proceed. I can't see any way to restore/build/run the project.

After cloning the repo, I see my project displayed in the Solution Explorer with the project.json file visible. However, Debug | Start is greyed out. I read somewhere about VS2017 needing to convert project.json to the new (old?) XML format and also I have a feeling I am missing a .sln file.

I would appreciate it if someone could point me in the right direction.

like image 716
harunahi Avatar asked Dec 31 '16 13:12

harunahi


1 Answers

If your project has an .xproj file

  1. Open Visual Studio.
  2. File > Open > Project/Solution.
  3. Open the xxx.xproj for your solution.

If your project lacks an .xproj file

  1. Install .NET Core SDK Preview 3 or higher.
  2. Open a command prompt at your project's directory.
  3. Run dotnet migrate.
  4. Open the resulting .csproj in Visual Studio 2017.

Troubleshooting

View migration help with dotnet migrate -h.

If you have a global.json file, update its SDK version before running migrate. E.g.

{
    "sdk": {
        "version": "1.0.0-preview4-004233"
    }
}

View installed SDK versions with dir 'C:\Program Files\dotnet\sdk\'.

Update Visual Studio 2017 and its installer. On my machine, the above works with Microsoft Visual Studio Community 2017 RC Version 15.0.26014.0 D15REL.

Update .NET Core SDK. On my machine, the above works with SDK 1.0.0-preview4-004233.

like image 64
Shaun Luttin Avatar answered Oct 19 '22 15:10

Shaun Luttin