@@ -170,6 +170,7 @@ public IEnumerable<string> BuildMetadataWithCommitId
170170 /// <summary>
171171 /// Gets the version options used to initialize this instance.
172172 /// </summary>
173+ [ Ignore ]
173174 public VersionOptions ? VersionOptions { get ; }
174175
175176 /// <summary>
@@ -296,17 +297,27 @@ public IDictionary<string, string> CloudBuildAllVars
296297 {
297298 var variables = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
298299
299- PropertyInfo [ ] ? properties = this . GetType ( ) . GetTypeInfo ( ) . GetProperties ( BindingFlags . Public | BindingFlags . DeclaredOnly | BindingFlags . Instance ) ;
300- foreach ( PropertyInfo ? property in properties )
300+ PropertyInfo [ ] properties = this . GetType ( ) . GetTypeInfo ( ) . GetProperties ( BindingFlags . Public | BindingFlags . DeclaredOnly | BindingFlags . Instance ) ;
301+ foreach ( PropertyInfo property in properties )
301302 {
302- if ( property . GetCustomAttribute < IgnoreAttribute > ( ) is null )
303+ if ( property . GetCustomAttribute < IgnoreAttribute > ( ) is not null )
304+ {
305+ continue ;
306+ }
307+
308+ object ? propertyValue = property . GetValue ( this ) ;
309+ if ( propertyValue is null )
303310 {
304- object ? value = property . GetValue ( this ) ;
305- if ( value is object )
306- {
307- variables . Add ( $ "NBGV_{ property . Name } ", value . ToString ( ) ?? string . Empty ) ;
308- }
311+ continue ;
309312 }
313+
314+ string value = propertyValue switch
315+ {
316+ DateTimeOffset dateTimeOffset => dateTimeOffset . ToString ( "o" , CultureInfo . InvariantCulture ) ,
317+ _ => Convert . ToString ( propertyValue , CultureInfo . InvariantCulture ) ?? string . Empty ,
318+ } ;
319+
320+ variables . Add ( $ "NBGV_{ property . Name } ", value ) ;
310321 }
311322
312323 return variables ;
0 commit comments