Wednesday, April 01, 2009

Disabling an ASP.NET Web Project from building in a Solution

We ran into a problem recently where we wanted to add an ASP.NET Web Project to our Solution but to not be built during the Team Build. Why? It's a long-story, but it seems to be working well for the group. We had this setup before and working fine, but then someone broke it and we just got around to fixing it again.

Unfortunately when adding the ASP.NET Web Project this time, we were getting errors in Team Build because Team Build couldn't find the project to build Hum? In the Solution's Configuration Manger we had unselected the "Build" check mark for the ASP.NET Web Project. Yet the build continued to run.

After scratching our heads, my colleague (my much smarter colleague) noticed that the Solution File had this in it.

{95153BD9-7C07-4754-8DB2-37512B95B43C}.Release|Any CPU.Build.0 = Debug|Any CPU

My understanding of this is that when we run the build via Team Build, we say "Release|Any CPU" in the TFSBuild.proj file. It's the default. When Team Build (actually MSBuild) sees this line, it assumes that we intend to build the ASP.NET Web Project. However, we don't and what I'm still missing is why unselecting the "Build" check mark didn't remove this line.

To remove the solution setting, my colleague Right Clicked on the ASP.NET Web Project, Selected Property Pages, Selected Build and under "Before running startup page," she changed it from Build Website to No Build. The check box Build Web Site as part of Solution was already unchecked though if it was checked, we would have unchecked it as well. Now the Solution build works fine as it does not build the ASP.NET Web Project (which we intentionally don't want to build).

In summary, do get the ASP.NET Web Project to not build, we 1) unchecked the "Build" check box in the Solution's Configuration Manager, 2) Changed the ASP.NET Web Project's "Before running startup page" to No Build and 3) made sure check box Build Web Site as part of Solution was unchecked.

Some combination of these removed the line {95153BD9-7C07-4754-8DB2-37512B95B43C}.Release|Any CPU.Build.0 = Debug|Any CPU from our solution file.

No comments: