@@ -24,6 +24,13 @@ public class UpdateAssemblyInfo : Task
2424
2525 [ Required ]
2626 public string ProjectFile { get ; set ; }
27+
28+ [ Required ]
29+ public string ProjectDir { get ; set ; }
30+
31+ [ Required ]
32+ public string Configuration { get ; set ; }
33+
2734 [ Required ]
2835 public ITaskItem [ ] CompileFiles { get ; set ; }
2936
@@ -127,8 +134,20 @@ void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
127134 } ;
128135 var assemblyInfo = assemblyInfoBuilder . GetAssemblyInfoText ( configuration ) ;
129136
130- var tempFileName = string . Format ( "AssemblyInfo_{0}_{1}.g.cs" , Path . GetFileNameWithoutExtension ( ProjectFile ) , Path . GetRandomFileName ( ) ) ;
131- AssemblyInfoTempFilePath = Path . Combine ( TempFileTracker . TempPath , tempFileName ) ;
137+ string tempFileName , tempDir ;
138+ if ( string . IsNullOrEmpty ( ProjectDir ) || string . IsNullOrWhiteSpace ( ProjectDir ) )
139+ {
140+ tempDir = TempFileTracker . TempPath ;
141+ tempFileName = string . Format ( "AssemblyInfo_{0}_{1}.g.cs" , Path . GetFileNameWithoutExtension ( ProjectFile ) , Path . GetRandomFileName ( ) ) ;
142+ }
143+ else
144+ {
145+ tempDir = Path . Combine ( ProjectDir , "obj" , Configuration ) ;
146+ Directory . CreateDirectory ( tempDir ) ;
147+ tempFileName = string . Format ( "GitVersionTaskAssemblyInfo.g.cs" ) ;
148+ }
149+
150+ AssemblyInfoTempFilePath = Path . Combine ( tempDir , tempFileName ) ;
132151 File . WriteAllText ( AssemblyInfoTempFilePath , assemblyInfo ) ;
133152 }
134153 }
0 commit comments