diff --git a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs index 3e4408bc8..acf511e27 100644 --- a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs +++ b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs @@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common { public class AssemblyInfoFileGenerator { - public static string Generate(AssemblyInfoOptions metadata, IEnumerable sourceFiles) + public static string GenerateCSharp(AssemblyInfoOptions metadata, IEnumerable sourceFiles) { var projectAttributes = GetProjectAttributes(metadata); @@ -43,7 +43,8 @@ namespace Microsoft.DotNet.Cli.Compiler.Common } } - return string.Join(Environment.NewLine, projectAttributes + string autoGeneratedHeader = "// This file has been auto generated. \r\n"; + return autoGeneratedHeader + string.Join(Environment.NewLine, projectAttributes .Where(projectAttribute => projectAttribute.Value != null && !existingAttributes.Contains(projectAttribute.Key)) .Select(projectAttribute => $"[assembly:{projectAttribute.Key.FullName}(\"{projectAttribute.Value}\")]")); } diff --git a/src/dotnet/commands/dotnet-compile-csc/Program.cs b/src/dotnet/commands/dotnet-compile-csc/Program.cs index 0053649f8..6d84fe0ce 100644 --- a/src/dotnet/commands/dotnet-compile-csc/Program.cs +++ b/src/dotnet/commands/dotnet-compile-csc/Program.cs @@ -90,7 +90,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc // Generate assembly info var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.cs"); - File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.Generate(assemblyInfoOptions, sources)); + File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.GenerateCSharp(assemblyInfoOptions, sources)); + allArgs.Add($"\"{assemblyInfo}\""); if (outputName != null) diff --git a/src/dotnet/commands/dotnet-resgen/ResourceAssemblyGenerator.cs b/src/dotnet/commands/dotnet-resgen/ResourceAssemblyGenerator.cs index c95a56dba..473b1664d 100644 --- a/src/dotnet/commands/dotnet-resgen/ResourceAssemblyGenerator.cs +++ b/src/dotnet/commands/dotnet-resgen/ResourceAssemblyGenerator.cs @@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tools.Resgen compilation = compilation.AddSyntaxTrees(new[] { - CSharpSyntaxTree.ParseText(AssemblyInfoFileGenerator.Generate(metadata, Enumerable.Empty())) + CSharpSyntaxTree.ParseText(AssemblyInfoFileGenerator.GenerateCSharp(metadata, Enumerable.Empty())) }); var result = compilation.Emit(outputStream, manifestResources: resourceDescriptions);