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:46

I had the same error message. In my case. I had to install the .NET Core cross-platform development toolset.

Steps:

  1. In Visual Studio, go to Tools > Get Tools and Features...
  2. Modify the installation under Workloads: select .NET Core cross-platform development and click Modify.
  3. Restart VS and rebuild your project.
查看更多
兄弟一词,经得起流年.
3楼-- · 2020-02-02 06:48

I got the same issue. I could not create new ASP .Net Core 2 on fresh installed VS2017 or open existing one, which works perfectly on another computer with VS2017.

It's started work for me after uninstalling all .NET Core Runtimes and .NET Core Windows Server Hosting from Windows. SDKs have been left only and all works finally. enter image description here

Probably, I needed to uninstall just .NET Core Runtimes or .NET Core Windows Server Hosting from Windows and it would be enough.

查看更多
何必那么认真
4楼-- · 2020-02-02 06:48

Turns out my project was dependent on another project in the solution, which had failed NuGet dependency issues, which in turn was because the Target Framework in the project properties was blank.

I opened the .csproj file to check the target framework, downloaded the target framework and chose "repair", then restarted Visual Studio and all good again!

查看更多
成全新的幸福
5楼-- · 2020-02-02 06:49

Another potential cause is you installed a .NET Core version which is incompatible with Visual Studio. This might be unrelated to the original question by the OP, since it concerns different version numbers, but since I landed on this page while looking for help I thought this might be useful to others.

At the time of writing, I installed .NET Core 2.2.203 which is not compatible with Visual Studio 2017 (Professional 15.9.11).

The .NET Core download page lists a separate download for Visual Studio 2017. Be sure to download this one when you intend to use Visual Studio 2017. The current supported version is .NET Core 2.2.106.

查看更多
ら.Afraid
6楼-- · 2020-02-02 06:49

I have solved this problem a couple of times lately by closing Visual Studio and running the following commands

  1. dotnet nuget locals -c all
  2. dotnet clean
  3. dotnet build

There seems to be times, especially at the beginning of projects, when nuget gets out of whack (technical term).

查看更多
Anthone
7楼-- · 2020-02-02 06:51

Thanks guys, i had reinstall older version of visual studio 2017 and it works well. My VS version is 15.4 and it's fine

查看更多
登录 后发表回答