diff --git a/src/Utilities/TaskItem.cs b/src/Utilities/TaskItem.cs index e5e53b3ff01..d43175b77aa 100644 --- a/src/Utilities/TaskItem.cs +++ b/src/Utilities/TaskItem.cs @@ -64,7 +64,7 @@ public sealed class TaskItem : /// Default constructor -- do not use. /// /// - /// This constructor exists only so that the type is COM-creatable. Prefer . + /// This constructor exists only so that the type is COM-creatable. Prefer . /// [EditorBrowsable(EditorBrowsableState.Never)] public TaskItem() @@ -75,14 +75,31 @@ public TaskItem() /// /// This constructor creates a new task item, given the item spec. /// - /// Assumes the itemspec passed in is escaped. + /// Assumes the itemspec passed in is escaped and represents a file path. /// The item-spec string. + public TaskItem(string itemSpec) + : this(itemSpec, treatAsFilePath: true) { } + + /// + /// This constructor creates a new task item, given the item spec. + /// + /// + /// Assumes the itemspec passed in is escaped. + /// If is set to , the value in + /// will be fixed up as a path by having any backslashes replaced with slashes. + /// + /// The item-spec string. + /// + /// Specifies whether or not to treat the value in + /// as a file path and attempt to normalize it. + /// public TaskItem( - string itemSpec) + string itemSpec, + bool treatAsFilePath) { ErrorUtilities.VerifyThrowArgumentNull(itemSpec); - _itemSpec = FileUtilities.FixFilePath(itemSpec); + _itemSpec = treatAsFilePath ? FileUtilities.FixFilePath(itemSpec) : itemSpec; } ///