Tuesday, May 29, 2007

ASP.NET Web Application Project problems

This past weekend I was working with a continuous integration build with an ASP.NET project. I was attempting to get a website staged on a staging environment by using msbuild. I build the site and published it to another directory that had IIS pointed to it. Due to some reference issues (particularly, with the default web project template that I was using, I could not get my referenced assemblies to be available for msbuild to build the project), I switched to the Web Application Project template, that basically took the VS.NET 2003 project template, and copied all my files from the old project to the new one.

Everything debugged and ran just fine, but when I published the site and hosted it via IIS, I was being plagued with an error somewhat like this one:

The type 'objectname' exists in both
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\\assemblyName.DLL'
and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\\assemblyName.DLL'


I couldn't figure out why I had this issue. I could run the site just fine from VS.NET 2005, but could not actually publish it without getting that error. Searching online only yielded deleting my temporary asp.net files, bouncing IIS or even bouncing the machine. None of the issues resolved the problem.

I finally found the resolution, and it I wish I could find the post that had the resolution so I could give due credit to them, but basically the Web Project (default out of VS.NET) uses the CodeFile attribute to find the code behind file. Changing CodeFile to CodeBehind on all my aspx pages resolved the issue.

Hope this helps someone!

1 comment:

Anonymous said...

Good for people to know.