MSBuild Item with Exclude parameter seems to cause problems

This is a weird one. I have a project file that has a target something like this:

  <Target Name="Deploy">
    <ItemGroup>
      <Symbols Include="bin\Release\*.symbols.nupkg" />
      <Nupkg Include="bin\Release\*.nupkg"
             Exclude="bin\Release\*.symbols.nupkg" />
    </ItemGroup>
    <Message Text="Symbols: @(Symbols)" />
    <Message Text="Nupkg: @(Nupkg)" />
    <Copy Condition="'$(TEAMCITY_VERSION)' != ''"
          SourceFiles="@(Nupkg)"
          DestinationFolder="$(NugetRepos)"
          SkipUnchangedFiles="true" />
    <Exec Condition="'$(TEAMCITY_VERSION)' != ''"
          Command="nuget push @(Symbols) 123 -Source $(NugetSymbolRepos)" />
  </Target>

When I run this locally I get the correct files to copy/push respectively:

Deploy:
  Symbols: bin\Release\MyCompany.Configuration.0.1.0.0.symbols.nupkg
  Nupkg: bin\Release\MyCompany.Configuration.0.1.0.0.nupkg

But when TeamCity runs this target I get this:

[10:36:16]Deploy (2s)
[10:36:16]Task Parameter:Text=Symbols: bin\Release\MyCompany.Configuration.0.1.0.0.symbols.nupkg
[10:36:16]Symbols: bin\Release\MyCompany.Configuration.0.1.0.0.symbols.nupkg
[10:36:16]Task Parameter:Text=Nupkg: bin\Release\MyCompany.Configuration.0.1.0.0.nupkg;bin\Release\MyCompany.Configuration.0.1.0.0.symbols.nupkg;bin\Release\MyCompany.Configuration.0.1.0.0.nupkg
[10:36:16]Nupkg: bin\Release\MyCompany.Configuration.0.1.0.0.nupkg;bin\Release\MyCompany.Configuration.0.1.0.0.symbols.nupkg;bin\Release\MyCompany.Configuration.0.1.0.0.nupkg



So I get both the standard package and the symbol package copied to the repository. The Nupkg file list also includes the same file twice.



Any idea what could be going on here?
1 comment
Comment actions Permalink

I think I see the problem. I'm guessing that TeamCity also defines an ItemGroup called "Nupkg" somehow/somewhere, and my target is just appending to it. When I change the name of my item to "BinaryNupkg", I got the behaviour I expect.

0

Please sign in to leave a comment.