forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShowPreviewMessage.cs
32 lines (28 loc) · 1.13 KB
/
ShowPreviewMessage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.Framework;
using System;
namespace Microsoft.NET.Build.Tasks
{
/// <summary>
/// Provides a localizable mechanism for logging messages with different levels of importance from the SDK targets.
/// </summary>
public class ShowPreviewMessage : TaskBase
{
protected override void ExecuteCore()
{
const string previewMessageKey = "Microsoft.NET.Build.Tasks.DisplayPreviewMessageKey";
object messageDisplayed =
BuildEngine4.GetRegisteredTaskObject(previewMessageKey, RegisteredTaskObjectLifetime.Build);
if (messageDisplayed == null)
{
Log.LogMessage(MessageImportance.High, Strings.UsingPreviewSdkWarning);
BuildEngine4.RegisterTaskObject(
previewMessageKey,
new object(),
RegisteredTaskObjectLifetime.Build,
true);
}
}
}
}