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:
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?
Please sign in to leave a comment.
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.