MSBUild: Copy files with a name based on the original (following a pattern)

前端 未结 4 1969
温柔的废话
温柔的废话 2021-02-12 23:39

I have a set of files inside a folder. They all have a name which matches the pattern DR__.*. I want to copy them to another folder, but removing the DR__ prefix. How can I do t

4条回答
  •  迷失自我
    2021-02-13 00:34

    Recently I had to solve similar task and I did it using Item's metadata. Advantages of this solution are:

    1. Small build script size.
    2. Using standard System.String functions to get modified name.
    3. Custom metadata is copying with definition of new items, that based on existing items (e.g. Items will get original item's metadata values so you can use it for further processing)

      
        .
        Output
      
    
      
        
      
    
      
        
          
          
          
            
            %(Identity)
            %(RecursiveDir)
          
        
    
        
        
      
    
    
    

提交回复
热议问题