因為兩周前的那個問題,但可以開啟之前的一個項目沒有含有razor,可以順利開啟。但現在有一個asp.net mvc3的razor網站還是無法附加元件目。原因是無法安裝 Microsoft ASP.NET MVC 4 - Visual Studio 2010 Tools ,無論是使用網站下載的安裝包還是用Web Installer,查看日誌
OS Version = 6.1.7601, Platform 2, Service Pack 1
OS Description = Windows 7 - x64 Ultimate Edition Service Pack 1
CommandLine = "C:\TDDOWNLOAD\AspNetMVC3ToolsUpdateSetup\setup.exe"
Using Simultaneous Download and Install mechanism
Operation: Installing
Package Name = Microsoft ASP.NET MVC 3 Tools Update
Package Version = 3.0.20406.0
User Experience Data Collection Policy: Disabled
Number of applicable items: 2
MSI (C:\TDDOWNLOAD\AspNetMVC3ToolsUpdateSetup\AspNetMVC3VS2010Tools.msi) Installation succeeded. Msi Log: Microsoft ASP.NET MVC 3 Tools Update_20120226_211129089-MSI_AspNetMVC3VS2010Tools.msi.txt
MSI (C:\TDDOWNLOAD\AspNetMVC3ToolsUpdateSetup\NuGet.msi) Installation failed. Msi Log:Microsoft ASP.NET MVC 3 Tools Update_20120226_211129089-MSI_NuGet.msi.txt
MSI (C:\TDDOWNLOAD\AspNetMVC3ToolsUpdateSetup\AspNetMVC3VS2010Tools.msi) Uninstall succeeded. Msi Log: Microsoft ASP.NET MVC 3 Tools Update_20120226_211129089-MSI_AspNetMVC3VS2010Tools.msi.txt
Final Result: Installation failed with error code: (0x80070643), "安裝時發生嚴重錯誤 " (Elapsed time: 0 00:08:06).
======================
因此,一箇舊版的NuGet無法安裝,使得我的ASP.NET MVC3 Tools給一起復原掉了。為什麼NuGet無法安裝呢,因為之前已經安裝了最新版的 NuGet 1.6 了,1.5至1.6的升級有很大更新,以至於自身的線上更新都不成功,需要先卸載1.5才能裝1.6。
像我這種情況有兩種辦法可以解決,一是先卸載NuGet1.6的外掛程式再安裝,另一個是解壓縮 ASP.NET MVC3 Tools 安裝包,單獨執行裡面的vs10-kb2483190-x86升級檔案以及aspnetmvc3vs2010tools.msi。我用的是後者。
至此新項目中同時出現了MVC2,MVC3,MVC4的項目模板。 問題解決。
網站也有其他的解決方案,不過可能跟我的情況不同,僅供參考:
win2003+vs2010下安裝asp.net MVC3正式版失敗經曆Asp.NET MVC 3 project templates not showing up
希望本文可以對你有所協助!