diff --git a/src/MSBuildProjectCreator.UnitTests/ExperimentTests.cs b/src/MSBuildProjectCreator.UnitTests/ExperimentTests.cs
index 81cc4dd..6ded09f 100644
--- a/src/MSBuildProjectCreator.UnitTests/ExperimentTests.cs
+++ b/src/MSBuildProjectCreator.UnitTests/ExperimentTests.cs
@@ -47,7 +47,7 @@ public void Experiment1()
ProjectCreator
.Templates
- .LogsMessage("abc.proj", "Hello World")
+ .LogsMessage("Hello World", path: "abc.proj")
.TryBuild(out bool _, out BuildOutput _);
}
}
diff --git a/src/MSBuildProjectCreator/Templates/LogsMessage.cs b/src/MSBuildProjectCreator/Templates/LogsMessage.cs
index 7dbe7ae..2365956 100644
--- a/src/MSBuildProjectCreator/Templates/LogsMessage.cs
+++ b/src/MSBuildProjectCreator/Templates/LogsMessage.cs
@@ -2,6 +2,7 @@
//
// Licensed under the MIT license.
+using Microsoft.Build.Evaluation;
using Microsoft.Build.Framework;
// ReSharper disable once CheckNamespace
@@ -13,13 +14,42 @@ public partial class ProjectCreatorTemplates
/// Creates a project that logs a single message.
///
/// The message to display.
- /// An optional relative or full path for the project.
/// An optional to use.
/// An optional condition to add to the message task.
+ /// An optional target name to add the message task to. Default is "Build".
+ /// An optional relative or full path for the project.
+ /// An optional list of default targets for the project.
+ /// An optional list of initial targets for the project.
+ /// An optional SDK for the project.
+ /// An optional tools version for the project.
+ /// An optional list of properties to treat as local properties.
+ /// An optional to use when loading the project.
+ /// An optional specifying options when creating a new file.
/// A object that is used to construct an MSBuild project.
- public ProjectCreator LogsMessage(string text, string path = null, MessageImportance? importance = null, string condition = null)
+ public ProjectCreator LogsMessage(
+ string text,
+ MessageImportance? importance = null,
+ string condition = null,
+ string targetName = null,
+ string path = null,
+ string defaultTargets = null,
+ string initialTargets = null,
+ string sdk = null,
+ string toolsVersion = null,
+ string treatAsLocalProperty = null,
+ ProjectCollection projectCollection = null,
+ NewProjectFileOptions? projectFileOptions = null)
{
- return ProjectCreator.Create(path)
+ return ProjectCreator.Create(
+ path,
+ defaultTargets,
+ initialTargets,
+ sdk,
+ toolsVersion,
+ treatAsLocalProperty,
+ projectCollection,
+ projectFileOptions)
+ .Target(targetName ?? ProjectCreatorConstants.DefaultTargetName)
.TaskMessage(text, importance, condition);
}
}