Search code examples
c#visual-studioentity-frameworkasp.net-corecsproj

.csproj file automatically changing on building Solution?


I was not able to scaffold Razor pages due to the incompatibility of various Entity framework versions, So I install all version 5.0.x and the .csproj file was updated. But as I Built the solution It changes back to previous versions.

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

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="Views\Logsign\signup.cshtml" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.15" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.15">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
  </ItemGroup>

</Project>

Solution

  • Did you change the TargetFramework to 5.0?

    <PropertyGroup>
       <TargetFramework>netcoreapp5.0</TargetFramework>
    </PropertyGroup>