【问题标题】:.csproj file automatically changing on building Solution?.csproj 文件在构建解决方案时自动更改?
【发布时间】:2021-08-29 17:33:29
【问题描述】:

由于各种实体框架版本不兼容,我无法搭建 Razor 页面,因此我安装了所有版本 5.0.x 并更新了 .csproj 文件。但是当我构建解决方案时,它会变回以前的版本。

<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>

【问题讨论】:

    标签: c# visual-studio entity-framework asp.net-core csproj


    【解决方案1】:

    您是否将 TargetFramework 更改为 5.0?

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

    【讨论】:

    • 是的,它有效。但是在添加剃须刀页面之前,net core 3.1 在实体框架版本 5 上运行良好。
    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-24
    相关资源
    最近更新 更多