Downgrade/convert mvc 4 to mvc 3

2020-04-16 03:56发布

问题:

I know this is a rather odd question, please don't flame me :)

I have a concrete need to "downgrade" a current Asp.Net Mvc 4 (net framework 4.5) application to Asp.Net Mvc 3 (net framework 4.0) because our shared hosting provider does not support .Net 4 (I know it's crazy considering it's been in retail since 12 Aprli 2010 and first beta came out in May 2009 but it's not the point of the post).

Is there any tool, or guide, or anything that could help in the process? I'm getting a bit lost because I upgraded many applications but I never had to downgrade one.

I have use some of the features like begincollectionitem which may not be direct compatible to mvc3

回答1:

I doubt you'll find an official guide or tool, you'll have to do it manually. Personally, I would do the following:

  • Start a new MVC 3 Project (MVC3 is available via nuget)
  • Copy your files from one to the other
  • Fix any compilation issues
  • Use the publish site feature to publish somewhere locally (this will hopefully find compilation issues in your Razor views which don't get found during the project build)
  • Test the site fully!

Sorry it's not more helpful, but I don't think people generally design for the downgrade process.