In our recent MVC training in Mumbai one of our students was coding the whole lessons in MVC core 1 and later was trying to migrate the project to 2.0 and the below error came up. For migration we tried to follow these steps http://stepbystepschools.net/?p=1758.
“System.BadImageFormatException: ‘Could not load file or assembly ‘dotnet-aspnet-codegenerator-design’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”
The solution for this was to remove entries of “Microsoft.VisualStudio.Web.CodeGeneration” from the “csproj” file. So we need to right click on the csproj and unload the project , edit and make changes.
By doing so your templates will not work. If you want to use templates you need to put the entries back to CSproj and remove it while running the application.