3

I've got the following xml file:

<?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="DeployPrototype" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <dotCover>..\..\..\plugins\dotCover\bin\dotCover.exe</dotCover>
      </PropertyGroup>
      <ItemGroup>
        <SourceFiles Include="..\Prototype\Site\Site\Bin\TestServer\Default.html;..\Prototype\Site\Site\Bin\TestServer\Site.xap"/>
        <DestinationFolder Include="C:\inetpub\wwwroot\ProjectName\Prototype"/>
      </ItemGroup>

      <Target Name="Build">
          <MSBuild Projects="../ProjectName.Web.sln" Properties="Configuration=testserver" />
          <Message Text="Building ProjectName solution" Importance="high" />
      </Target>

      <Target Name="TeamCity" DependsOnTargets="Build">
        <Message Text="Before executing MSpec command" Importance="low" />
        <Exec Command="..\packages\Machine.Specifications.0.4.10.0\tools\mspec-clr4.exe ..\Hosts\ProjectName.Hosts.Web.Specs\bin\ProjectName.Hosts.Web.Specs.dll --teamcity" />
        <Message Text="Ran MSpec" Importance="low" />
        <Exec Command="$(dotCover) c TestServerBuildAndRunTestsOnly_DotCover.xml" />
        <Message Text="##teamcity[importData type='dotNetCoverage' tool='dotcover' path='build\coverage.xml']" Importance="high" />
      </Target>

      <Target Name="DeployPrototype" DependsOnTargets="TeamCity">
        <Message Text="Before executing copy, source files are: @(MySourceFiles) and destination folder is: @(DestinationFolder)" Importance="low" />
            <Copy
              SourceFiles="@(MySourceFiles)"
              DestinationFolder="@(DestinationFolder)"
      />
        <Message Text="Atter executing copy" Importance="low" />
      </Target>
    </Project>

Everything in this script works apart from the copying of the files. The messages I've put put in the copying section don't appear in the full log in TeamCity. In the configuration settings of the latter, I've put "DeployPrototype" as my target.

Why is the copying operation not happening?

DavidS
  • 2,179
  • 4
  • 26
  • 44
  • 2
    Add /v:d or /v:diag to thew MSBuild args and the output will tell you – Ruben Bartelink May 04 '11 at 13:20
  • 1
    MySourceFiles vs SourceFiles is prob the issue tho7ugh – Ruben Bartelink May 04 '11 at 13:20
  • @Ruben - My stupidity knows no bounds it seems! I hesitate to say good spot. – DavidS May 04 '11 at 14:32
  • @DavidS: Bottom line is that the key to all these issues is jamming in a /v:d or /v:diag for all MSBuild issues, be it under TeamCity (or anywhere) – Ruben Bartelink May 04 '11 at 21:56
  • @Ruben - Thank you. I'm trying to see if the script is working now and I've added the parameters. However, one of the other developers has made some changes which means that I can't even build the solution and hence I don't even get to the point of copying. I'll update accordingly – DavidS May 05 '11 at 06:26
  • @Ruben - You were right. The MySourceFiles vs Sourcefiles was the problem. Maybe you'd like to put the answer on here so that you can get the credit :). I would have erased it but there's the good advice about /v:d or /v:diag – DavidS May 05 '11 at 06:54

1 Answers1

6

For a given problem involving MSBuild not working under TeamCity, the answer almost always involves adding /v:d (Every step carried out and information about skipped steps) or /v:diag (Detailed plus dumps of ItemGroups etc. for diagnostic purposes) to the MSBuild args and the TeamCity-managed build output will have the answer.

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249