# Missing AspNetCore Nuget Packages

There are several aspects of an ASP Net Core web API that cannot be placed in a class library without a little extra care. This is because Microsoft decided to remove “many of the core assemblies” from nuget packages for the ASPNetCore, when Net Core 3.0 was published, and has not been restored as of NET 6.0.

See this reference for why: <span data-annotation-inline-node="true" data-annotation-mark="true" data-card-url="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/target-aspnetcore?view=aspnetcore-5.0&tabs=visual-studio" data-inline-card="true" data-renderer-start-pos="341"><span class="loader-wrapper"><span data-testid="hover-card-trigger-wrapper">[<span class="_19itglyw _vchhusvi _r06hglyw _o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66" data-testid="inline-card-icon-and-title"><span class="_19itglyw _vchhusvi _r06hglyw">Use ASP.NET Core APIs in a class library</span></span>](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/target-aspnetcore?view=aspnetcore-5.0&tabs=visual-studio)</span></span></span>

So, if you run into a situation where you are trying to create, for example, a Controller class in a class library project, you will not find any Nuget package for the ControllerBase class (in the Microsoft.ASPNetCore.MVC) namespace.

To rectify this, you must manually add a framework reference to the project.cs file that points to “Microsoft.AspNetCore.App”.

This is what the project.cs file would look like with the framework reference added:

```xml
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
  
</Project>
```

This will need to be done for Controller classes that derive from the base, as well as, references to the IWebHostEnvironment environment.