Indrajeet Singh
Indrajeet Singh

Reputation: 532

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft'

I have created a very basic (default) function app using Visual Studio by following MS Docs-

Installed the packages according to the doc only.

After I created a new function app , I am seeing this errors -

enter image description here

csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Let me know if anything else I need to provide?

Upvotes: 0

Views: 5234

Answers (2)

Jack J Jun- MSFT
Jack J Jun- MSFT

Reputation: 5986

Please check if you have the following Nuget-Package in the Dependencies.

enter image description here

If you don't have the Nuget-package Microsoft.NET.Sdk.Functions, please right-click Packages->Manage Nuget-package->Search the package and install it.

enter image description here

If you already have the Nuget-package Microsoft.NET.Sdk.Functions, please find it in the Installed tab and reinstall it.

enter image description here

Upvotes: 1

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65361

It looks like you do not have the required nuget packages installed.

Use the "Manage packages for the solution" to install the missing packages.

See: https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#manage-packages-for-the-solution

The picture in the article shows the "Microsoft.AspNet.Mvc" package

Upvotes: 1

Related Questions