Friday, November 12, 2010

How to Uninstall Microsoft ASP.NET MVC 3 RC

Scott Guthrie 'blogged about some install problems some folks are having with our RC release of Microsoft ASP.NET MVC 3. One problem is that MVC 3 and the Async CTP do not work side-by-side. If you've installed both, you now need to uninstall both to get back into a state where you can install one or the other.


But uninstalling MVC 3 RC isn't as simple as uninstalling everything labeled 'ASP.NET MVC 3' in Programs and Features. MVC 3 RC also installs ASP.NET Web Pages (upon which it depends), NuGet, and a Visual Studio update that adds tools support for the Razor view engine. So, to completely uninstall MVC 3 RC, you actually need to uninstall all of the following:

  • Microsoft ASP.NET MVC 3
  • Microsoft ASP.NET MVC 3 - Visual Studio 2010 Tools (only installed when you have Visual Studio 2010)
  • Microsoft ASP.NET MVC 3 - VWD Express 2010 Tools (only installed if you have Visual Web Developer 2010 Express)
  • Microsoft ASP.NET Web Pages
  • Microsoft ASP.NET Web Pages - Visual Studio 2010 Tools (only installed when you have Visual Studio 2010)
  • Microsoft ASP.NET Web Pages - VWD Express 2010 Tools (only installed if you have Visual Web Developer 2010 Express)
  • NuGet
  • Update for Microsoft Visual Studio 2010 -  (KB2385361) (only installed when you have Visual Studio 2010)
  • Update for Microsoft Visual Web Developer 2010 Express -  (KB2385361) (only installed if you have Visual Web Developer 2010 Express)
N.B., the last two are installed as updates, not products; you'll need to switch to the 'View installed updates' section to uninstall them.

Windows 7 Walk-through

Here is a step-by-step walk-through of how to completely uninstall ASP.NET MVC 3 RC on Windows 7 (the steps and screens will differ on other versions of Windows, but the the idea, and actions you must take, are essentially the same):
  1. Open the Control Panel (Click Start, then click Control Panel)
  2. If you're in Category view, click 'Uninstall a program'; otherwise, click 'Program and Features'
  3. Uninstall everything that includes the phrase 'ASP.NET MVC 3'
  4. Uninstall everything that includes the phrase 'ASP.NET Web Pages'
  5. Uninstall 'NuGet'
  6. Switch to the 'View installed updates' section
  7. Uninstall everything that includes the phrase 'KB2385361'
ASP.NET MVC 3 RC should now be completely uninstalled.

Automating the Uninstallation

If you don't want to take all those manual steps, open a Visual Studio command prompt* with Administrator privilege and run all of the following commands (I suggest you copy and paste them):

  • wmic product where name="Microsoft ASP.NET MVC 3" call uninstall
  • wmic product where name="Microsoft ASP.NET MVC 3 - Visual Studio 2010 Tools" call uninstall
  • wmic product where name="Microsoft ASP.NET MVC 3 - VWD Express 2010 Tools" call uninstall
  • wmic product where name="Microsoft ASP.NET Web Pages" call uninstall
  • wmic product where name="Microsoft ASP.NET Web Pages - Visual Studio 2010 Tools" call uninstall
  • wmic product where name="Microsoft ASP.NET Web Pages - VWD Express 2010 Tools" call uninstall
  • wmic product where name="NuGet" call uninstall
  • msiexec /package {BC0464FA-A0BA-3E38-85BF-DC5B3A401F48} /uninstall {3069D446-63C5-38F4-9D28-41858024419C}
  • msiexec /package {85076DFF-7A17-3566-9CC0-488E6E6D4494} /uninstall {3069D446-63C5-38F4-9D28-41858024419C}
* if you don't know what a Visual Studio command prompt is, or how to open it, I suggest you use the manual steps.

I hope this helps.

Cheers,

13 comments:

  1. Hi Drew,
    Does MVC3 work with VS2008 professional?

    Regards

    ReplyDelete
  2. Anonymous, installing MVC 3 requires an edition of Visual Studio 2010 or Visual Web Developer 2010 Express.

    ReplyDelete
  3. Add these two to the list:
    Microsoft Visual Web Developer 2010 Express
    Microsoft ASP.NET MVC 2 - VWD Express 2010 Tools

    ReplyDelete
  4. Christopher, you should not need to uninstall VWD Express 2010 or any of MVC 2 to address the side-by-side MVC 3/Async CTP issue.

    ReplyDelete
  5. Drew,

    I uninstalled all except for the Update for Microsoft Visual Web Developer 2010 Express - (KB2385361). I am on XP. How could I uninstall the update ?

    Also I saw Microsoft Web Deploy 2.0 RC on my PC. Does it relate to WebMatrix or have an affect on MVC 3. Since I cannot move @helper to a cshtml file in View/Helpers and reuse it.

    Scott

    ReplyDelete
  6. Drew,

    I found the update and uninstalled it. However, it isn't related to the helper issues.

    I found a way from web to put the cshtml file in App_Code, it works. Expect the RTM.

    Scott

    ReplyDelete
  7. Scott,

    You should only include @helper methods in Razor files inside App_Code. While you can put them in other Razor files, they aren't guaranteed to work due to how they are compiled.

    ReplyDelete
  8. It looks like the Windows Phone Developer Tools kills the Razor tools support as well.

    ReplyDelete
  9. The instructions for the "Automating the Installation" would be best if they were told to be put into notepad (and remove the leading bullet and whitespace) and mention that possibly removing NuGet might not actually clean up any of the NuGet folders and manual removing it may be required. In addition, the fact that doing the manual way (via CPL) may not work necessarily clean out something else and one of the MSIEXEC instruction entries might get removed without actually uninstalling and thus running at least the MSIEXEC command lines may be required.

    If you've think you've followed the instructions and it's not worked check the
    Help -> About Microsoft and look for NuGet or the KB's installed. Then work on removing those.

    YMMV

    ReplyDelete
  10. Richard, I've sent an email to those folks letting them know, though I suspect they're already aware.

    MDR, you are correct that removing NuGet in Programs and Features does not remove NuGet from VS; this is intentional. Having NuGet installed in VS won't cause any problems when re-installing. Am I to understand that after running the commands you still had NuGet and the KB 2385361 installed?

    ReplyDelete
  11. I've tried uninstalling all of the above and no matter what I do (restarting, etc...) the setup script always hangs and msiexec.exe*32 just sits @ 50% CPU. I've even left it running overnight. If i kill the process, it continues, then hangs again @ 50% CPU. If i keep killing the process it turns out that the installation actually 'succeeds' but then MVC3 isn't really integrated with Visual Studio. Unfortunately the same thing pretty much happens when uninstalling so I'm in a bit of a pickle. Do i really need to reinstall VS?

    ReplyDelete
  12. Shandem, please email me (drewmi at microsoft.com) and we'll see if we can determine what is going wrong. Sorry.

    ReplyDelete