Skip to content

Commit a9e8765

Browse files
authored
Merge pull request #1024 from Numpsy/fs_assenbly_info
Change F# AssemblyInfo generation to always include a do() after the …
2 parents 9ca060e + e1cc3ec commit a9e8765

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ private void GenerateAssemblyAttributes()
397397
this.generator.DeclareAttribute(typeof(AssemblyCopyrightAttribute), this.AssemblyCopyright);
398398
}
399399
}
400+
401+
this.generator.EndAssemblyAttributes();
400402
}
401403

402404
private List<KeyValuePair<string, (object Value, bool EmitIfEmpty /* Only applies to string values */)>> GetFieldsForThisAssembly()
@@ -658,6 +660,10 @@ internal virtual void StartAssemblyAttributes()
658660
{
659661
}
660662

663+
internal virtual void EndAssemblyAttributes()
664+
{
665+
}
666+
661667
internal abstract void DeclareAttribute(Type type, string arg);
662668

663669
internal abstract void StartThisAssemblyClass();
@@ -726,6 +732,11 @@ internal override void StartAssemblyAttributes()
726732
this.CodeBuilder.AppendLine($"namespace {this.Namespace}");
727733
}
728734

735+
internal override void EndAssemblyAttributes()
736+
{
737+
this.CodeBuilder.AppendLine("do()");
738+
}
739+
729740
internal override void DeclareAttribute(Type type, string arg)
730741
{
731742
this.CodeBuilder.AppendLine($"[<assembly: {type.FullName}(\"{arg}\")>]");
@@ -738,7 +749,6 @@ internal override void EndThisAssemblyClass()
738749

739750
internal override void StartThisAssemblyClass()
740751
{
741-
this.CodeBuilder.AppendLine("do()");
742752
this.CodeBuilder.AppendLine($"#if {CompilerDefinesAroundGeneratedCodeAttribute}");
743753
this.CodeBuilder.AppendLine($"[<System.CodeDom.Compiler.GeneratedCode(\"{GeneratorName}\",\"{GeneratorVersion}\")>]");
744754
this.CodeBuilder.AppendLine("#endif");

test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ namespace AssemblyInfo
6666
[<assembly: System.Reflection.AssemblyVersionAttribute(""1.3.0.0"")>]
6767
[<assembly: System.Reflection.AssemblyFileVersionAttribute(""1.3.1.0"")>]
6868
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("""")>]
69-
{(thisAssemblyClass.GetValueOrDefault(true) ? $@"do()
70-
#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP
69+
do()
70+
{(thisAssemblyClass.GetValueOrDefault(true) ? $@"#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP
7171
[<System.CodeDom.Compiler.GeneratedCode(""{AssemblyVersionInfo.GeneratorName}"",""{AssemblyVersionInfo.GeneratorVersion}"")>]
7272
#endif
7373
#if NET40_OR_GREATER || NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER

0 commit comments

Comments
 (0)