diff --git a/.editorconfig b/.editorconfig
index 258c47e..8bafd23 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -222,4 +222,7 @@ dotnet_naming_style.camel_case_underscore.capitalization = camel_case
dotnet_diagnostic.SA1101.severity = none
# We prefer underscore prefixes for private fields
-dotnet_diagnostic.SA1309.severity = none
\ No newline at end of file
+dotnet_diagnostic.SA1309.severity = none
+
+# Code Style rules (IDE*)
+dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary import
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index 6e73809..4c3389e 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,6 +8,8 @@
true
+ true
+ true
$(NoWarn);SA0001
diff --git a/src/BuildPrediction/Polyfills.cs b/src/BuildPrediction/Polyfills.cs
index b73ff70..05fe50e 100644
--- a/src/BuildPrediction/Polyfills.cs
+++ b/src/BuildPrediction/Polyfills.cs
@@ -1,9 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#if NET472
+
using System;
-#if NET472
namespace Microsoft.Build.Prediction
{
///
diff --git a/src/BuildPrediction/Predictors/CopyTask/FileExpression.cs b/src/BuildPrediction/Predictors/CopyTask/FileExpression.cs
index d299a30..85e1900 100644
--- a/src/BuildPrediction/Predictors/CopyTask/FileExpression.cs
+++ b/src/BuildPrediction/Predictors/CopyTask/FileExpression.cs
@@ -19,9 +19,11 @@ internal static class FileExpression
///
/// Evaluates file expressions, which are MSBuild expressions that
/// evaluate to a list of files (e.g. @(Compile -> '%(filename)') or %(None.filename)).
+ ///
/// An unprocessed string for a single expression.
/// The project where the expression exists.
/// The task where the expression exists.
+ /// Indicates whether the expression is batched.
/// the set of all files in the evaluated expression.
public static List EvaluateExpression(
string expression,
diff --git a/src/BuildPrediction/Predictors/GeneratePublishDependencyFilePredictor.cs b/src/BuildPrediction/Predictors/GeneratePublishDependencyFilePredictor.cs
index 67cde78..0e161ed 100644
--- a/src/BuildPrediction/Predictors/GeneratePublishDependencyFilePredictor.cs
+++ b/src/BuildPrediction/Predictors/GeneratePublishDependencyFilePredictor.cs
@@ -57,7 +57,7 @@ public void PredictInputsAndOutputs(
///
/// Determines the value of _UseBuildDependencyFile by emulating the behavior from the _ComputeUseBuildDependencyFile target (and the _ComputePackageReferencePublish target).
- ///
+ ///
internal static bool ShouldUseBuildDependencyFile(ProjectInstance projectInstance)
{
bool hasExcludeFromPublishPackageReference = false;
diff --git a/src/BuildPrediction/Predictors/MasmItemsPredictor.cs b/src/BuildPrediction/Predictors/MasmItemsPredictor.cs
index 4fc945c..b955e9f 100644
--- a/src/BuildPrediction/Predictors/MasmItemsPredictor.cs
+++ b/src/BuildPrediction/Predictors/MasmItemsPredictor.cs
@@ -3,8 +3,6 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
using Microsoft.Build.Execution;
namespace Microsoft.Build.Prediction.Predictors
@@ -17,7 +15,7 @@ namespace Microsoft.Build.Prediction.Predictors
///
/// While not as widely used, the masm.props/masm.targets are distributed with Visual Studio C/C++ SDK:
/// - $(VCTargetsPath)\BuildCustomizations\masm.props
- /// - $(VCTargetsPath)\BuildCustomizations\masm.targets
+ /// - $(VCTargetsPath)\BuildCustomizations\masm.targets.
///
///
public class MasmItemsPredictor : IProjectPredictor
@@ -28,7 +26,7 @@ public class MasmItemsPredictor : IProjectPredictor
internal const string MasmItemName = "MASM";
///
- /// Property name declared in masm.targets
+ /// Property name declared in masm.targets.
///
internal const string MasmBeforeTargetsPropertyName = "MASMBeforeTargets";
@@ -61,7 +59,7 @@ public class MasmItemsPredictor : IProjectPredictor
///
/// Character separator for values specified in %(MASM.IncludePaths).
///
- private static readonly char[] IncludePathsSeparator = { ';' };
+ private static readonly char[] _includePathsSeparator = { ';' };
///
public void PredictInputsAndOutputs(ProjectInstance project, ProjectPredictionReporter reporter)
@@ -101,7 +99,7 @@ private void ReportInputs(ProjectPredictionReporter reporter, ProjectItemInstanc
reporter.ReportInputFile(masmItem.EvaluatedInclude);
string[] includePaths = masmItem.GetMetadataValue(IncludePathsMetadata)
- .Split(IncludePathsSeparator, StringSplitOptions.RemoveEmptyEntries);
+ .Split(_includePathsSeparator, StringSplitOptions.RemoveEmptyEntries);
// Avoid reporting paths that we've already reported for this project.
foreach (string includePath in includePaths)
diff --git a/src/BuildPrediction/ProjectGraphPredictionExecutor.cs b/src/BuildPrediction/ProjectGraphPredictionExecutor.cs
index 133eba8..bb827e1 100644
--- a/src/BuildPrediction/ProjectGraphPredictionExecutor.cs
+++ b/src/BuildPrediction/ProjectGraphPredictionExecutor.cs
@@ -4,9 +4,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.Build.Definition;
-using Microsoft.Build.Evaluation;
-using Microsoft.Build.Evaluation.Context;
using Microsoft.Build.Execution;
using Microsoft.Build.Graph;
diff --git a/src/BuildPrediction/ProjectPredictionReporter.cs b/src/BuildPrediction/ProjectPredictionReporter.cs
index dc15479..90f36b9 100644
--- a/src/BuildPrediction/ProjectPredictionReporter.cs
+++ b/src/BuildPrediction/ProjectPredictionReporter.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Build.Prediction
///
///
/// This struct is used internally by the prediction library and is not intended to be created externally.
- /// instances recieve this in their
+ /// instances recieve this in their
/// methods as a means to report predictions to the . Generally the methods on this struct should mirror those on .
///
#pragma warning disable CA1815 // Override equals and operator equals on value types. Justification: This struct is never compared or equated.
diff --git a/src/BuildPredictionTests/Microsoft.Build.Prediction.Tests.csproj b/src/BuildPredictionTests/Microsoft.Build.Prediction.Tests.csproj
index 31f9fff..a94a8db 100644
--- a/src/BuildPredictionTests/Microsoft.Build.Prediction.Tests.csproj
+++ b/src/BuildPredictionTests/Microsoft.Build.Prediction.Tests.csproj
@@ -2,7 +2,7 @@
net472;net8.0;net9.0
- $(NoWarn);SA1600;SA1611;SA1615
+ $(NoWarn);SA1600;SA1611;SA1615;CS1591
diff --git a/src/BuildPredictionTests/MsBuildHelpersTests.cs b/src/BuildPredictionTests/MsBuildHelpersTests.cs
index 9e4d500..d2b7984 100644
--- a/src/BuildPredictionTests/MsBuildHelpersTests.cs
+++ b/src/BuildPredictionTests/MsBuildHelpersTests.cs
@@ -5,7 +5,6 @@
using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Execution;
-using Microsoft.Build.Prediction;
using Xunit;
namespace Microsoft.Build.Prediction.Tests
diff --git a/src/BuildPredictionTests/Predictors/MasmItemsPredictorTests.cs b/src/BuildPredictionTests/Predictors/MasmItemsPredictorTests.cs
index 5d789c7..167a555 100644
--- a/src/BuildPredictionTests/Predictors/MasmItemsPredictorTests.cs
+++ b/src/BuildPredictionTests/Predictors/MasmItemsPredictorTests.cs
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#if !NETCOREAPP
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Prediction.Predictors;
using Xunit;
-#if !NETCOREAPP
// These tests rely on VCTargetsPath, which isn't available in the netcoreapp flavor of MSBuild.
// MASM files and C++ builds in general aren't available on netcoreapp, so skipping these tests is OK.
namespace Microsoft.Build.Prediction.Tests.Predictors
diff --git a/src/BuildPredictionTests/Predictors/ProjectFileAndImportsPredictorTests.cs b/src/BuildPredictionTests/Predictors/ProjectFileAndImportsPredictorTests.cs
index 9024893..d0f3ad8 100644
--- a/src/BuildPredictionTests/Predictors/ProjectFileAndImportsPredictorTests.cs
+++ b/src/BuildPredictionTests/Predictors/ProjectFileAndImportsPredictorTests.cs
@@ -2,9 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
-using Microsoft.Build.Prediction;
using Microsoft.Build.Prediction.Predictors;
-using Microsoft.Build.Prediction.Tests;
using Xunit;
namespace Microsoft.Build.Prediction.Tests.Predictors