При запуске выбранного генератора кода произошла ошибка mvc

I’m following a video tutorial where I’m required to create an empty ASP.NET Web Application with MVC, using Visual Studio 2015, being new to ASP.NET world, I’m following step by step.

I got my project created well, next step adding a View from an existing Controller, I got hit by a messagebox error saying :

Error :
There was an error running the selected code generator:
‘Invalid pointer (Exception from HRESULT:0x80004003(E_POINTER))’

I Googled the problem, found similar issues, but none led to a clear solution, some similar problems were issued by anterior version of VisualStudio, but as I said none with a clear solution.

To clarify what I experienced, here’s what I’ve done step by step :

Chosen a ASP.NET Web Application :

enter image description here

Chosen Empty Template with MVC checked :

enter image description here

Tried to Add View from a Controller :

enter image description here

Some settings …

enter image description here

The Error :

enter image description here

What’s causing this problem and What is the solution for it ?

Update :

It turns out that even by trying to add the View manually I get the same error, adding a view is all ways impossible !

asked Jan 25, 2016 at 12:25

AymenDaoudi's user avatar

AymenDaoudiAymenDaoudi

7,8419 gold badges52 silver badges84 bronze badges

2

Try clearing the ComponentModelCache, the cache will rebuild next time VS is launched.

  1. Close Visual Studio
  2. Delete everything in this folder C:\Users\ [your users name] \AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
  3. Restart Visual Studio

14.0 is for visual studio 2015. This will work for other versions also.

VSB's user avatar

VSB

9,84516 gold badges72 silver badges146 bronze badges

answered Mar 5, 2016 at 14:06

longday's user avatar

longdaylongday

4,1004 gold badges29 silver badges35 bronze badges

9

I had this issue with a different error message «-1 is outs the bounds of..»

The only thing that worked for me, was to remove the project from the solution by right clicking the project and selecting ‘Remove’. Then right click the solution, Add Existing Project, and selecting the project to reload it into the solution.

After reloading the project, I can now add views again.

answered Aug 29, 2019 at 16:20

lucky.expert's user avatar

lucky.expertlucky.expert

7431 gold badge15 silver badges24 bronze badges

1

I have the same error but in VS 2017 when I create a controller. I did it in the same way as @sh.alawneh wrote. Also, I tried to do what @longday wrote. But It didn’t work. Then I tried in another way:

  • Right click on the target folder.
  • From the list, choose Add => New Item.

There I choose a new controller and it works fine.

Maybe I’ll help someone.

answered Dec 10, 2018 at 16:41

Maksym Labutin's user avatar

Maksym LabutinMaksym Labutin

5611 gold badge8 silver badges17 bronze badges

2

Follow these steps to add a view in a different way than the typical way:

  • 1) Open Visual studio.
  • 2) Create/open your project.
  • 3) Go to Solution Explorer.
  • 4) Right click on the target folder.
  • 5) From the list, choose Add.
  • 6) From the child list, choose MVC View Page (Razor) or MVC View Page with layout (Razor).
  • 7) If you select the second choice from the previous step, you should choose a layout page for your view from the pop up window.
  • 8) That’s it!

If you cannot open the view that you are created, simply right click on the view file, choose Open with, and select HTML (web forms) editor then okay.

The SE I loved is dead's user avatar

answered Jul 27, 2016 at 17:17

sh.alawneh's user avatar

sh.alawnehsh.alawneh

6395 silver badges13 bronze badges

1

In my case helped the following:

  1. Restart VS
  2. Solution Explorer => Right click on solution => Rebuild solution

answered Nov 29, 2020 at 17:33

essential's user avatar

essentialessential

6481 gold badge7 silver badges19 bronze badges

1

I solved this problem in this way

first I had Entity frameworks with the latest version 5.0.5

enter image description here

and the code generation package with version 5.0.2

enter image description here

so I just uninstalled Entity frameworks and install version 5.0.2 as the same for code generation package

and its worked

answered May 3, 2021 at 19:42

Nour's user avatar

NourNour

1268 bronze badges

1

Right-click on the project under the solution and click unload Project,

you will see that the project is unloaded, so now re right-click on it and press load project

then try to add your controller

answered Nov 19, 2019 at 12:36

Mohammad omar's user avatar

2

