Project file is incomplete. Expected imports are m

2020-02-02 06:41发布

After format my computer I reinstalled Vs 2017 V 15.6.3 and install ASP.Net Core SDK from Microsoft 2.1.4

But when I create new asp core application VS failed with error

"Project file is incomplete. Expected imports are missing"

Please, can anyone help?

Error after while creating ASP core application

30条回答
放我归山
2楼-- · 2020-02-02 06:57

I started to get this error when unistalled all my old .NET Core SDKs and installed the latest one, 2.1.5 at the time of posting. I have tried all the solutions here without any luck so decided to check what is the current SDK version after all the cleaup I did because I thought this is causing the problem, and I was right - started a command prompt and wrote dotnet --version and got the message "Did you mean to run dotnet SDK commands? Please install dotnet SDK from:". Strange, the SDK is installed but the system doesn't see it. Then I looked in my environment variables and the PATH variable had the x86 for dotnet path before the regular Program Files (the x64 one) path. So I moved the x64 before the x86 and voila, everthing is back to normal.

Hope I helped someone.

查看更多
闹够了就滚
3楼-- · 2020-02-02 06:59

I get the same issue, and I run Visual with Administrator privilege again. This helps me to open project nomarlly.

查看更多
在下西门庆
4楼-- · 2020-02-02 07:00

in my case, I went to the folder C:\Program Files\dotnet\sdk delete the preview sdk folder, then on the command line run:

dotnet sdk 2.1.200

to set the correct sdk version for asp.net core. this fixed the problem.

查看更多
趁早两清
5楼-- · 2020-02-02 07:01

Deleting the bin and obj folders for the project fixed this for me.

查看更多
Bombasti
6楼-- · 2020-02-02 07:02

Resolved

  1. Even after uninstalling certain version from control panel, there would the files and folders with deleted version found in C:\Program Files\dotnet\sdk

  2. Please go and delete unwanted version folder

  3. Try reloading the project

This worked for me

查看更多
ゆ 、 Hurt°
7楼-- · 2020-02-02 07:03

In my case, I had two versions of Visual Studio installed (15.7 and 15.6). 15.7 didn't have the web workloads installed, though .net core 2.1 RC1 was already installed. I installed the asp.net workload into VS2017, and then repaired my .net core install for good measure. Definitely something in this process swapped my c:\program files(x86)\dotnet and c"\program files\dotnet in this path and Visual Studio (15.7) wouldn't open my web project.

I simply edited the System Environment variables, moved the x86 folder down one and voila - reopened Visual Studio and it now loaded my project. System environment variables

查看更多
登录 后发表回答