Error CS0234: The type or namespace name "AspNetCore" does not exist in the pace names "Microsoft" (do you miss the assembly reference?)

I am trying to upgrade the following template project to ASP.NET Core 1.1: https://github.com/wilanbigay/aspnet-core-aurelia-typescript-starter

After migrating dotnet, the project.json file was deleted in favor of the new csproj file.

Using Visual Studio Code and the Nuget4Code extension, I upgraded all components to ASP.NET Core 1.1.

Now CsProj contains the following entries:

<ItemGroup> <PackageReference Include="Microsoft.NET.Sdk"> <Version>1.0.0-alpha-20161104-2</Version> <PrivateAssets>All</PrivateAssets> </PackageReference> <PackageReference Include="Microsoft.NET.Sdk.Web"> <Version>1.0.0-alpha-20161104-2</Version> <PrivateAssets>All</PrivateAssets> </PackageReference> <PackageReference Include="Microsoft.NETCore.App"> <Version>1.1.0</Version> </PackageReference> <PackageReference Include="Microsoft.AspNetCore.Mvc"> <Version>1.1.0</Version> </PackageReference> 

However, I have compilation issues. The AspNetCore namespace seems to be impossible to find. I get an error

Error CS0234: The type or namespace name "AspNetCore" does not exist in the pace names "Microsoft" (do you miss the assembly reference?)

I'm not sure how I can check links, as before, in Visual Studio in the links section. How can i solve this?

+6
source share
2 answers

Therefore, I assume that I referenced the dependencies, but did not have them for the project.

All I needed to do was start dotnet recovery

https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-restore

As indicated in the link above, "Restores project dependencies and tools."

+7
source

We had this problem when visual studio helped add a local link, not via nuget

 <ItemGroup> <Reference Include="Microsoft.AspNetCore.Mvc.Core"> <HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.core\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll</HintPath> </Reference> </ItemGroup> 

Removing this and link via nuget solved the problem, it looks like a problem in Visual Studio 2017.

0
source

Source: https://habr.com/ru/post/1013200/


All Articles