Vlada
Vlada

Reputation: 21

Error during addView in MVC project in Visual Studio 2019

When I click to "AddView" in my MVC project, Visual Studio 2019 show me error "The Templates\PackageVersions5.2.5.xml file is missing from the installed template folder." What I am missing in my installation?

Upvotes: 1

Views: 1880

Answers (4)

M Saiful Islam
M Saiful Islam

Reputation: 1

Go to the path in your PC(Visual Studio Template Path)

C:\Program Files (x86)\Microsoft Visual Studio\2019\vname\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates

here vname is the version name of your installed Visual Studio like Professional or Community or Enterprise. After that check which PackageVersions(sequentially) is missing in this directory. In this case PackageVersions5.2.5.xml is missing here. I've resolve this issue by copied the PackageVersions5.2.6.xml and forcefully pasted in the same directory. After that I renamed the PackageVersions5.2.6 - Copy.xml file to PackageVersions5.2.5.xml and reopen the Visual Studio 2019 and it's worked.

Image of the missing package versions in the template directory

Upvotes: 0

Alex from Jitbit
Alex from Jitbit

Reputation: 60782

What helped me was updating the Microsoft.AspNet.Mvc Nuget package (and its dependencies) to 5.2.7

Upvotes: 1

Jorge Censi
Jorge Censi

Reputation: 43

This issue has been fixed with the Visual Studio Update 16.0.3

https://learn.microsoft.com/en-au/visualstudio/releases/2019/release-notes#16.0.3

Upvotes: 2

C.Buckneberg
C.Buckneberg

Reputation: 21

I don't have the 50 Rep to comment so I'm adding this in the Answers section in the hopes that it will flesh out the issue some of us are having a bit. I'm not sure if my problem resulting in the same error was created the same way Vlada's is but here is more information.

I to am having this issue. I just uninstalled 2019 community and installed 2019 Professional this morning and while I had no issues with community, I am having this error now with Professional.

I opened an MVC 4 project I'm working on, Right clicked on one of the folders under Views Clicked Add Then clicked View

Filled out the pop up to Add View with a name and Empty (without model) for template Checked Create as a partial view clicked Add

and got the Following Error message

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

Fix for this is when you open your project in VS 2019, don't forget to

  1. Right click on References
  2. Manage NuGet Packages
  3. Click the Updates tab
  4. Update your NuGet packages to the most recent version that IS NOT a preview or beta.
  5. Save all
  6. Close Solution
  7. Reopen the solution or project and continue where you left off.

VS 2019 Professional Error

Upvotes: 1

Related Questions