Skip to content

Commit 992d146

Browse files
authored
Fixes #1796 by using a constant file name
When creating a file inside `intermediateOutputPath` the file name must be constant. When creating a file inside `TempPath` the file name must or should be random.
1 parent cfdc119 commit 992d146

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/GitVersionTask/FileHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ public static FileWriteInfo GetFileWriteInfo(this string intermediateOutputPath,
156156

157157
if (intermediateOutputPath == null)
158158
{
159-
fileName = $"{outputFileName}.g.{fileExtension}";
159+
fileName = $"{outputFileName}_{Path.GetFileNameWithoutExtension(projectFile)}_{Path.GetRandomFileName()}.g.{fileExtension}";
160160
workingDirectory = TempPath;
161161
}
162162
else
163163
{
164-
fileName = $"{outputFileName}_{Path.GetFileNameWithoutExtension(projectFile)}_{Path.GetRandomFileName()}.g.{fileExtension}";
164+
fileName = $"{outputFileName}.g.{fileExtension}";
165165
workingDirectory = intermediateOutputPath;
166166
}
167167
return new FileWriteInfo(workingDirectory, fileName, fileExtension);

0 commit comments

Comments
 (0)