За несколько недель до этого я столкнулся с подобной проблемой, связанной с ошибкой строительных лесов, и получил решение. Я пытаюсь использовать контроллеры> добавить> новый элемент с шаблоном> контроллер MVC с представлениями, используя структуру сущностей
Ссылка на сайт:-
Но дело в том, что я снова столкнулся с этой проблемой.
Мой файл cproj:
<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.EntityFrameworkCore" Version = "3.1.4" />
<PackageReference Include = "Microsoft.EntityFrameworkCore.Relational" Version = "3.1.4" />
<PackageReference Include = "Microsoft.EntityFrameworkCore.Sqlite" Version = "3.1.4" />
<PackageReference Include = "Microsoft.EntityFrameworkCore.SqlServer" Version = "3.1.4" />
<PackageReference Include = "Microsoft.EntityFrameworkCore.Tools" Version = "3.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<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" />
<PackageReference Include = "System.Management" Version = "5.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include = "LocationReports\" />
</ItemGroup>
</Project>
Примечание :-
Я пытался....
-clean and rebuild
-updating all packages
-clear nuget cache
-delete .vs folder and open project and clean/rebuild
-disabling offline nuget package source
-add "https://api.nuget.org/v3/index.json" in nuget package sources
-downgraded all package to 3.1.4 and made same version
@enduser пробовал, но не работает
Какую версию Visual Studio 2019 вы используете? Возможно, проблема связана с версией Visual Studio, попробуйте обновить Visual Studio до последней версии.
@ZhiLv текущая версия Visual Studio im, использующая 16.9.2, на самом деле я принудительно удалил все пакеты nuget и переустановил их один за другим, и теперь моя проблема решена. я не знаю, что было причиной проблемы, но это сработало.
Рад слышать, что вы решили проблему. Возможно, проблема связана с версией пакета CodeGeneration nuget.
попробуйте перезапустить Visual Studio. и перед повторным открытием зайдите в
C:\Users\YourUserName\AppData\Local\Microsoft\VisualStudio\VsVersion\ComponentModelCache
и удалите файлы в папке ComponentModelCache