Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public class UpdateAssemblyInfo : Task
public string ProjectFile { get; set; }

[Required]
public string ProjectDir { get; set; }

[Required]
public string Configuration { get; set; }
public string IntermediateOutputPath { get; set; }

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

string tempFileName, tempDir;
if (string.IsNullOrEmpty(ProjectDir) || string.IsNullOrWhiteSpace(ProjectDir))
if (IntermediateOutputPath == null)
{
tempDir = TempFileTracker.TempPath;
tempFileName = string.Format("AssemblyInfo_{0}_{1}.g.cs", Path.GetFileNameWithoutExtension(ProjectFile), Path.GetRandomFileName());
}
else
{
tempDir = Path.Combine(ProjectDir, "obj", Configuration);
tempDir = Path.Combine(IntermediateOutputPath, "obj", assemblyInfo);
Directory.CreateDirectory(tempDir);
tempFileName = string.Format("GitVersionTaskAssemblyInfo.g.cs");
}
Expand All @@ -154,4 +151,4 @@ void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
File.WriteAllText(AssemblyInfoTempFilePath, assemblyInfo);
}
}
}
}
8 changes: 3 additions & 5 deletions GitVersionTask/NugetAssets/GitVersionTask.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)..\</SolutionDir>
</PropertyGroup>
<PropertyGroup>
<IntermediateOutputPath Condition="$(IntermediateOutputPath) == '' Or $(IntermediateOutputPath) == '*Undefined*'">$(MSBuildProjectDirectory)obj\$(Configuration)\</IntermediateOutputPath>
<GitVersionAssemblyVersioningScheme Condition="$(GitVersionAssemblyVersioningScheme) == '' Or $(GitVersionAssemblyVersioningScheme) == '*Undefined*'"></GitVersionAssemblyVersioningScheme>
</PropertyGroup>

Expand All @@ -24,9 +23,8 @@
/>
<UpdateAssemblyInfo
SolutionDirectory="$(SolutionDir)"
ProjectFile="$(ProjectPath)"
ProjectDir="$(ProjectDir)"
Configuration="$(ConfigurationName)"
ProjectFile="$(MSBuildProjectFullPath)"
IntermediateOutputPath="$(IntermediateOutputPath)"
AssemblyVersioningScheme="$(GitVersionAssemblyVersioningScheme)"
CompileFiles ="@(Compile)">
<Output
Expand Down