I dealt with a very annoying issue today involving an ASP.NET 3.5 Web Application being compiled to a single assembly through a Web Deployment Project in Visual Studio 2008. The Web.config file contains a number of mappings to ensure that the correct 3.5 Controls and dependent assemblies are loaded by ASP.NET as runtime.
It seems as though some controls, including the ListView, require that the Web.config file must be present as part of the Web Deployment Project output files. If not present, you will receive the following error when building the Web Deployment Project:
- Unknown server tag ‘asp:ListView’
To replicate:
- Create new Web Application project
- Edit Default.aspx by adding ListView control
- Create Web Deployment Project for Web Application
- Edit Web Deployment Project file and add the following line to the <ItemGroup>:
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\*.config" />
- Build the Web Deployment Project
- Observe build failure as described above
I’m not sure if this is a bug with the Web Deployment Projects, but it is certainly rather annoying as this was the last place I though of looking for the resolution.