问题描述
我使用的是 Visual Studio 2019。
在重新安装 Visual Studio 之前,我的 ASP.NET Core MVC 项目和脚手架工作正常。
但在那之后我无法添加新的脚手架项目。
通过更新所有 NuGet 包然后运行脚手架,它会自动降低包的性能
编辑 1:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Anycpu'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20200625063143_user_table_added_for_access_control.cs" />
<Compile Remove="Migrations\20200625063143_user_table_added_for_access_control.Designer.cs" />
<Compile Remove="Migrations\20200625070609_test.cs" />
<Compile Remove="Migrations\20200625070609_test.Designer.cs" />
<Compile Remove="Migrations\20200701100225_datatype_changed_to_long_of_assetno_in_both_table.cs" />
<Compile Remove="Migrations\20200701100225_datatype_changed_to_long_of_assetno_in_both_table.Designer.cs" />
<Compile Remove="Migrations\20200730114532_hasShiftingRequest_field_added_in_pc.cs" />
<Compile Remove="Migrations\20200730114532_hasShiftingRequest_field_added_in_pc.Designer.cs" />
<Compile Remove="Migrations\20200731033230_hasShiftingRequest_field_added_in_pc.cs" />
<Compile Remove="Migrations\20200731033230_hasShiftingRequest_field_added_in_pc.Designer.cs" />
<Compile Remove="Migrations\20200917095552_trial.cs" />
<Compile Remove="Migrations\20200917095552_trial.Designer.cs" />
<Compile Remove="Migrations\20201208042418_test.cs" />
<Compile Remove="Migrations\20201208042418_test.Designer.cs" />
<Compile Remove="Migrations\20201208054030_User_table_mapped_with_laptop_and_desktop.cs" />
<Compile Remove="Migrations\20201208054030_User_table_mapped_with_laptop_and_desktop.Designer.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="Views\AssetDataLaptops\Delete.cshtml" />
<Content Remove="Views\AssetDataPcs\Delete.cshtml" />
<Content Remove="Views\AssetShiftings\Delete.cshtml" />
<Content Remove="Views\AssetShiftings\Details.cshtml" />
<Content Remove="Views\AssetShiftings\Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<packagereference Include="bootstrap" Version="4.6.0" />
<packagereference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
<packagereference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<packagereference Include="Microsoft.EntityFrameworkCore.sqlite" Version="3.1.11" />
<packagereference Include="Microsoft.EntityFrameworkCore.sqlServer" Version="3.1.11" />
<packagereference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</packagereference>
<packagereference Include="Microsoft.Office.Interop.Excel" Version="15.0.4795.1000" />
<packagereference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="3.1.4" />
<packagereference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<packagereference Include="System.DirectoryServices" Version="5.0.0" />
<packagereference Include="System.DirectoryServices.AccountManagement" Version="5.0.0" />
</ItemGroup>
</Project>
编辑 2:
将 EntityFrameworkCore 5 降级到 3.x 后出现构建错误
解决方法
因为您的项目版本是 3.1,所以您不应该使用包 <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
。
您需要将其更改为 3.x。