From 79409c525f6893afa47d3e3333f41303b5ceb047 Mon Sep 17 00:00:00 2001 From: Simon Egli Date: Mon, 30 Nov 2015 12:32:39 +0100 Subject: [PATCH 1/2] Smart AssemblyInfo, that writes output only if it has changed, so the solution needs to be rebuild only if AssemblyInfo really has changed. --- .../MSBuild.Community.Tasks/AssemblyInfo.cs | 19 ++++++++++++---- Source/MSBuild.Community.Tasks/FxCop.cs | 22 +++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Source/MSBuild.Community.Tasks/AssemblyInfo.cs b/Source/MSBuild.Community.Tasks/AssemblyInfo.cs index 18731864..0ef9e284 100644 --- a/Source/MSBuild.Community.Tasks/AssemblyInfo.cs +++ b/Source/MSBuild.Community.Tasks/AssemblyInfo.cs @@ -1,6 +1,6 @@ -#region Copyright © 2005 Paul Welter. All rights reserved. +#region Copyright � 2005 Paul Welter. All rights reserved. /* -Copyright © 2005 Paul Welter. All rights reserved. +Copyright � 2005 Paul Welter. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -491,14 +491,25 @@ public override bool Execute() Encoding utf8WithSignature = new UTF8Encoding(true); - using (StreamWriter writer = new StreamWriter(_outputFile, false, utf8WithSignature)) + StringBuilder textbuilder = new StringBuilder(); + + + using (StringWriter writer = new StringWriter(textbuilder)) { GenerateFile(writer); writer.Flush(); writer.Close(); - Log.LogMessage("Created AssemblyInfo file \"{0}\".", _outputFile); } + // check if assembly info has changed and we need to write the output file. + var text = textbuilder.ToString(); + string file = null; + if (File.Exists(_outputFile)) file = File.ReadAllText(_outputFile); + if (file != text) { + File.WriteAllText(_outputFile, text, utf8WithSignature); + Log.LogMessage("Created AssemblyInfo file \"{0}\".", _outputFile); + } + return true; } diff --git a/Source/MSBuild.Community.Tasks/FxCop.cs b/Source/MSBuild.Community.Tasks/FxCop.cs index 5aa56f77..6acfee40 100644 --- a/Source/MSBuild.Community.Tasks/FxCop.cs +++ b/Source/MSBuild.Community.Tasks/FxCop.cs @@ -187,14 +187,14 @@ public ITaskItem[] Rules { get { return _rules; } set { _rules = value; } - } - - /// - /// Gets or sets the rule set. - /// - /// - /// The rule set. - /// + } + + /// + /// Gets or sets the rule set. + /// + /// + /// The rule set. + /// public string RuleSet { get; set; } private string _analysisReportFileName; @@ -492,9 +492,9 @@ protected override string GenerateCommandLineCommands() } } - if (!string.IsNullOrEmpty(RuleSet)) - { - _programArguments.AppendFormat("/ruleset:{0} ", RuleSet); + if (!string.IsNullOrEmpty(RuleSet)) + { + _programArguments.AppendFormat("/ruleset:{0} ", RuleSet); } if (IncludeSummaryReport) From baeb609b1654058dd91180fa46f57bb87cc1a8bf Mon Sep 17 00:00:00 2001 From: Simon Jakob Egli Date: Sun, 14 Jul 2024 20:18:47 +0200 Subject: [PATCH 2/2] Modified projects to SDK style, updated DotNetZip --- .../ILMerge/A/A.csproj | 77 +---- .../ILMerge/B/B.csproj | 78 +---- .../MSBuild.Community.Tasks.Tests.csproj | 190 +++-------- .../packages.config | 7 - .../MSBuild.Community.Tasks.csproj | 300 ++++-------------- .../Properties/Resources.Designer.cs | 2 +- .../MSBuild.Community.Tasks/packages.config | 5 - Source/Settings.SourceAnalysis | 36 --- 8 files changed, 113 insertions(+), 582 deletions(-) delete mode 100644 Source/MSBuild.Community.Tasks.Tests/packages.config delete mode 100644 Source/MSBuild.Community.Tasks/packages.config delete mode 100644 Source/Settings.SourceAnalysis diff --git a/Source/MSBuild.Community.Tasks.Tests/ILMerge/A/A.csproj b/Source/MSBuild.Community.Tasks.Tests/ILMerge/A/A.csproj index 795b8263..b9188106 100644 --- a/Source/MSBuild.Community.Tasks.Tests/ILMerge/A/A.csproj +++ b/Source/MSBuild.Community.Tasks.Tests/ILMerge/A/A.csproj @@ -1,21 +1,9 @@ - - + - Debug - AnyCPU 8.0.50727 - 2.0 - {1291B270-5E1F-425B-ACA1-5253A0067D26} - Library - Properties - A - A - - - 3.5 - - - v4.0 + + + net48 publish\ true Disk @@ -31,64 +19,15 @@ false false true - + false + bin\$(Configuration)\ + AllRules.ruleset - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\A.XML - AllRules.ruleset - false + bin\$(Configuration)\A.XML pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - false - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - \ No newline at end of file diff --git a/Source/MSBuild.Community.Tasks.Tests/ILMerge/B/B.csproj b/Source/MSBuild.Community.Tasks.Tests/ILMerge/B/B.csproj index d8e41999..f5ede9d0 100644 --- a/Source/MSBuild.Community.Tasks.Tests/ILMerge/B/B.csproj +++ b/Source/MSBuild.Community.Tasks.Tests/ILMerge/B/B.csproj @@ -1,21 +1,9 @@ - - + - Debug - AnyCPU 8.0.50727 - 2.0 - {885FC778-671A-4934-B76B-BE28334AD9CB} - Library - Properties - B - B - - - 3.5 - - - v4.0 + + + net48 publish\ true Disk @@ -31,65 +19,15 @@ false false true - + false + bin\$(Configuration)\ + AllRules.ruleset - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\B.XML - AllRules.ruleset - false + bin\$(Configuration)\B.XML pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - false - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - \ No newline at end of file diff --git a/Source/MSBuild.Community.Tasks.Tests/MSBuild.Community.Tasks.Tests.csproj b/Source/MSBuild.Community.Tasks.Tests/MSBuild.Community.Tasks.Tests.csproj index ee50bcba..d0281277 100644 --- a/Source/MSBuild.Community.Tasks.Tests/MSBuild.Community.Tasks.Tests.csproj +++ b/Source/MSBuild.Community.Tasks.Tests/MSBuild.Community.Tasks.Tests.csproj @@ -1,165 +1,35 @@ - - - + - Debug - AnyCPU 9.0.30729 - 2.0 - {5AC1D006-CA56-4BE1-8250-DBEABBEA0725} - Library - MSBuild.Community.Tasks.Tests - MSBuild.Community.Tasks.Tests - 4 true ..\MSBuild.Community.Tasks\MSBuild.Community.Tasks.snk - v4.0 - 512 + net48 + false + .\bin\$(Configuration)\ + true + AllRules.ruleset - true full - false - .\bin\Debug\ - DEBUG;TRACE - true - AllRules.ruleset - false - false - true - .\bin\Release\ - TRACE true - true - AllRules.ruleset - false - - ..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll - - - ..\packages\FSharp.Compiler.CodeDom.1.0.0.1\lib\net40\FSharp.Compiler.CodeDom.dll - True - + + + + + + - - ..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll - True - - - False - ..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {F88A60A8-564C-4E70-92DC-E92DBB897641} - MSBuild.Community.Tasks - True - + @@ -180,9 +50,6 @@ - - Designer - Designer @@ -211,10 +78,31 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/Source/MSBuild.Community.Tasks.Tests/packages.config b/Source/MSBuild.Community.Tasks.Tests/packages.config deleted file mode 100644 index e51f29f0..00000000 --- a/Source/MSBuild.Community.Tasks.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Source/MSBuild.Community.Tasks/MSBuild.Community.Tasks.csproj b/Source/MSBuild.Community.Tasks/MSBuild.Community.Tasks.csproj index 915813c6..a27fb769 100644 --- a/Source/MSBuild.Community.Tasks/MSBuild.Community.Tasks.csproj +++ b/Source/MSBuild.Community.Tasks/MSBuild.Community.Tasks.csproj @@ -1,266 +1,43 @@ - - - + - Debug - AnyCPU - {F88A60A8-564C-4E70-92DC-E92DBB897641} - Library - Properties - MSBuild.Community.Tasks - MSBuild.Community.Tasks true MSBuild.Community.Tasks.snk - v4.0 - 512 + net48 + false + AllRules.ruleset - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\MSBuild.Community.Tasks.xml + bin\$(Configuration)\ + bin\$(Configuration)\MSBuild.Community.Tasks.xml false true - AllRules.ruleset - false pdbonly - true ..\..\Build\ - - - prompt - 4 + ..\..\Build\MSBuild.Community.Tasks.xml - false - AllRules.ruleset - false - - ..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll - True - - - ..\packages\FSharp.Compiler.CodeDom.1.0.0.1\lib\net40\FSharp.Compiler.CodeDom.dll - True - + + + + + - - - - - - - GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - Code - - - Code - - - - Code - - - Code - - - Code - - - - Code - - - - Code - - - - - Code - - - Code - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - - Code - - - Code - - - - Code - - - Code - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + True True Resources.resx - - - - - - - - - - - - - - - - - - - @@ -275,18 +52,55 @@ Always - - + Designer ResXFileCodeGenerator Resources.Designer.cs - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/Source/MSBuild.Community.Tasks/Properties/Resources.Designer.cs b/Source/MSBuild.Community.Tasks/Properties/Resources.Designer.cs index 65e120c3..28d9f69b 100644 --- a/Source/MSBuild.Community.Tasks/Properties/Resources.Designer.cs +++ b/Source/MSBuild.Community.Tasks/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace MSBuild.Community.Tasks.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Source/MSBuild.Community.Tasks/packages.config b/Source/MSBuild.Community.Tasks/packages.config deleted file mode 100644 index 9fc3100b..00000000 --- a/Source/MSBuild.Community.Tasks/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Source/Settings.SourceAnalysis b/Source/Settings.SourceAnalysis deleted file mode 100644 index 3568433a..00000000 --- a/Source/Settings.SourceAnalysis +++ /dev/null @@ -1,36 +0,0 @@ - - - - - True - True - False - - - - - - - False - - - - - - - - - - False - - - - - - - - False - - - - \ No newline at end of file