Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

ASP.NET core 3.0 project file

Suggested Videos
Part 1 - ASP.NET Core razor pages introduction | Text | Slides

In this short video we will discuss what has changed in the project file in ASP.NET Core 3.0. 

If you want the detailed explanation, please watch Part 4 of ASP.NET Core MVC tutorial.


Project file extension

The programming language you are using determines the extension of the project file. If C# is the programming language, then the project file extension is .csproj. If Visual Basic then it is .vbproj.


Edit project file

To edit the project file, right click on the project name in solution explorer and select Edit Project File from the context menu 

OR

Double click on the project name

ASP.NET core 3.0 project file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
  </ItemGroup>

</Project>

ASP.NET core 2.2 project file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

</Project>

What's new in ASP.NET Core 3.0 project file

At the top we have a reference to Microsoft.NET.Sdk.Web. This has not changed from ASP.NET Core 2.0 to 3.0.

TargetFramework node specifies the framework being targeted. Since we are using .NET Core 3.0, the value is netcoreapp3.0. This values is called Target Framework Moniker or TFM in short. If you want to target a different framework, manually change it in the .csproj file or through the project properties window.

In .NET Core 2.2 project file, a package reference to the meta package (i.e Microsoft.AspNetCore.App) was also present. 

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

In .NET Core 3.0, this meta package (Microsoft.AspNetCore.App) is included using a Framework reference instead of a package reference. You can see the Framework reference to the meta package in the Solution Explorer.

asp.net core 3.0 project file

Changes to the meta package in ASP.NET Core 3.0

Some of the packages are removed from the meta package in .NET Core 3.0. For example, packages that provide social logins (like Facebook, Google etc) are removed. EntityFrameworkCore package is also removed. There are other packages as well that are removed. Visit the following link to see the complete list of packages that are removed.
https://github.com/aspnet/AspNetCore/issues/3755

What if I need these packages in my project. For example, I want entity framework core for data access, so how do I include it?

Install the required packages using the nuget package manager and a package reference will be automatically included in the project file as shown below.

<ItemGroup>
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
</ItemGroup>

You can install a nuget package, either by using nuget package manager or by manually editing the project file.

asp.net core razor pages tutorial

No comments:

Post a Comment

It would be great if you can help share these free resources