问题
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.
回答1:
If your project has an .xproj
file
- Open Visual Studio.
- File > Open > Project/Solution.
- Open the
xxx.xproj
for your solution.
If your project lacks an .xproj
file
- Install .NET Core SDK Preview 3 or higher.
- Open a command prompt at your project's directory.
- Run
dotnet migrate
. - 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
.
来源:https://stackoverflow.com/questions/41408500/how-to-open-dotnet-core-cli-project-in-visual-studio-2017