Visual-studio – MSBuild inconsistent compiler flags

msbuildvisual-studio-2008

I have two VS2008 solutions. Both contain a web application. For both web apps I have added a web deployment project.

When I build the first one this is the command line I see in the output window.

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe
-v /project.csproj -p C:\Projects\web\project\project -u -f
-d .\TempBuildDir\ Running aspnet_merge.exe.

For the second one I get this:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe
-v /project2.csproj -p C:\Projects\web\project2\project2 -u
-f -c -d .\TempBuildDir\

As you can see, the second project has a -c flag.

I have diffed both the .wdproj and .csproj files and apart from the project names, their GUIDs and the contents of the project, they are the same.

The properties pages for all the projects are identical.

The second project fails to build wityh a bunch of errors like

c:\Projects\webProject2\Project2\Resources\PageTemplates\Contentpage_01.aspx(9):
error CS0433: The type
'Project2.type.typename' exists in
both
'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET
Files\Project2.csproj\e7848b01\7f837eea\assembly\dl3\149ee0e9\ae024883_edfec901\Project2.DLL'
and
'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET
Files\Project2.csproj\e7848b01\7f837eea\App_Web_gt8abhzw.dll'

Any ideas on a fix?

Thanks

Best Answer

I found a solution to my problem, although it doesn't address where the extra compile flag is comming from.

Have a read of http://www.velocityreviews.com/forums/t381072-error-cs0433.html .

it turns out that web deployment projects don't like the use of CodeFile in the <%@ Page directive, changing this to CodeBehind solvesa the CS0433 compile errors.