diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs new file mode 100644 index 0000000000..eb15dbb44a --- /dev/null +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs @@ -0,0 +1,58 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests +{ + public class BuildIntegrationTest11 : MSBuildIntegrationTestBase, IClassFixture + { + public BuildIntegrationTest11(BuildServerTestFixture buildServer) + : base(buildServer) + { + } + + [Fact] + [InitializeTestProject("SimpleMvc11")] + public async Task RazorSdk_DoesNotAddCoreRazorConfigurationTo11Projects() + { + var result = await DotnetMSBuild("_IntrospectProjectCapabilityItems"); + + Assert.BuildPassed(result); + Assert.BuildOutputContainsLine(result, "ProjectCapability: DotNetCoreRazor"); + Assert.BuildOutputDoesNotContainLine(result, "ProjectCapability: DotNetCoreRazorConfiguration"); + } + + [Fact] + [InitializeTestProject("SimpleMvc11")] + public async Task RazorSdk_DoesNotBuildViewsForNetCoreApp11Projects() + { + MSBuildIntegrationTestBase.TargetFramework = "netcoreapp1.1"; + var result = await DotnetMSBuild("Build"); + + Assert.BuildPassed(result, allowWarnings: true); + Assert.FileExists(result, OutputPath, "SimpleMvc11.dll"); + Assert.FileExists(result, OutputPath, "SimpleMvc11.pdb"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11.Views.dll"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11.Views.pdb"); + } + + [ConditionalFact] + [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] + + [InitializeTestProject("SimpleMvc11NetFx")] + public async Task RazorSdk_DoesNotBuildViewsForNetFx11Projects() + { + MSBuildIntegrationTestBase.TargetFramework = "net461"; + var result = await DotnetMSBuild("Build"); + + Assert.BuildPassed(result); + Assert.FileExists(result, OutputPath, "SimpleMvc11NetFx.exe"); + Assert.FileExists(result, OutputPath, "SimpleMvc11NetFx.pdb"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11NetFx.Views.dll"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11NetFx.Views.pdb"); + } + } +} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj index 9c5a38e1df..0bba7a6407 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj @@ -125,6 +125,14 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests + + + + netcoreapp1.1 + net461 + + + diff --git a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj index 3d29b2038c..ab772a0f92 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -4,6 +4,7 @@ + diff --git a/src/Razor/test/testassets/SimpleMvc11/Program.cs b/src/Razor/test/testassets/SimpleMvc11/Program.cs new file mode 100644 index 0000000000..5fbbd9ded7 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Program.cs @@ -0,0 +1,13 @@ + +namespace SimpleMvc11 +{ + public class Program + { + public static void Main(string[] args) + { + // Just make sure we have a reference to MVC 1.1 + var t = typeof(Microsoft.AspNetCore.Mvc.IActionResult); + System.Console.WriteLine(t.FullName); + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj b/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj new file mode 100644 index 0000000000..b1523f9512 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj @@ -0,0 +1,23 @@ + + + + + + + netcoreapp1.1 + + + + + + + + + All + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml new file mode 100644 index 0000000000..00afab6a0c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml @@ -0,0 +1,108 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..2172e5e566 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml @@ -0,0 +1,71 @@ + + + + + + @ViewData["Title"] - SimpleMvc11 + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2018 - SimpleMvc11

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..4d7ce82c24 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using SimpleMvc11 +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs b/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs new file mode 100644 index 0000000000..5fbbd9ded7 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs @@ -0,0 +1,13 @@ + +namespace SimpleMvc11 +{ + public class Program + { + public static void Main(string[] args) + { + // Just make sure we have a reference to MVC 1.1 + var t = typeof(Microsoft.AspNetCore.Mvc.IActionResult); + System.Console.WriteLine(t.FullName); + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj b/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj new file mode 100644 index 0000000000..b280ec0c9c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj @@ -0,0 +1,19 @@ + + + + + + + net461 + + + + + + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml new file mode 100644 index 0000000000..00afab6a0c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml @@ -0,0 +1,108 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..2172e5e566 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml @@ -0,0 +1,71 @@ + + + + + + @ViewData["Title"] - SimpleMvc11 + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2018 - SimpleMvc11

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..6f6d009d40 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using SimpleMvc11NetFx +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +}