I had just recently installed Service Pack 1 for Visual Studio 2010, which broke the Intellisense in the Razor ViewEngine. A quick search on Google showed that other people has had the same issue. For me it came down to uninstalling ASP.NET Web Pages (and ASP.NET MVC). For some reason that turned out to be difficult.
The Event Viewer showed the following error message.
”Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.”
Application: WebConfigCA.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
at System.Web.Configuration.VirtualDirectoryMapping..ctor(System.Web.VirtualPath, System.String, Boolean, System.String)
at System.Web.Configuration.VirtualDirectoryMapping..ctor(System.String, Boolean)
at WebConfigCA.Program.GetWebConfig(System.String)
at WebConfigCA.Program.AddAssemblyReferences(System.String, System.String[])
at WebConfigCA.Program.Main(System.String[])
A few people around the web suggested the following solution:
1. Remove the trailing backslash from the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\Path
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\4.0.30319.0\Path
2. Uninstalled the old version of “Microsoft ASP.NET Web Pages”.
3. Add the trailing backslash back to those keys.
This did not work for me.
My Solution
So I fired up ILSpy and opened up WebConfigCA.exe, just to get an idea about why it had thrown an exception. Nothing really stood out, so I created a Console Application Project in Visual Studio and pasted the code. I added the needed references and ran it (when testing, remember elevated permissions) – No exception got thrown. I thought to myself that was strange, so I toke my newly created console app and replaced it with WebConfigCA.exe (It might be a good idea to keep a backup). I ran the uninstaller again and this time it ran fine and I finally got ASP.NET Web Pages uninstalled.
By going through the code again, I see that I did add a line of code (which I did just to test it in VS but forgot to remove, not sure if that was the real trick, but don’t think so).
Anyway, here it is.
1
| args = new string[1]{"-U"}; |