@@ -67,6 +67,7 @@ public override bool Execute()
6767
6868 if ( PublishFlatContainer )
6969 {
70+ // Act as if %(PublishFlatContainer) were true for all items.
7071 blobArtifacts = itemsToPushNoExcludes
7172 . Select ( BuildManifestUtil . CreateBlobArtifactModel ) ;
7273 foreach ( var blobItem in itemsToPushNoExcludes )
@@ -89,8 +90,23 @@ public override bool Execute()
8990 } )
9091 . ToArray ( ) ;
9192
93+ var blobItems = itemsToPushNoExcludes
94+ . Where ( i =>
95+ {
96+ var isFlatString = i . GetMetadata ( "PublishFlatContainer" ) ;
97+ if ( ! string . IsNullOrEmpty ( isFlatString ) &&
98+ bool . TryParse ( isFlatString , out var isFlat ) )
99+ {
100+ return isFlat ;
101+ }
102+
103+ return false ;
104+ } )
105+ . Union ( symbolItems )
106+ . ToArray ( ) ;
107+
92108 ITaskItem [ ] packageItems = itemsToPushNoExcludes
93- . Where ( i => ! symbolItems . Contains ( i ) )
109+ . Except ( blobItems )
94110 . ToArray ( ) ;
95111
96112 foreach ( var packagePath in packageItems )
@@ -102,26 +118,26 @@ public override bool Execute()
102118 $ "##vso[artifact.upload containerfolder=PackageArtifacts;artifactname=PackageArtifacts]{ destFile } ") ;
103119 }
104120
105- foreach ( var symbolPath in symbolItems )
121+ foreach ( var blobItem in blobItems )
106122 {
107- var destFile = $ "{ AssetsTemporaryDirectory } /{ Path . GetFileName ( symbolPath . ItemSpec ) } ";
108- File . Copy ( symbolPath . ItemSpec , destFile ) ;
123+ var destFile = $ "{ AssetsTemporaryDirectory } /{ Path . GetFileName ( blobItem . ItemSpec ) } ";
124+ File . Copy ( blobItem . ItemSpec , destFile ) ;
109125
110126 Log . LogMessage ( MessageImportance . High ,
111127 $ "##vso[artifact.upload containerfolder=BlobArtifacts;artifactname=BlobArtifacts]{ destFile } ") ;
112128 }
113129
114130 packageArtifacts = packageItems . Select ( BuildManifestUtil . CreatePackageArtifactModel ) ;
115- blobArtifacts = symbolItems . Select ( BuildManifestUtil . CreateBlobArtifactModel ) . Where ( blob => blob != null ) ;
131+ blobArtifacts = blobItems . Select ( BuildManifestUtil . CreateBlobArtifactModel ) . Where ( blob => blob != null ) ;
116132 }
117133
118- BuildManifestUtil . CreateBuildManifest ( Log ,
119- blobArtifacts ,
134+ BuildManifestUtil . CreateBuildManifest ( Log ,
135+ blobArtifacts ,
120136 packageArtifacts ,
121- AssetManifestPath ,
122- ManifestRepoUri ,
137+ AssetManifestPath ,
138+ ManifestRepoUri ,
123139 ManifestBuildId ,
124- ManifestBranch ,
140+ ManifestBranch ,
125141 ManifestCommit ,
126142 ManifestBuildData ,
127143 IsStableBuild ) ;
0 commit comments