File tree 3 files changed +19
-5
lines changed
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,11 @@ private ITaskItem TaskItemFor(ReleaseAsset asset)
101
101
{
102
102
var item = new TaskItem ( ) ;
103
103
item . ItemSpec = asset . Url ;
104
- item . SetMetadata ( "ContentType" , asset . ContentType ) ;
105
- item . SetMetadata ( "Id" , asset . Id . ToString ( ) ) ;
106
- item . SetMetadata ( "Label" , asset . Label ) ;
107
- item . SetMetadata ( "Name" , asset . Name ) ;
108
- item . SetMetadata ( "State" , asset . State ) ;
104
+ item . MaybeSetMetadata ( "ContentType" , asset . ContentType ) ;
105
+ item . MaybeSetMetadata ( "Id" , asset . Id . ToString ( ) ) ;
106
+ item . MaybeSetMetadata ( "Label" , asset . Label ) ;
107
+ item . MaybeSetMetadata ( "Name" , asset . Name ) ;
108
+ item . MaybeSetMetadata ( "State" , asset . State ) ;
109
109
return item ;
110
110
}
111
111
}
Original file line number Diff line number Diff line change
1
+ using Microsoft . Build . Utilities ;
2
+
3
+ namespace GitTfsTasks
4
+ {
5
+ static class Ext
6
+ {
7
+ public static void MaybeSetMetadata ( this TaskItem item , string name , string value )
8
+ {
9
+ if ( value != null )
10
+ item . SetMetadata ( name , value ) ;
11
+ }
12
+ }
13
+ }
Original file line number Diff line number Diff line change 43
43
</ItemGroup >
44
44
<ItemGroup >
45
45
<Compile Include =" CreateRelease.cs" />
46
+ <Compile Include =" Ext.cs" />
46
47
<Compile Include =" Properties\AssemblyInfo.cs" />
47
48
<Compile Include =" Properties\Version.cs" />
48
49
</ItemGroup >
You can’t perform that action at this time.
0 commit comments