Skip to content

Commit 74a36ee

Browse files
committed
Merge pull request #333 from bdhess/master
Use defined project intermediate directory if it exists
2 parents 76116f4 + 2bda50f commit 74a36ee

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ public class UpdateAssemblyInfo : Task
2727
public string ProjectFile { get; set; }
2828

2929
[Required]
30-
public string ProjectDir { get; set; }
31-
32-
[Required]
33-
public string Configuration { get; set; }
30+
public string IntermediateOutputPath { get; set; }
3431

3532
[Required]
3633
public ITaskItem[] CompileFiles { get; set; }
@@ -138,14 +135,14 @@ void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
138135
var assemblyInfo = assemblyInfoBuilder.GetAssemblyInfoText(configuration);
139136

140137
string tempFileName, tempDir;
141-
if (string.IsNullOrEmpty(ProjectDir) || string.IsNullOrWhiteSpace(ProjectDir))
138+
if (IntermediateOutputPath == null)
142139
{
143140
tempDir = TempFileTracker.TempPath;
144141
tempFileName = string.Format("AssemblyInfo_{0}_{1}.g.cs", Path.GetFileNameWithoutExtension(ProjectFile), Path.GetRandomFileName());
145142
}
146143
else
147144
{
148-
tempDir = Path.Combine(ProjectDir, "obj", Configuration);
145+
tempDir = Path.Combine(IntermediateOutputPath, "obj", assemblyInfo);
149146
Directory.CreateDirectory(tempDir);
150147
tempFileName = string.Format("GitVersionTaskAssemblyInfo.g.cs");
151148
}
@@ -154,4 +151,4 @@ void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
154151
File.WriteAllText(AssemblyInfoTempFilePath, assemblyInfo);
155152
}
156153
}
157-
}
154+
}

GitVersionTask/NugetAssets/GitVersionTask.targets

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)..\</SolutionDir>
5-
</PropertyGroup>
6-
<PropertyGroup>
5+
<IntermediateOutputPath Condition="$(IntermediateOutputPath) == '' Or $(IntermediateOutputPath) == '*Undefined*'">$(MSBuildProjectDirectory)obj\$(Configuration)\</IntermediateOutputPath>
76
<GitVersionAssemblyVersioningScheme Condition="$(GitVersionAssemblyVersioningScheme) == '' Or $(GitVersionAssemblyVersioningScheme) == '*Undefined*'"></GitVersionAssemblyVersioningScheme>
87
</PropertyGroup>
98

@@ -24,9 +23,8 @@
2423
/>
2524
<UpdateAssemblyInfo
2625
SolutionDirectory="$(SolutionDir)"
27-
ProjectFile="$(ProjectPath)"
28-
ProjectDir="$(ProjectDir)"
29-
Configuration="$(ConfigurationName)"
26+
ProjectFile="$(MSBuildProjectFullPath)"
27+
IntermediateOutputPath="$(IntermediateOutputPath)"
3028
AssemblyVersioningScheme="$(GitVersionAssemblyVersioningScheme)"
3129
CompileFiles ="@(Compile)">
3230
<Output

0 commit comments

Comments
 (0)