# 1.5: Adding Other Projects and References

## Add other ASP.NET Core Projects

Now we're going to add our class libraries that will support our API.

Inside your main EFConnect folder (not inside your API project):

```csharp
dotnet new classlib -o EFConnect.Models --framework netcoreapp2
```

```csharp
dotnet new classlib -o EFConnect.Services --framework netcoreapp2
```

```csharp
dotnet new classlib -o EFConnect.Data --framework netcoreapp2
```

```csharp
dotnet new classlib -o EFConnect.Contracts --framework netcoreapp2
```

We added the --framework option to tell it to make these class libraries target the .NET Core ^2.0+ framework. Its default is .NET Standard 2.0 - which won't work with some packages we need.

Delete the default Class1.cs files generated in the class libraries.

## Add Project References

Navigate into your EFConnect.API project in your command line

```
dotnet add reference ../EFConnect.Data/EFConnect.Data.csproj
```

This adds a reference in our `.API` project to the `.Data` project.

In our `EFConnect.API.csproj` file: we now have a new `ItemGroup` with a reference to our `.Data` project:

```markup
<ItemGroup>
    <ProjectReference Include="..\EFConnect.Data\EFConnect.Data.csproj" />
</ItemGroup>
```

Alternatively to adding the project reference via the command line - you could also just type that into the .csproj file.

Copy the project reference down two more times and edit them to add references to the Models, Data, Contracts, and Services class libraries.

```markup
<ItemGroup>
    <ProjectReference Include="..\EFConnect.Data\EFConnect.Data.csproj" />
    <ProjectReference Include="..\EFConnect.Models\EFConnect.Models.csproj" />
    <ProjectReference Include="..\EFConnect.Contracts\EFConnect.Contracts.csproj" />
    <ProjectReference Include="..\EFConnect.Services\EFConnect.Services.csproj" />
</ItemGroup>
```

Next, open the `EFConnect.Services.csproj` file and add references to the Data, Models, and Contracts projects.

This can be done manually by copying and editing what we did above - or via the CLI.

```markup
<ItemGroup>
    <ProjectReference Include="..\EFConnect.Data\EFConnect.Data.csproj" />
    <ProjectReference Include="..\EFConnect.Models\EFConnect.Models.csproj" />
    <ProjectReference Include="..\EFConnect.Contracts\EFConnect.Contracts.csproj" />
</ItemGroup>
```

In `.Contracts`, add a reference to the Data and Models projects:

```markup
<ItemGroup>
    <ProjectReference Include="..\EFConnect.Data\EFConnect.Data.csproj" />
    <ProjectReference Include="..\EFConnect.Models\EFConnect.Models.csproj" />
</ItemGroup>
```

In `.Models`, add a reference to the Data project:

```markup
<ItemGroup>
    <ProjectReference Include="..\EFConnect.Data\EFConnect.Data.csproj" />
</ItemGroup>
```

## Add References to the Metapackage

Now, we need to add references to the `Microsoft.AspNetCore.All` metapackage in the `.Services` and `.Models` projects:

```markup
<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5"/>
</ItemGroup>
```

## Add Angular Project

In your main EFConnect folder, run the following command:

```
ng new EFConnectSPA --skip-tests --style scss --skip-git
```

This scaffolds out a new Angular project and tells the CLI we'd like `.scss` instead of `.css` and that we don't want it to generate test files.

Next, we'll install a few packages: ngx-bootstrap, font-awesome, and Bootstrap 4.

Navigate into your `SPA` project and run the following command:

```
npm install ngx-bootstrap bootstrap font-awesome --save
```

## Initialize Git Repository

Now that we have the basic structure of our project - it would be a good time to initialize a new Git repository!

Initialize a new git repository in your main EFConnect folder.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eleven-fifty-academy.gitbook.io/dotnet-302-core/1-intro-and-setup/1.5-adding-other-projects-and-references.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
