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">
      <Symbols Include="bin\Release\*.symbols.nupkg" />
      <Nupkg Include="bin\Release\*.nupkg"
             Exclude="bin\Release\*.symbols.nupkg" />
    <Message Text="Symbols: @(Symbols)" />
    <Message Text="Nupkg: @(Nupkg)" />
    <Copy Condition="'$(TEAMCITY_VERSION)' != ''"
          SkipUnchangedFiles="true" />
    <Exec Condition="'$(TEAMCITY_VERSION)' != ''"
          Command="nuget push @(Symbols) 123 -Source $(NugetSymbolRepos)" />

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

  Symbols: bin\Release\MyCompany.Configuration.
  Nupkg: bin\Release\MyCompany.Configuration.

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.
[10:36:16]Symbols: bin\Release\MyCompany.Configuration.
[10:36:16]Task Parameter:Text=Nupkg: bin\Release\MyCompany.Configuration.;bin\Release\MyCompany.Configuration.;bin\Release\MyCompany.Configuration.
[10:36:16]Nupkg: bin\Release\MyCompany.Configuration.;bin\Release\MyCompany.Configuration.;bin\Release\MyCompany.Configuration.

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.


Please sign in to leave a comment.