File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
MSBuildProjectCreator.UnitTests Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ artifacts:
1414- path : ' **\*.nupkg'
1515 name : NuGet Packages
1616on_failure :
17- - ps : Get-ChildItem .\*. log -Recursive | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
17+ - ps : Get-ChildItem .\*log -Recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
Original file line number Diff line number Diff line change @@ -131,6 +131,29 @@ public void ItemIncludeNotAddedIfNull()
131131 StringCompareShould . IgnoreLineEndings ) ;
132132 }
133133
134+ [ Fact ]
135+ public void MetadataNotAddedIfNull ( )
136+ {
137+ ProjectCreator . Create ( projectFileOptions : NewProjectFileOptions . None )
138+ . ItemInclude (
139+ itemType : "DB5003A476FA461EB0452DDDCCE7F802" ,
140+ include : "303F33834A6843EDB44DB8D3186E97E0" ,
141+ metadata : new Dictionary < string , string >
142+ {
143+ { "CDBA5A760C9C45CFB2E9532D4B4AE2B7" , "D6A68EA723C848E19D2E17C09F7F2532" } ,
144+ { "FDD9C6C5582B404188CD8C938DB2CDD9" , null }
145+ } )
146+ . Xml . ShouldBe (
147+ @"<Project>
148+ <ItemGroup>
149+ <DB5003A476FA461EB0452DDDCCE7F802 Include=""303F33834A6843EDB44DB8D3186E97E0"">
150+ <CDBA5A760C9C45CFB2E9532D4B4AE2B7>D6A68EA723C848E19D2E17C09F7F2532</CDBA5A760C9C45CFB2E9532D4B4AE2B7>
151+ </DB5003A476FA461EB0452DDDCCE7F802>
152+ </ItemGroup>
153+ </Project>" ,
154+ StringCompareShould . IgnoreLineEndings ) ;
155+ }
156+
134157 [ Fact ]
135158 public void NoneItem ( )
136159 {
Original file line number Diff line number Diff line change 55using Microsoft . Build . Construction ;
66using Microsoft . Build . Evaluation ;
77using System . Collections . Generic ;
8+ using System . Linq ;
89
910namespace Microsoft . Build . Utilities . ProjectCreation
1011{
@@ -291,7 +292,7 @@ private ProjectCreator Item(
291292
292293 if ( metadata != null )
293294 {
294- foreach ( KeyValuePair < string , string > metadatum in metadata )
295+ foreach ( KeyValuePair < string , string > metadatum in metadata . Where ( i => i . Value != null ) )
295296 {
296297 item . AddMetadata ( metadatum . Key , metadatum . Value ) ;
297298 }
You can’t perform that action at this time.
0 commit comments