From 33815f75c92b7f460189ed05069c64793cc9479f Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 29 May 2019 17:45:45 -0700 Subject: [PATCH] Remove Windows Desktop project templates for non-Windows. This commit removes the Windows Desktop project templates for non-Windows builds of the .NET Core SDK. Fixes dotnet/cli#11425. --- src/redist/targets/BundledTemplates.targets | 5 ++++ test/EndToEnd/GivenUnixPlatform.cs | 29 +++++++++++++++++++ .../UnixOnlyTheoryAttribute.cs | 19 ++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 test/EndToEnd/GivenUnixPlatform.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyTheoryAttribute.cs diff --git a/src/redist/targets/BundledTemplates.targets b/src/redist/targets/BundledTemplates.targets index 7a3502743..28e7f1f75 100644 --- a/src/redist/targets/BundledTemplates.targets +++ b/src/redist/targets/BundledTemplates.targets @@ -26,6 +26,11 @@ + + + + + diff --git a/test/EndToEnd/GivenUnixPlatform.cs b/test/EndToEnd/GivenUnixPlatform.cs new file mode 100644 index 000000000..83e377f7a --- /dev/null +++ b/test/EndToEnd/GivenUnixPlatform.cs @@ -0,0 +1,29 @@ +using System; +using System.IO; +using System.Linq; +using System.Xml.Linq; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace EndToEnd.Tests +{ + public class GivenUnixPlatform : TestBase + { + [UnixOnlyTheory] + [InlineData("wpf")] + [InlineData("winforms")] + public void ItDoesNotIncludeWindowsOnlyProjectTemplates(string template) + { + var directory = TestAssets.CreateTestDirectory(); + + new NewCommandShim() + .WithWorkingDirectory(directory.FullName) + .Execute(template) + .Should() + .Fail() + .And + .HaveStdErrContaining($": {template}."); + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyTheoryAttribute.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyTheoryAttribute.cs new file mode 100644 index 000000000..fe0557b88 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyTheoryAttribute.cs @@ -0,0 +1,19 @@ +// 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.DotNet.PlatformAbstractions; +using Xunit; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public class UnixOnlyTheoryAttribute : TheoryAttribute + { + public UnixOnlyTheoryAttribute() + { + if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) + { + this.Skip = "This test requires Unix to run"; + } + } + } +}