Just Installing VS2012 Can Break VS2010 Websites

Last week, I installed Visual Studio 2012, to play around with new features. We’re probably not ready to move our production code to VS2012 yet, but I just wanted to see what’s new. I should probably have installed it in a virtual machine, but hey, this is a well tested, production ready Microsoft product … what could possibly go wrong?

Well, nothing went wrong. Until today.

I opened a Visual Studio 2010 solution which has never even been opened in VS2012 and it won’t build.

The offending piece of code is when we have a website project (web application projects are unaffected), which contains a table element with runat="server", and the table contains a tbody element. See the following code for an example.


    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>Test</title></head>
    <body>
        <form id="form1">
            <div>
                <table id="tbl1">
                    <tbody><tr><td>Boo!</td></tr></tbody>
                </table>
            </div>
        </form>
    </body>
    </html>

A machine without VS2012 installed will build and run this without any complaints. A machine with VS2012 installed will produce the following error message while building:

Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'.

This is a pretty major breaking change, and it’s left me in a situation where I can’t build one of our core products. I can’t believe that this wasn’t picked up given Microsoft’s focus on quality and the range of automated testing which is carried out. Moreover, I just can’t understand how installing VS2012 should break a VS2010 solution.

Further, I discovered that running MSBuild from the Visual Studio 2010 Command Prompt succeeds on the solution file for the website, but then attempting to run the resulting compiled website with IISExpress yields a 500 Internal Server Error.

What’s going on Microsoft?!

Recent Related Posts

4 thoughts on “Just Installing VS2012 Can Break VS2010 Websites

  1. Agreed, neither VS2012, or VS2010 are working properly after the install, VS2010 SP1 fixed nothing that I’ve seen. (SP1 was pain to install, it kept crapping out, and rolling back.. Took two days of hunting solutions to get it to take.. Waste of time.)

    Well, I’m off to uninstall 2012, 2010, and everything related, hopefully a ground up reinstall will make something work again….

  2. Yes, I’ve noticed the same problem as well. However, I didn’t even install VS2012. I just migrated to Windows 8 and installed VS2010 and was able to reproduce this issue. The machine I am working on had never had VS2012 installed on it.

    FYI, this was filed as a bug under MS Connect:
    https://connect.microsoft.com/VisualStudio/feedback/details/774181/table-tag-with-runat-server-causes-build-exception-value-of-type-system-web-ui-htmlcontrols-htmlgenericcontrol-cannot-be-converted-to-system-web-ui-htmlcontrols-htmltablerow

  3. Richard got solution for this fix? am facing the same issue. piece of code is not working after installing VS2012. which is working fine in VS2010.

    Unable to cast object of type ‘System.Web.UI.LiteralControl’ to type ‘System.Web.UI.WebControls.HiddenField’.

    Bala

Leave a Reply to Zaki Saadeh Cancel reply

Your email address will not be published. Required fields are marked *