This section discusses the update CSPROJ files, editing them within Visual Studio, and managing dependencies.
- [Instructor] As mentioned before, .NET Core initially used a project.json file to track references and packages. But now with 2017 and later versions of .NET Core, we have moved back to using csproj files, and this change allows for MSBuild support and brings .NET Core projects in line with the rest of the Microsoft ecosystem. But this is an updated csproj file.
No longer do you have to have a list of all the included files. By default, .NET Core is going to look for any files in the directory tree of where the csproj file is. It manages your NuGet package references. So instead of having a packages.config file, it is built into the csproj file. And it also defines the .NET CLI tooling for the project. And a nice feature that you saw in the last module is that Visual Studio 2017 has added a Edit the csproj file context menu for .NET Core projects.
So we take a look at the SpyStore project. Right-click Edit SpyStore_v10.csproj. We see the PropertyGroup up here to .NET Core app 1.0. Add in C# 7.1. Here are all of our packages. And then here is a .NET tooling. And finally, we have the project references. A nice feature of the project file is that I can add in a new package here.
So let's say we wanted to add in PackageReference Include= and we can add in any name here. Let's put in something so it'll fail, 1.0.0, and we close that. And when we save this, it is going to try and restore that package. And it will give us an error because, of course, that package doesn't exist.
So you don't have to go through NuGet Package Manager. You can do your package management right here in the project file.
- Running and debugging ASP.NET Core applications
- Pros and cons of migrating existing applications to ASP.NET Core.
- Built-in dependency injection
- Environment awareness and app configuration
- Web host configuration and SSL
- View components invoked as tag helpers
- Configuration and logging
- Using Razor Pages