Lets assume you are using a datacontext in a DLL, well, it was my case, and I dont know why I have the same error that you describe, I solve it creating a datacontextLocal on the backend project. then I pass the Dbset to the correct datacontext and delete the local (you can let it there if you want, can be helpfull in the future

if you ready are using it in local datacontext, create a new one and then pass the Dbset to the correct one

answered Sep 29, 2017 at 11:59

sGermosen's user avatar

sGermosensGermosen

3123 silver badges14 bronze badges

In ASP.NET Core check if you have the Microsoft.VisualStudio.Web.CodeGeneration.Tools nuget package and it corresponds to your project version.

answered Aug 21, 2018 at 8:45

Oleksandr Kyselov's user avatar

1

C:\Users\{WindowsUser}\AppData\Local\Microsoft\VisualStudio\16.0_8183e7d1\ComponentModelCache

Remove from this folder for VS 2019 ….

answered Aug 30, 2019 at 17:01

Farzad Sepehr's user avatar

I am working on a Core 3 app and had this issue pop up when adding a controller. I figured out that the Microsoft.VisualStudio.Web.CodeGeneration.Design package was updated with a .net 4.x framework dll. Updating to the project to Core 3.1 fixed the issue.

answered Dec 18, 2019 at 20:11

Hoodlum's user avatar

HoodlumHoodlum

1,4431 gold badge13 silver badges24 bronze badges

just in case someone is interested — the solution with clean cache didnt work for me. but i’ve managed to solve an issue but uninstalling all .Net frameworks in the system and then install them back one by one.

answered Jun 15, 2017 at 14:51

Leonid's user avatar

LeonidLeonid

4785 silver badges15 bronze badges

I just restarted my visual studio and it worked.

answered Mar 21, 2018 at 18:00

Kurkula's user avatar

KurkulaKurkula

6,38827 gold badges128 silver badges203 bronze badges

Try clearing the ComponentModelCache,

1.Close Visual Studio

2.Delete everything in this folder C:\Users\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

3.Restart Visual Studio

4.Check again

this also used VS2017 to get solution

answered May 28, 2018 at 20:04

Deepak Savani's user avatar

I ran into a similar issue that prevented the code generation from working. Apparently, my metadata had unknown properties or values. I must admit I did not try all the answers here but who really wants to reinstall vs or download any of the numerous Nuget packages being used.

Cleaning the project worked for me (Build->Clean Solution) The generator was using some outdated binaries to build the controller and views. Cleaning the solution removed the outdated binaries and voilà.

answered Aug 28, 2018 at 21:56

user3416682's user avatar

user3416682user3416682

1132 silver badges8 bronze badges

I’m currently trying to familiarise myself with MVC 4. I’ve been developing with MVC 5 for a while, but I need to know MVC 4 to study for my MCSD certification. I’m following a tutorial via Pluralsight, targeting much older versions of Entity Framework, and MVC, (the video was released in 2013!)

I hit this exact same error 2 hours ago and have been tearing my hair out trying to figure out what is wrong. Thankfully, because the project in this tutorial is meaningless, I was able to step backward throughout the process to figure out what it was that was causing the object ref not set error, and fix it.

What I found was an error within the structure of my actual solution.

I had a MVC web project set up (‘ASP.NET Web Application (.NET Framework)‘), but I also had 2 class libraries, one holding my Data Access Layer, and one holding the domain setup for models connecting to my database.

These were both of type ‘Class Library (.NET Standard)‘.

The MVC project did not like this.

Once I created new projects of type ‘Class Library (.NET Framework)’, and copied all the files from the old libraries to the new ones and fixed the reference for the MVC web project, a rebuild and retry allowed me to scaffold the View correctly.

This may seem like an obvious fix, don’t put a .NET Standard project alongside a .NET Framework one and expect it to work normally, but it may help others fix this issue!

answered Aug 31, 2018 at 13:58

IfElseTryCatch's user avatar

My problem was the Types used in the Model Class.

Using the Types like this:

    [NotMapped]
    [Display(Name = "Image")]
    public HttpPostedFileBase ImageUpload { get; set; }


    [NotMapped]
    [Display(Name = "Valid from")]
    public Nullable<DateTime> Valid { get; set; }


    [NotMapped]
    [Display(Name = "Expires")]
    public Nullable<DateTime> Expires { get; set; }

No longer works in the Code Generator. I had to remove these types and scaffold without them, then add them later.

It is silly, [NotMapped] used to work when scaffolding.

Use the base Types: int, string, byte, and so on without Types like: DateTime, List, HttpPostedFileBase and so on.

answered Mar 19, 2019 at 20:55

Rusty Nail's user avatar

Rusty NailRusty Nail

2,7023 gold badges34 silver badges55 bronze badges

I have been scratching my head with this one too, what i found in my instance was that an additional section had been added to my Web.config file. Commenting this out and rebuilding solved the issue and i was now able to add a new controller.

answered May 18, 2019 at 17:04

Icementhols's user avatar

IcementholsIcementhols

6531 gold badge9 silver badges11 bronze badges

A simple VS restart worked for me. I just closed VS and restarted.

answered Sep 19, 2019 at 4:12

Sajithd's user avatar

SajithdSajithd

5291 gold badge5 silver badges11 bronze badges

None of these solutions worked for me. I just updated Visual Studio (updates were available) and suddenly it just works.

answered Oct 16, 2019 at 2:58

Exel Gamboa's user avatar

Exel GamboaExel Gamboa

9361 gold badge14 silver badges25 bronze badges

The issue has been resolved after installed EntityFramework from nuget package manager into my project. Please take a look on your project references which already been added EntityFramework. Finally I can add the view with template after I added EntityFramework to project reference.

answered Oct 23, 2019 at 7:38

Ei Ei Phyu's user avatar

Deleting the .vs folder inside the solution directory worked for me.

answered Dec 16, 2019 at 16:54

Adam Hey's user avatar

Adam HeyAdam Hey

1,5221 gold badge20 silver badges25 bronze badges

I know this is a really old thread, but I came across it whilst working on my issue. Mine was caused because I had renamed one of my Model classes. Even though the app built and ran fine, when I tried to add a new controller I got the same error. For me, I just deleted the class I had renamed, added it back in and all was fine.

answered Jul 27, 2020 at 10:27

SkinnyPete63's user avatar

SkinnyPete63SkinnyPete63

6071 gold badge6 silver badges20 bronze badges

Check your Database Connection string and if there any syntax errors in the appsettings.json it will return this error.

answered Apr 23, 2021 at 5:46

Theepag's user avatar

TheepagTheepag

3012 silver badges16 bronze badges

Another common cause for this, which is hinted in the build log, is your IIS Express Web Server is running while you are trying to build a scaffold. Stop/Exit your web server and try building the scaffold again.

answered May 23, 2021 at 13:37

Dean P's user avatar

Dean PDean P

1,84123 silver badges23 bronze badges

Try unload and reload project (solution).

answered Apr 17, 2022 at 6:51

Dee Nix's user avatar

Dee NixDee Nix

1701 silver badge13 bronze badges

So, i had this problem in vs2019.

  • none of the other suggestions helped me

This is what fixed me:

  • upgrade .net 5.0 dependencies to 5.0.17

enter image description here

answered Sep 8, 2022 at 13:41

Omzig's user avatar

OmzigOmzig

8611 gold badge12 silver badges20 bronze badges

I had same error. what I did was to downgrade my Microsoft.VisualStudio.Web.CodeGeneration.Design to version 3.1.30 since my .net version was netcoreapp3.1. This means the problem was a mismatch of the versions.

So check your version of dotnet and get a matching version of Microsoft.VisualStudio.Web.CodeGeneration.Design that supports it.

answered Oct 25, 2022 at 9:10

Daniel Akudbilla's user avatar

1

I had similar proble to this one. I went through 2 appraches for solving this.

First Approach: Not The Best One…

I had created a project on VS2019, and tried to add a controller using VS2022. Not possible. I’d get an error every time.

searchFolders

Error ... Parameter name: searchFolder

Only from VS2019 I’d be able to scaffold the controller I needed. Not the best solution really… But it worked nevertheless.

You could try adding what you need from a different VS version.

Second Approach: The Best One

After further research I found this solution.

From Visual Studio Installer, I added the following components to my VS22 installation:

.NET Framework project and item templates

.NET Framework project and item templates

This made possible to add the controller I needed on VS22.


I know this solution does not point exactly to your problem, but it’s maybe a good lead to it. Like you, when I was trying to add/scaffold the controller, I was able to see all the components in the wizard, but in creation after naming it, the error was thrown.

answered Nov 30, 2022 at 15:11

carloswm85's user avatar

carloswm85carloswm85

1,42513 silver badges24 bronze badges

I just turned off my v2ray proxy and it worked

answered Mar 1 at 12:40

Sur Khosh's user avatar

Sur KhoshSur Khosh

1151 silver badge8 bronze badges

For what it’s worth, the below solution is what worked for me.

My Setup:
First of all my project setup was different. I had a MyProject.Data and MyProject, and I was trying to scaffold «API Controller with actions, using Entity Framework» on to my API folder in MyProject, and I was getting the error in question. I was using .net 3.1.

Solution:
I had to downgrade all the below nuget packages installed on MyProject.Data project

Before downgrade:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">


 After downgrade:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.11">

Then tried again to use scaffolding and it just worked!!

After scaffolding MyProject had the below nuget package versions installed:

<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"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> 

The main problem was that no errors were displayed other than the one that shows up on the dialog box or does not even point us to any logs or nor any helpful documentation are available. If anyone finds one please attach it to this answer. It was very frustrating and this almost ate away half-day of my weekend :(

Hope it helps someone. Happy coding!!

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username
Email Address
Password

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Произошла ошибка при запуске выбранного генератора кода:

Я установил VS 2019 на свои окна 10. Создан базовый веб-проект ASP.net -> Выбранный API. Когда я пытаюсь сгенерировать контроллер, ссылающийся на модель и создавший класс контекста, он не генерирует класс контроллера, но выдает следующую ошибку:

Ошибка, произошла ошибка при запуске выбранного генератора кода

‘Необработанное исключение. System.IO.FileNotFoundException: не удалось загрузить файл или сборку Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version = 3.1.2.0, Culture = нейтральный, PublicKeyToken = adb9793829ddae60. Система не может найти указанный файл. Имя файла: ‘Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version = 3.1.2.0, Culture = нейтральный, PublicKeyToken = adb9793829ddae60’ в Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main (String [] args)

person
user3497702
  
schedule
26.04.2020
  
source
источник


Ответы (10)

У меня тоже была эта проблема, но следующий ответ сработал для меня. Выберите «Управление пакетами Nuget» и установите эти пакеты.

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" ExcludeAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="3.1.2" />

person
Akın Kaplan
  
schedule
01.05.2020

Чтобы решить эту проблему, вы можете щелкнуть проект правой кнопкой мыши и выбрать «Управление пакетами Nuget».

Затем найдите Microsoft.VisualStudio.Web.CodeGeneratio.Utils, затем установите его.

После установки вышеуказанного он генерируется без ошибок.

person
user3497702
  
schedule
26.04.2020

Как бы то ни было, у меня сработало приведенное ниже решение.

Моя установка: Во-первых, установка моего проекта была другой. У меня были MyProject.Data и MyProject, и я пытался сформировать контроллер API с действиями, используя Entity Framework в моей папке API в MyProject, и я получал указанную ошибку. Я использовал .net 3.1.

Решение: мне пришлось отказаться от всех нижеперечисленных пакетов nuget, установленных в проекте MyProject.Data.

Before downgrade:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">


 After downgrade:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.11">

Затем попытался снова использовать строительные леса, и это сработало !!

После создания каркаса MyProject установил следующие версии пакета nuget:

<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"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> 

Основная проблема заключалась в том, что не отображалось никаких ошибок, кроме той, которая отображается в диалоговом окне или даже не указывает нам на какие-либо журналы или какую-либо полезную документацию. Если кто-нибудь найдет его, приложите его к этому ответу. Это было очень неприятно, и это почти съело полдня моих выходных :(

Надеюсь, это кому-то поможет. Удачного кодирования !!

person
chethandb
  
schedule
30.01.2021

У меня было аналогичное поведение, но с другой версией пакета: «Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version = 3.1.4.0». Пакет уже установлен (как в «Управлении пакетами NUGet», так и в файле .csproj). Я удалил его из управления пакетами NUGet и переустановил. Это решило мою проблему.

person
jeanie77
  
schedule
23.09.2020

Пожалуйста, проверьте, все ли у вас включены в совместимую версию. Это может произойти, если у вас есть пакеты разных версий, одна из которых не поддерживает текущую функциональность / тип проекта.

person
Chaitanya Krishna
  
schedule
17.01.2021

Я тоже столкнулся с той же проблемой. Это проблема с разными версиями пакетов NuGet. просто попробуйте использовать похожие версии пакетов.

Microsoft.VisualStudio.Web.CodeGeneration.Utils (5.0.2) Microsoft.VisualStudio.Web.CodeGeneration.Design (5.0.2)

person
Tanvir Moghal
  
schedule
08.03.2021

У меня была аналогичная ошибка во время входа в систему ovveride Identity и макета регистрации. Я удалил все пакеты из Application.Web и снова установил. Мои переустановленные библиотеки из пакетов NuGet:

Microsoft.AspNetCore.Authentication.Google
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
Microsoft.AspNetCore.Identity.EntityFrameworkCore
Microsoft.AspNetCore.Identity.UI
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
Microsoft.VisualStudio.Web.CodeGeneration.Design

person
bartek1724
  
schedule
11.03.2021

В моем решении был проект .Data и еще один проект .API. Контроллер действий с автоматическим созданием шаблонов пытался добавить Microsoft.VisualStudio.Web.CodeGeneration.Design до v5.0.2. Мне пришлось понизить все мои пакеты nuget до 5.0.2 следующим образом:

Проект данных

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />

API проект

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />

Затем контроллер действий API с EF core dbcontext смог успешно добавить:

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />

Надеюсь, это поможет! Всего наилучшего.

person
Omar Shawqy
  
schedule
04.05.2021

В моем решении было 5 проектов (2 библиотеки DLL, веб-сервис, db и MVC). Я удалил все, кроме проекта MVC, и проблема исчезла. Добавил все проекты обратно, и проблема не вернулась. Сравнение старого файла решения с новым показало множество изменений, трудно сказать, какое изменение было исправлением, но файл решения намного чище.

person
Ezekiel IIX
  
schedule
16.06.2021

Volodya_

14 / 12 / 3

Регистрация: 20.02.2018

Сообщений: 446

1

06.07.2021, 07:12. Показов 9812. Ответов 8

Метки asp .net core, c#, entity framework core, visual studio 2019, visual studio (Все метки)


Студворк — интернет-сервис помощи студентам

Проект ASP NET CORE 3, использую EF Core 3.1.13.

Ранее в этом же проекте контроллеры автоматически генерировались. Сейчас при попытке сгенерировать контроллер MVC с представлениями, использующий EF выдает ошибку:

При запуске выбранного генератора кода произошла ошибка сбой при восстановлении пакета. откат изменений пакета для …

Про гуглил данную ошибку и все пишут про отсутствия нужных пакетов и советуют через Nuget установить их. Пакеты, которые перечислялись у меня все в файле csproj есть:

C#
1
2
3
4
5
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="3.1.5" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="3.1.5" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="3.1.5" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />

Попробовал их удалить и снова переустановить, но это не решило проблему



0



14 / 12 / 3

Регистрация: 20.02.2018

Сообщений: 446

07.07.2021, 15:24

 [ТС]

2

Создал новый проект, добавил в него через NuGet те же самые пакеты — все работает



0



14 / 12 / 3

Регистрация: 20.02.2018

Сообщений: 446

22.07.2021, 12:21

 [ТС]

3

Через некоторое время и в новом проекте перестало все работать



0



1029 / 645 / 215

Регистрация: 08.08.2014

Сообщений: 2,042

22.07.2021, 15:08

4

Volodya_
В 19-й Студии есть стабильный баг с версиями/доступностью пакетов из-за кривого кэширования в каталоге ‘.vs’.

Лечится просто — закрыть Студию, из sln-каталога удалить ‘.vs’-подкаталог, а из всех проектов удалить подкаталоги ‘bin’ и ‘obj’. Запустить Студию, пересобрать солюшен.



0



1008 / 668 / 168

Регистрация: 09.09.2011

Сообщений: 2,036

Записей в блоге: 2

22.07.2021, 15:34

5

Цитата
Сообщение от kotelok
Посмотреть сообщение

В 19-й Студии есть стабильный баг с версиями/доступностью пакетов из-за кривого кэширования в каталоге ‘.vs’.
Лечится просто — закрыть Студию, из sln-каталога удалить ‘.vs’-подкаталог, а из всех проектов удалить подкаталоги ‘bin’ и ‘obj’. Запустить Студию, пересобрать солюшен.

Отчасти правильно.

.vs не нужно удалять. Там нет ничего связанного с пакетами и т.п. А вот кое-какие полезные настройки можно удалить.

Лучший совет — bin и obj папки удалять.
Но по своему опыту могу точно сказать — что удалять их приходится только если я, например, в текущем каталоге ветку переключил в которой не было изменений, в том числе зависимостями. Тогда надо обязательно сборку перебильживать в чистую. В остальных случаях это бесполезно.



0



1029 / 645 / 215

Регистрация: 08.08.2014

Сообщений: 2,042

22.07.2021, 15:41

6

Цитата
Сообщение от HF
Посмотреть сообщение

vs не нужно удалять

Стабильно помогает именно удаление ‘.vs’, когда Студия упорно не видит новую версию пакета из нугета или не определяет новые пути подпроектов после реорганизации структуры проекта (перенос какого-нибудь из проектов в подкаталог). Не только на моей машине. Апдейты все установлены.



0



14 / 12 / 3

Регистрация: 20.02.2018

Сообщений: 446

22.07.2021, 21:56

 [ТС]

7

Цитата
Сообщение от kotelok
Посмотреть сообщение

В 19-й Студии есть стабильный баг с версиями/доступностью пакетов из-за кривого кэширования в каталоге ‘.vs’.
Лечится просто — закрыть Студию, из sln-каталога удалить ‘.vs’-подкаталог, а из всех проектов удалить подкаталоги ‘bin’ и ‘obj’. Запустить Студию, пересобрать солюшен.

Вышел из проекта, закрыл VS, удалил .vs’-подкаталог, удалил подкаталоги ‘bin’ и ‘obj’, удалил ещё до кучи и .sln-файл, запустил VS она сразу автоматически создала подкаталоги ‘bin’ и ‘obj’, пересобрал решение — таже ошибка.

Наличие git как-то может повлиять?

Добавлено через 4 часа 16 минут
Пытаюсь создать снова новый проект и в нем сгенерировать, но он уже и в новом проекте такую же ошибку выдает



0



1008 / 668 / 168

Регистрация: 09.09.2011

Сообщений: 2,036

Записей в блоге: 2

23.07.2021, 08:29

8

Цитата
Сообщение от Volodya_
Посмотреть сообщение

Пытаюсь создать снова новый проект и в нем сгенерировать, но он уже и в новом проекте такую же ошибку выдает

Это проблема индивидуально для вашего проекта, который мы даже не видели. А я например вообще без понятия как работает этот генератор. Нужен ли он в референцах, какой и как и когда генерируются контроллеры.
Указанная вами ошибка обычно связана с зависимостями, которые не совместимы или для проекта вообще или для других пакетов. Может быть тот же ЕФ не совместим с этой версией. Если например убрать эти ссылки, то наверняка будут ошибки типа «Пакет ХХХ ожидал и не нашёл зависимость НННН версии ЮЮЮЮ»
Для начала прочитай полный лог билда. Если не достаточно там информации — увеличьте уровень логирования. В итоге найдёте информацию о конфликтах и попытках исправить или рекомендациях.



0



14 / 12 / 3

Регистрация: 20.02.2018

Сообщений: 446

23.07.2021, 13:16

 [ТС]

9

Цитата
Сообщение от HF
Посмотреть сообщение

Это проблема индивидуально для вашего проекта, который мы даже не видели. А я например вообще без понятия как работает этот генератор. Нужен ли он в референцах, какой и как и когда генерируются контроллеры.
Указанная вами ошибка обычно связана с зависимостями, которые не совместимы или для проекта вообще или для других пакетов. Может быть тот же ЕФ не совместим с этой версией. Если например убрать эти ссылки, то наверняка будут ошибки типа «Пакет ХХХ ожидал и не нашёл зависимость НННН версии ЮЮЮЮ»
Для начала прочитай полный лог билда. Если не достаточно там информации — увеличьте уровень логирования. В итоге найдёте информацию о конфликтах и попытках исправить или рекомендациях.

Логов нет, я же проект не запускаю. Этот генератор генерирует шаблон контроллера на основании созданной сущности. Поэтому кроме вылетающего сообщения ничего нет. Или все-таки где-то что-то ещё есть? Где смотреть нужно?



0



Понравилась статья? Поделить с друзьями:
  • При запуске игры ошибка opengl
  • При запуске виндовс 10 ошибка 0xc00000e9
  • При запуске гта 5 код ошибки 130
  • При запуске игры ошибка dx12
  • При запуске ведьмака 3 вылетает ошибка vcomp110 dll