Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2013 Scaffolding Error when constructing view

I'm getting a curious error when attempting to generate a view via the 'Add View' dialog. Simply leaving the dialog as is (ie creating view 'View') and hitting 'Add' yields the following error dialog:

Error: There was an error running the selected code generator: 'The Templates/PackageVersions5.0.1xml file is missing from the installed template folder.'

Which I'm afraid means little to me. I've googled the xml file to no avail.

Not really sure where to go now - I'm unable to add views to my project via scaffolding (though I can of course just by 'adding a new item' and building it myself).

How can I track down the source of this error?

like image 427
Rich Freeman Avatar asked Dec 19 '22 12:12

Rich Freeman


2 Answers

Posting here because I ran into the same "file is missing" issue with Visual Studio 2019 and PackageVersions5.2.6.xml. This was one of the only pages I could find related to this scaffolding issue so I suspect others will find their way here too.

I found that upgrading the "Microsoft.AspNet.Mvc" package via NuGet to 5.2.7 was not sufficient to fix the problem. I also had to upgrade "Microsoft.AspNet.WebApi" and its related packages to 5.2.7. The Add View option started working again afterward.

like image 102
Chanticrow Avatar answered Jan 08 '23 00:01

Chanticrow


Just make sure you have same version of MVC nugget in all projects, if you only have one project then upgrade/downgrade MVC to different version then revert back to the version you require and issue will get fixed.

I just changed version from 5.2.3 back to 5.2.2 and then reverted back to 5.2.3 and all worked. It appears some file got messed up or and then was restored by this.

like image 33
Moji Avatar answered Jan 08 '23 01:01

Moji