1
+ using GitVersion . Logging ;
2
+ using GitVersion . OutputVariables ;
1
3
using System ;
2
4
using System . Collections . Generic ;
3
5
using System . IO ;
4
6
using System . Linq ;
5
7
using System . Xml . Linq ;
6
- using GitVersion . Logging ;
7
- using GitVersion . OutputVariables ;
8
8
9
9
namespace GitVersion . VersionConverters . AssemblyInfo
10
10
{
@@ -17,6 +17,7 @@ public class ProjectFileUpdater : IProjectFileUpdater
17
17
internal const string AssemblyVersionElement = "AssemblyVersion" ;
18
18
internal const string FileVersionElement = "FileVersion" ;
19
19
internal const string InformationalVersionElement = "InformationalVersion" ;
20
+ internal const string VersionElement = "Version" ;
20
21
21
22
private readonly List < Action > restoreBackupTasks = new List < Action > ( ) ;
22
23
private readonly List < Action > cleanupBackupTasks = new List < Action > ( ) ;
@@ -40,6 +41,7 @@ public void Execute(VersionVariables variables, AssemblyInfoContext context)
40
41
var assemblyVersion = variables . AssemblySemVer ;
41
42
var assemblyInfoVersion = variables . InformationalVersion ;
42
43
var assemblyFileVersion = variables . AssemblySemFileVer ;
44
+ var packageVersion = variables . NuGetVersionV2 ;
43
45
44
46
foreach ( var projectFile in projectFilesToUpdate )
45
47
{
@@ -54,6 +56,8 @@ public void Execute(VersionVariables variables, AssemblyInfoContext context)
54
56
continue ;
55
57
}
56
58
59
+ log . Debug ( $ "Update file: { localProjectFile } ") ;
60
+
57
61
var backupProjectFile = localProjectFile + ".bak" ;
58
62
fileSystem . Copy ( localProjectFile , backupProjectFile , true ) ;
59
63
@@ -84,6 +88,11 @@ public void Execute(VersionVariables variables, AssemblyInfoContext context)
84
88
UpdateProjectVersionElement ( fileXml , InformationalVersionElement , assemblyInfoVersion ) ;
85
89
}
86
90
91
+ if ( ! string . IsNullOrWhiteSpace ( packageVersion ) )
92
+ {
93
+ UpdateProjectVersionElement ( fileXml , VersionElement , packageVersion ) ;
94
+ }
95
+
87
96
var outputXmlString = fileXml . ToString ( ) ;
88
97
if ( originalFileContents != outputXmlString )
89
98
{
0 commit comments