Visual Studio 2010 web publishing issue with the .browser files

Posted on Feb 25, 2014 in  | No comments

We moved a VS 2008 web site project to VS 2010, and when we did a publish using the “Publish Web Site”, somehow all the customised Adapter classes that we implemented within the .browser files didn’t get executed.

After a very thorough investigation, especially after we looked into the App_Browsers.dll assembly through a reflection tool, we found out that the publishing process altered the controltype attribute in the .browser files from this:

System.Web.UI.WebControls.Menu, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

to this:

System.Web.UI.WebControls.Menu, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

It seems that App_Browser.dll file generator of VS 2010 is making a bad assumption even though the target framework is set to .Net 3.5. Because the web application is set to run on 2.0 framework, those control type is not matched.

Fortunately, we’ve figured a work around which is by deleting the App_Browser.dll and the related .compiled file out of the bin directory after publishing, and copy the uncompiled .browser files back into the App_Browsers directory.