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):
Copy dotnet new classlib - o EFConnect . Models -- framework netcoreapp2
Copy dotnet new classlib - o EFConnect . Services -- framework netcoreapp2
Copy dotnet new classlib - o EFConnect . Data -- framework netcoreapp2
Copy 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
Copy 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:
Copy <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.
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.
In .Contracts, add a reference to the Data and Models projects:
In .Models, add a reference to the Data project:
Now, we need to add references to the Microsoft.AspNetCore.All metapackage in the .Services and .Models projects:
Add Angular Project
In your main EFConnect folder, run the following command:
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:
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.