· nant macrodef ant

Macros in nant

One of my favourite features of ant is the ability to create macros where you can define common behaviour and then call it from the rest of your build script.

Unfortunately that task doesn’t come with nant and it’s not available on nant-contrib either.

We were using a very roundabout way to build the various projects in our solution.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
~
  
  
    
      
        
                        
      
    
    
      
      
                
      
        
        
                                      
                    
          
~

Horrendous! Luckily I happened to be emailing back and forth with Bernardo about Stormwind at the time and he mentioned that there was in fact a task.

I added the Macros dll to the build file and voila:

1
2
3
4
~~~

  
  
~~~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
~~~

  
          
  

  
    
                
    
      
      
            
  
~~~

Further instructions on using the macrodef task are here.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket