diff --git a/ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs b/ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs index 2184424e3f4..1babf5ee2d4 100644 --- a/ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs +++ b/ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs @@ -682,6 +682,32 @@ public void CleanupTask(Microsoft.Build.Framework.ITask task) { } public Microsoft.Build.Framework.TaskPropertyInfo[] GetTaskParameters() { throw null; } public bool Initialize(string taskName, System.Collections.Generic.IDictionary parameterGroup, string taskBody, Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost) { throw null; } } + public partial class SGen : Microsoft.Build.Tasks.ToolTaskExtension + { + public SGen() { } + [Microsoft.Build.Framework.RequiredAttribute] + public string BuildAssemblyName { get { throw null; } set { } } + [Microsoft.Build.Framework.RequiredAttribute] + public string BuildAssemblyPath { get { throw null; } set { } } + public bool DelaySign { get { throw null; } set { } } + public string KeyContainer { get { throw null; } set { } } + public string KeyFile { get { throw null; } set { } } + public string Platform { get { throw null; } set { } } + public string[] References { get { throw null; } set { } } + public string SdkToolsPath { get { throw null; } set { } } + [Microsoft.Build.Framework.OutputAttribute] + public Microsoft.Build.Framework.ITaskItem[] SerializationAssembly { get { throw null; } set { } } + public string SerializationAssemblyName { get { throw null; } } + [Microsoft.Build.Framework.RequiredAttribute] + public bool ShouldGenerateSerializer { get { throw null; } set { } } + protected override string ToolName { get { throw null; } } + public string[] Types { get { throw null; } set { } } + public bool UseKeep { get { throw null; } set { } } + [Microsoft.Build.Framework.RequiredAttribute] + public bool UseProxyTypes { get { throw null; } set { } } + public override bool Execute() { throw null; } + protected override string GenerateFullPathToTool() { throw null; } + } public abstract partial class TaskExtension : Microsoft.Build.Utilities.Task { internal TaskExtension() { } diff --git a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj index a19d99dc303..99a093212d9 100644 --- a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj +++ b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj @@ -80,6 +80,7 @@ + @@ -126,7 +127,6 @@ - diff --git a/src/Tasks.UnitTests/SGen_Tests.cs b/src/Tasks.UnitTests/SGen_Tests.cs index 21936e6ec89..79400d3d7bb 100644 --- a/src/Tasks.UnitTests/SGen_Tests.cs +++ b/src/Tasks.UnitTests/SGen_Tests.cs @@ -7,12 +7,46 @@ using Microsoft.Build.Utilities; using Microsoft.Build.Shared; using System.IO; +using System.Linq; using Xunit; +using Xunit.Abstractions; +using Shouldly; namespace Microsoft.Build.UnitTests { public class SGen_Tests { +#if RUNTIME_TYPE_NETCORE + [Fact] + public void TaskFailsOnCore() + { + using (TestEnvironment testenv = TestEnvironment.Create()) + { + MockLogger logger = ObjectModelHelpers.BuildProjectExpectFailure(@$" + + + + +"); + logger.ErrorCount.ShouldBe(1); + logger.Errors.First().Code.ShouldBe("MSB3474"); + } + } +#else internal class SGenExtension : SGen { internal string CommandLine() @@ -56,6 +90,7 @@ public void TestKeepFlagTrue() Assert.True(commandLine.IndexOf("/keep", StringComparison.OrdinalIgnoreCase) >= 0); } + [Fact] public void TestKeepFlagFalse() { @@ -242,5 +277,6 @@ public void TestReferencesCommandLine() Assert.Equal(targetCommandLine, commandLine); } +#endif } } diff --git a/src/Tasks/Microsoft.Build.Tasks.csproj b/src/Tasks/Microsoft.Build.Tasks.csproj index 4475eb19772..3b965e74e6d 100644 --- a/src/Tasks/Microsoft.Build.Tasks.csproj +++ b/src/Tasks/Microsoft.Build.Tasks.csproj @@ -484,6 +484,9 @@ + + true + @@ -627,9 +630,6 @@ true - - true - true diff --git a/src/Tasks/Resources/Strings.resx b/src/Tasks/Resources/Strings.resx index 8c2de89cb07..cc1e2699443 100644 --- a/src/Tasks/Resources/Strings.resx +++ b/src/Tasks/Resources/Strings.resx @@ -1967,6 +1967,10 @@ MSB3473: Path for "{0}" is invalid. {1} {StrBegin="MSB3473: "} + + MSB3474: The task "{0}" is not supported on the .NET Core version of MSBuild. Use the Microsoft XML Serializer Generator package instead. See https://go.microsoft.com/fwlink/?linkid=858594 for more information. + {StrBegin="MSB3474: "} +