@@ -24,6 +24,13 @@ public class UpdateAssemblyInfo : Task
24
24
25
25
[ Required ]
26
26
public string ProjectFile { get ; set ; }
27
+
28
+ [ Required ]
29
+ public string ProjectDir { get ; set ; }
30
+
31
+ [ Required ]
32
+ public string Configuration { get ; set ; }
33
+
27
34
[ Required ]
28
35
public ITaskItem [ ] CompileFiles { get ; set ; }
29
36
@@ -127,8 +134,20 @@ void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
127
134
} ;
128
135
var assemblyInfo = assemblyInfoBuilder . GetAssemblyInfoText ( configuration ) ;
129
136
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 ) ;
132
151
File . WriteAllText ( AssemblyInfoTempFilePath , assemblyInfo ) ;
133
152
}
134
153
}
0 commit comments