CustomizableOutDir in TFS 2010 with ASP.Net Projects

 

Jim Lamb has blogged about how to CustomizableOutDir using Team Build 2010 as you might want have the assemblies dropped in a custom Folder structure instead of having all assemblies in one Drop Folder, which is the default behavior.

When applying this workaround to a Solution containing an ASP.Net Project you might be missing the _PublishedWebsites folder in the Drop Folder structure:

image

Assuming you have configured the Team Build Workflow as Jim suggested:

image

You can workaround the problem by using a different definition for OutputPath and OutDir in the Webapplication.csproj File:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutDir Condition=" '$(TeamBuildOUtDir)'!=''">$(TeamBuildOutDir)\$(SolutionName)\$(MSBuildProjectName)\</OutDir>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
</PropertyGroup>

The reason why it’s failing is because the _CopyWebApplication Target will be skipped. To figure out if this is the case you can check your MSbuild log  fole the following line: 

Target "_CopyWebApplication" skipped, due to false condition; (!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'

That’s it. The Issue has been already reported via Connect.