When building a web application project, TFS 2008 builds two separate projects in _PublishedFolder.

Posted by Steve Johnson on Stack Overflow See other posts from Stack Overflow or by Steve Johnson
Published on 2010-06-14T03:48:14Z Indexed on 2010/06/14 4:02 UTC
Read the original article Hit count: 276

I am trying to perform build automation on one of my web application projects built using VS 2008.

The _PublishedWebSites contains two folders: Web and Deploy.

I want TFS 2008 to generate only the deploy folder and not the web folder.

Here is my TFSBuild.proj file:

<Project ToolsVersion="3.5" DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets" />
  <ItemGroup>
    <SolutionToBuild Include="$(BuildProjectFolderPath)/../../Development/Main/MySoftware.sln">
      <Targets></Targets>
      <Properties></Properties>
    </SolutionToBuild>
  </ItemGroup>
  <ItemGroup>
    <ConfigurationToBuild Include="Release|AnyCPU">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>Any CPU</PlatformToBuild>
    </ConfigurationToBuild>

  </ItemGroup>
  <!--<ItemGroup>
    <SolutionToBuild Include="$(BuildProjectFolderPath)/../../Development/Main/MySoftware.sln">
      <Targets></Targets>
      <Properties></Properties>
    </SolutionToBuild>
  </ItemGroup>
  <ItemGroup>
    <ConfigurationToBuild Include="Release|x64">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>x64</PlatformToBuild>
    </ConfigurationToBuild>
  </ItemGroup>-->

  <ItemGroup>
    <AdditionalReferencePath Include="C:\3PR" />
  </ItemGroup>



  <Target
  Name="GetCopyToOutputDirectoryItems"
  Outputs="@(AllItemsFullPathWithTargetPath)"
  DependsOnTargets="AssignTargetPaths;_SplitProjectReferencesByFileExistence">

    <!-- Get items from child projects first. -->
    <MSBuild
    Projects="@(_MSBuildProjectReferenceExistent)"
    Targets="GetCopyToOutputDirectoryItems"
    Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
    Condition="'@(_MSBuildProjectReferenceExistent)'!=''">

      <Output TaskParameter="TargetOutputs" ItemName="_AllChildProjectItemsWithTargetPathNotFiltered"/>

    </MSBuild>

    <!-- Remove duplicates. -->
    <RemoveDuplicates Inputs="@(_AllChildProjectItemsWithTargetPathNotFiltered)">
      <Output TaskParameter="Filtered" ItemName="_AllChildProjectItemsWithTargetPath"/>
    </RemoveDuplicates>

    <!-- Target outputs must be full paths because they will be consumed by a different project. -->
    <CreateItem
    Include="@(_AllChildProjectItemsWithTargetPath->'%(FullPath)')"
    Exclude=
    "$(BuildProjectFolderPath)/../../Development/Main/Web/Bin*.pdb;
     *.refresh;
     *.vshost.exe;
     *.manifest;
     *.compiled;
     $(BuildProjectFolderPath)/../../Development/Main/Web/Auth/MySoftware.dll;
     $(BuildProjectFolderPath)/../../Development/Main/Web/BinApp_Web_*.dll;"
    Condition="'%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='Always' or '%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"
>
      <Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
      <Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectoryAlways"
      Condition="'%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
      <Output TaskParameter="Include" ItemName="_SourceItemsToCopyToOutputDirectory"
      Condition="'%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
    </CreateItem>
  </Target>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.WebDeployment.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="BeforeMerge">
  </Target>
  <Target Name="AfterMerge">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

I want to build everything that the builtin Deploy project is doing for me. But I don't want the generated web project as it contains App_Web_xxxx.dll assemblies instead of a single compiled assembly. How can I do this?

© Stack Overflow or respective owner

Related posts about web-applications

Related posts about build-automation