\d+))?" +
@"(?>\-(?[0-9A-Za-z\-\.]+))?" +
@@ -620,4 +620,4 @@ public static int GetDigits(int n)
#pragma warning restore SA1117 // Parameters should be on same line or separate lines
#pragma warning restore SA1201 // Elements should appear in the correct order
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).
-#pragma warning restore SA1407 // Arithmetic expressions should declare precedence
\ No newline at end of file
+#pragma warning restore SA1407 // Arithmetic expressions should declare precedence
diff --git a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Build.cs b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Build.cs
index e9a6e64..7b9359e 100644
--- a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Build.cs
+++ b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Build.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Jeff Kluge. All rights reserved.
+// Copyright (c) Jeff Kluge. All rights reserved.
//
// Licensed under the MIT license.
@@ -56,17 +56,9 @@ public SolutionCreator TryBuild(bool restore, string target, out bool result)
/// The current .
public SolutionCreator TryBuild(bool restore, string target, IDictionary? globalProperties, out bool result)
{
- if (restore)
- {
- TryRestore(out result);
-
- if (!result)
- {
- return this;
- }
- }
+ BuildOutput buildOutput = BuildOutput.Create();
- result = Build([target], globalProperties, out _, out _);
+ result = Build(restore, [target], globalProperties, buildOutput, out _);
return this;
}
@@ -168,17 +160,9 @@ public SolutionCreator TryBuild(bool restore, out bool result)
/// The current .
public SolutionCreator TryBuild(bool restore, IDictionary? globalProperties, out bool result)
{
- if (restore)
- {
- TryRestore(out result);
-
- if (!result)
- {
- return this;
- }
- }
+ BuildOutput buildOutput = BuildOutput.Create();
- result = Build(null, globalProperties: globalProperties, out _, out _);
+ result = Build(restore, targets: null, globalProperties: globalProperties, buildOutput, out _);
return this;
}
@@ -491,21 +475,33 @@ private bool Build(bool restore, string[]? targets, IDictionary?
{
targetOutputs = null;
- if (restore)
+ lock (BuildManagerHost.LockObject)
{
- if (!Restore(globalProperties, buildOutput, out targetOutputs))
+ BuildManagerHost.BeginBuild([.. ProjectCollection.Loggers, buildOutput]);
+
+ try
{
- return false;
+ if (restore)
+ {
+ if (!Restore(globalProperties, buildOutput, out targetOutputs))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ Save();
+ }
+
+ bool result = BuildHost.TryBuild(FullPath, ProjectCollection, buildOutput, out targetOutputs, targets: targets);
+
+ return result;
+ }
+ finally
+ {
+ BuildManagerHost.EndBuild();
}
}
- else
- {
- Save();
- }
-
- bool result = BuildHost.TryBuild(FullPath, ProjectCollection, buildOutput, out targetOutputs, targets: targets);
-
- return result;
}
private bool Restore(IDictionary? globalProperties, BuildOutput buildOutput, out IDictionary? targetOutputs)
diff --git a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Templates.cs b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Templates.cs
index 60fb569..1ee3837 100644
--- a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Templates.cs
+++ b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.Templates.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Jeff Kluge. All rights reserved.
+// Copyright (c) Jeff Kluge. All rights reserved.
//
// Licensed under the MIT license.
diff --git a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.cs b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.cs
index df15aaf..9566016 100644
--- a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.cs
+++ b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreator.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Jeff Kluge. All rights reserved.
+// Copyright (c) Jeff Kluge. All rights reserved.
//
// Licensed under the MIT license.
diff --git a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreatorTemplates/DotNet.cs b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreatorTemplates/DotNet.cs
index 4d5c63a..13e5cb5 100644
--- a/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreatorTemplates/DotNet.cs
+++ b/src/Microsoft.Build.Utilities.ProjectCreation/SolutionCreatorTemplates/DotNet.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Jeff Kluge. All rights reserved.
+// Copyright (c) Jeff Kluge. All rights reserved.
//
// Licensed under the MIT license.
diff --git a/src/Shared/GlobalSuppressions.cs b/src/Shared/GlobalSuppressions.cs
index a02b9b5..e7f30e2 100644
--- a/src/Shared/GlobalSuppressions.cs
+++ b/src/Shared/GlobalSuppressions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Jeff Kluge. All rights reserved.
+// Copyright (c) Jeff Kluge. All rights reserved.
//
// Licensed under the MIT license.
@@ -8,4 +8,4 @@
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "Reviewed.")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "Reviewed.")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:ParameterMustNotSpanMultipleLines", Justification = "Reviewed.")]
-[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1121:UseBuiltInTypeAlias", Justification = "Reviewed.")]
\ No newline at end of file
+[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1121:UseBuiltInTypeAlias", Justification = "Reviewed.")]
diff --git a/src/Shared/stylecop.json b/src/Shared/stylecop.json
index 0829cfa..4eeb69f 100644
--- a/src/Shared/stylecop.json
+++ b/src/Shared/stylecop.json
@@ -1,6 +1,5 @@
{
- "$schema":
- "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
+ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"orderingRules": {
"usingDirectivesPlacement": "outsideNamespace",