diff --git a/src/app/FakeLib/AssemblyInfoFile.fs b/src/app/FakeLib/AssemblyInfoFile.fs index 2e225719a5a..d9f71d68ef9 100644 --- a/src/app/FakeLib/AssemblyInfoFile.fs +++ b/src/app/FakeLib/AssemblyInfoFile.fs @@ -189,23 +189,23 @@ let CreateFSharpAssemblyInfoWithConfig outputFileName attributes (config : Assem let generateClass, useNamespace = config.GenerateClass, config.UseNamespace let sourceLines = - let required = - [ sprintf "namespace %s" useNamespace ] - @ (getDependencies attributes |> List.map (sprintf "open %s")) - @ [ "" ] - @ (attributes - |> Seq.toList - |> List.map (fun (attr : Attribute) -> sprintf "[]" attr.Name attr.Value)) - @ [ "do ()"; "" ] - - let optional = - [ "module internal AssemblyVersionInformation =" - sprintf " let [] Version = %s" (getAssemblyVersionInfo attributes) - sprintf " let [] InformationalVersion = %s" (getAssemblyInformationalVersion attributes) - ] - - if generateClass then required @ optional - else required + [ + yield "// Auto-Generated by FAKE; do not edit" + yield sprintf "namespace %s" useNamespace + yield! getDependencies attributes |> Seq.map (sprintf "open %s") + yield "" + yield! + attributes + |> Seq.map (fun (attr : Attribute) -> sprintf "[]" attr.Name attr.Value) + + yield "do ()"; yield "" + + if generateClass then + yield "module internal AssemblyVersionInformation =" + yield sprintf " let [] Version = %s" (getAssemblyVersionInfo attributes) + yield sprintf " let [] InformationalVersion = %s" (getAssemblyInformationalVersion attributes) + ] + sourceLines |> writeToFile outputFileName traceEndTask "AssemblyInfo" outputFileName diff --git a/src/test/Test.FAKECore/AssemblyInfoSpecs.cs b/src/test/Test.FAKECore/AssemblyInfoSpecs.cs index c65ec2ba8c6..94f71a3e728 100644 --- a/src/test/Test.FAKECore/AssemblyInfoSpecs.cs +++ b/src/test/Test.FAKECore/AssemblyInfoSpecs.cs @@ -24,7 +24,7 @@ public class when_using_fsharp_task_with_default_config AssemblyInfoFile.Attribute.Version("1.0.0.0") }; AssemblyInfoFile.CreateFSharpAssemblyInfo(infoFile, attributes); - const string expected = "namespace System\r\nopen System.Reflection\r\n\r\n[]\r\n[]\r\ndo ()\r\n\r\nmodule internal AssemblyVersionInformation =\r\n let [] Version = \"1.0.0.0\"\r\n let [] InformationalVersion = \"1.0.0.0\"\r\n"; + const string expected = "// Auto-Generated by FAKE; do not edit\r\nnamespace System\r\nopen System.Reflection\r\n\r\n[]\r\n[]\r\ndo ()\r\n\r\nmodule internal AssemblyVersionInformation =\r\n let [] Version = \"1.0.0.0\"\r\n let [] InformationalVersion = \"1.0.0.0\"\r\n"; File.ReadAllText(infoFile) .ShouldEqual(expected.Replace("\r\n", Environment.NewLine)); @@ -87,7 +87,7 @@ public class when_using_fsharp_task_with_custom_config AssemblyInfoFile.Attribute.Version("1.0.0.0") }; AssemblyInfoFile.CreateFSharpAssemblyInfoWithConfig(infoFile, attributes, customConfig); - const string expected = "namespace Custom\r\nopen System.Reflection\r\n\r\n[]\r\n[]\r\ndo ()\r\n\r\n"; + const string expected = "// Auto-Generated by FAKE; do not edit\r\nnamespace Custom\r\nopen System.Reflection\r\n\r\n[]\r\n[]\r\ndo ()\r\n\r\n"; File.ReadAllText(infoFile) .ShouldEqual(expected.Replace("\r\n", Environment.NewLine)); };