Skip to content

Commit b1f858f

Browse files
committed
Merge pull request #565 from zanyants/feature-custom-thisassembly-fields
2 parents 3f4ce5c + aaf7fe6 commit b1f858f

File tree

3 files changed

+269
-130
lines changed

3 files changed

+269
-130
lines changed

src/NerdBank.GitVersioning.Tests/AssemblyInfoTest.cs

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using Microsoft.Build.Utilities;
67
using Nerdbank.GitVersioning.Tasks;
78
using Xunit;
89

@@ -18,6 +19,25 @@ public void FSharpGenerator(bool? thisAssemblyClass)
1819
info.AssemblyCompany = "company";
1920
info.AssemblyFileVersion = "1.3.1.0";
2021
info.AssemblyVersion = "1.3.0.0";
22+
info.AdditionalThisAssemblyFields =
23+
new TaskItem[]
24+
{
25+
new TaskItem(
26+
"CustomString1",
27+
new Dictionary<string,string>() { { "String", "abc" } } ),
28+
new TaskItem(
29+
"CustomString2",
30+
new Dictionary<string,string>() { { "String", "" } } ),
31+
new TaskItem(
32+
"CustomString3",
33+
new Dictionary<string,string>() { { "String", "" }, { "EmitIfEmpty", "true" } } ),
34+
new TaskItem(
35+
"CustomBool",
36+
new Dictionary<string,string>() { { "Boolean", "true" } } ),
37+
new TaskItem(
38+
"CustomTicks",
39+
new Dictionary<string,string>() { { "Ticks", "637509805729817056" } } ),
40+
};
2141
info.CodeLanguage = "f#";
2242

2343
if (thisAssemblyClass.HasValue)
@@ -49,11 +69,15 @@ namespace AssemblyInfo
4969
[<System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage>]
5070
#endif
5171
type internal ThisAssembly() =
52-
static member internal AssemblyVersion = ""1.3.0.0""
53-
static member internal AssemblyFileVersion = ""1.3.1.0""
5472
static member internal AssemblyCompany = ""company""
55-
static member internal IsPublicRelease = false
73+
static member internal AssemblyFileVersion = ""1.3.1.0""
74+
static member internal AssemblyVersion = ""1.3.0.0""
75+
static member internal CustomBool = true
76+
static member internal CustomString1 = ""abc""
77+
static member internal CustomString3 = """"
78+
static member internal CustomTicks = new System.DateTime(637509805729817056L, System.DateTimeKind.Utc)
5679
static member internal IsPrerelease = false
80+
static member internal IsPublicRelease = false
5781
static member internal RootNamespace = """"
5882
do()
5983
" : "")}";
@@ -72,6 +96,25 @@ public void CSharpGenerator(bool? thisAssemblyClass)
7296
info.AssemblyFileVersion = "1.3.1.0";
7397
info.AssemblyVersion = "1.3.0.0";
7498
info.CodeLanguage = "c#";
99+
info.AdditionalThisAssemblyFields =
100+
new TaskItem[]
101+
{
102+
new TaskItem(
103+
"CustomString1",
104+
new Dictionary<string,string>() { { "String", "abc" } } ),
105+
new TaskItem(
106+
"CustomString2",
107+
new Dictionary<string,string>() { { "String", "" } } ),
108+
new TaskItem(
109+
"CustomString3",
110+
new Dictionary<string,string>() { { "String", "" }, { "EmitIfEmpty", "true" } } ),
111+
new TaskItem(
112+
"CustomBool",
113+
new Dictionary<string,string>() { { "Boolean", "true" } } ),
114+
new TaskItem(
115+
"CustomTicks",
116+
new Dictionary<string,string>() { { "Ticks", "637509805729817056" } } ),
117+
};
75118

76119
if (thisAssemblyClass.HasValue)
77120
{
@@ -100,11 +143,15 @@ public void CSharpGenerator(bool? thisAssemblyClass)
100143
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
101144
#endif
102145
internal static partial class ThisAssembly {{
103-
internal const string AssemblyVersion = ""1.3.0.0"";
104-
internal const string AssemblyFileVersion = ""1.3.1.0"";
105146
internal const string AssemblyCompany = ""company"";
106-
internal const bool IsPublicRelease = false;
147+
internal const string AssemblyFileVersion = ""1.3.1.0"";
148+
internal const string AssemblyVersion = ""1.3.0.0"";
149+
internal const bool CustomBool = true;
150+
internal const string CustomString1 = ""abc"";
151+
internal const string CustomString3 = """";
152+
internal static readonly System.DateTime CustomTicks = new System.DateTime(637509805729817056L, System.DateTimeKind.Utc);
107153
internal const bool IsPrerelease = false;
154+
internal const bool IsPublicRelease = false;
108155
internal const string RootNamespace = """";
109156
}}
110157
" : "")}";
@@ -154,11 +201,11 @@ Partial Friend NotInheritable Class ThisAssembly
154201
#Else
155202
Partial Friend NotInheritable Class ThisAssembly
156203
#End If
157-
Friend Const AssemblyVersion As String = ""1.3.0.0""
158-
Friend Const AssemblyFileVersion As String = ""1.3.1.0""
159204
Friend Const AssemblyCompany As String = ""company""
160-
Friend Const IsPublicRelease As Boolean = False
205+
Friend Const AssemblyFileVersion As String = ""1.3.1.0""
206+
Friend Const AssemblyVersion As String = ""1.3.0.0""
161207
Friend Const IsPrerelease As Boolean = False
208+
Friend Const IsPublicRelease As Boolean = False
162209
Friend Const RootNamespace As String = """"
163210
End Class
164211
" : "")}";

0 commit comments

Comments
 (0)