5

I have created an application with ASP.Net 4.5 and MVC5; however, the hosting server that I use doesn't support MVC5. Therefore, I have to downgrade to MVC4.

I can either use ASP.Net 4.5 or ASP.Net 4, my application works on both frameworks.

I have tried the following steps from this question or this or this:

  1. Right click on the project in the Solution Explorer (in Visual Studio) and select Properties.
  2. Change the Target Framework drop-down to whatever framework you now wish to target.
  3. Do the same for any other projects or test projects in the solution, that you also wish to change the target framework for.
  4. Manually edit the .csproj file in a text editor and replace all "net45" strings to "net40"
  5. In visual Studio, click the Tools menu and select Library Package Manager > Manage NuGet Packages for Solution
  6. Click on Updates
  7. Update all Microsoft packages
  8. Click Restart Now.
  9. Rebuild project.

Everything works perfectly until step 4. However the MVC packages don't get downgraded to MVC4.

I have also tried creating a MVC 4 application, but since I use Visual Studio 2015, I'm not given that option.

Any ideas on how to downgrade to MVC4, painlessly? Thank you :)

Community
  • 1
  • 1
Farshad Momtaz
  • 424
  • 1
  • 8
  • 22
  • why you neet change "net45" strings to "net40"? This is not connected with MVC version it's only .NET framework verson MVC 4 can work with 4 and 4.5 – teo van kot Dec 23 '16 at 06:57
  • I have tried using the package manager and just downgrading to MVC 4 but the dependencies such as razor don't downgrade automatically, and I don't know what versions of the dependencies are needed. I tried going to net40 because i thought it would be an easier way to downgrade. I'm open to any ideas. – Farshad Momtaz Dec 23 '16 at 07:21
  • 1
    In VS2013, it was looking like MVC4 was not available as a new project too. But after changing `New Project` dialog target framework to `.NET Framework 4`, it appears again under `Installed\Templates\Visual C#`. Have you tried that with VS2015? – Frédéric Dec 23 '16 at 08:13
  • 1
    @FarshadMomtaz .NET 4.0 is no longer supported. Instead of moving to an unsupported framework, just upgrade to the earliest supported version, 4.5.2. – Panagiotis Kanavos Dec 23 '16 at 09:42
  • 2
    @FarshadMomtaz if your hosting server doesn't offer a *supported* .NET version, either demand your money back and move, or insist they provide a *supported* .NET version. I'd question the professionality of any hoster that sells unsupported stacks though - it may mean that the rest of their service (hardware, backups, uptime) isn't very supportable either – Panagiotis Kanavos Dec 23 '16 at 09:45
  • I think there's a bit of confusion around ASP.NET and ASP.NET MVC versions. The OP states that they __CAN__ use ASP.NET 4.5 but the problem is the version of ASP.NET MVC. – phuzi Dec 23 '16 at 11:07
  • @Frédéric the option does appear under there but don't have all the packages but it's a good solution – Farshad Momtaz Jan 05 '17 at 18:12
  • 1
    @PanagiotisKanavos You are correct, I just got a refund and went to a hosting service that supported updated products! – Farshad Momtaz Jan 05 '17 at 18:14
  • FYI - Downgrading might not be straightforward. Some features (such as Attribute Routing) are only available in MVC 5, so if you are using them it could be more trouble than its worth to downgrade. – NightOwl888 Oct 05 '17 at 04:35

2 Answers2

0

Nope, ASP.NET MVC 5 requires .NET 4.5 at least. Directory browsing is not the problem, don't turn it on. Check the Event Viewer for errors.

I can't link to any official source for this statement but you only get ASP.NET MVC 4 project template when you switch to .NET 4.0.

0

Not sure downgrading ASP.NET MVC to version 4 is the answer here...

You don't say whether MVC 5 is explicitly not supported by your provider or it's implied because it's not in the list of supported frameworks.

If it's the latter have you tried actually deploying the app to see if it works?

You should be able to Bin Deploy ASP.NET MVC 5 by making sure the relevant assemblies are deployed with the rest of your app.

phuzi
  • 12,078
  • 3
  • 26
  • 50