From 61726ae9dfed4fa92517e95bc0b551173c5c5b05 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Tue, 10 Sep 2019 17:45:59 -0700 Subject: [PATCH 1/9] Restore test projects prior to running SDK tests (dotnet/aspnetcore-tooling#1078) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/e6bb507271f53dd8493057f0535b52b23171e66d --- .../IntegrationTests/BuildIncrementalismTest.cs | 4 ++-- .../MSBuildIntegrationTestBase.cs | 16 +--------------- .../test/IntegrationTests/PackIntegrationTest.cs | 4 ++-- src/Razor/test/testassets/Directory.Build.props | 2 ++ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIncrementalismTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIncrementalismTest.cs index d87b5642e0..d9a4cfc8e9 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIncrementalismTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIncrementalismTest.cs @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var thumbprintLookup = new Dictionary(); // Act 1 - var result = await DotnetMSBuild("Build", runRestoreBeforeBuildOrPublish: false); + var result = await DotnetMSBuild("Build"); var directoryPath = Path.Combine(result.Project.DirectoryPath, IntermediateOutputPath); var filesToIgnore = new[] @@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests // We want to make sure nothing changed between multiple incremental builds. using (var razorGenDirectoryLock = LockDirectory(RazorIntermediateOutputPath)) { - result = await DotnetMSBuild("Build", runRestoreBeforeBuildOrPublish: false); + result = await DotnetMSBuild("Build"); } Assert.BuildPassed(result); diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs index e8a001c49d..b82e000de2 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs @@ -69,8 +69,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests bool suppressTimeout = false, bool suppressBuildServer = false, string buildServerPipeName = null, - MSBuildProcessKind msBuildProcessKind = MSBuildProcessKind.Dotnet, - bool runRestoreBeforeBuildOrPublish = true) + MSBuildProcessKind msBuildProcessKind = MSBuildProcessKind.Dotnet) { var timeout = suppressTimeout ? (TimeSpan?)Timeout.InfiniteTimeSpan : null; @@ -117,23 +116,10 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests if (!string.IsNullOrEmpty(target)) { - // Restore before build or publish - if (runRestoreBeforeBuildOrPublish && - (string.Equals("Build", target, StringComparison.OrdinalIgnoreCase) - || string.Equals("Publish", target, StringComparison.OrdinalIgnoreCase))) - { - buildArgumentList.Add($"/t:Restore"); - } - buildArgumentList.Add($"/t:{target}"); } else { - // By default, restore then build - if (runRestoreBeforeBuildOrPublish) - { - buildArgumentList.Add($"/t:Restore"); - } buildArgumentList.Add($"/t:Build"); } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs index 80e404a083..f1502e0a37 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs @@ -230,10 +230,10 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [InitializeTestProject("PackageLibraryDirectDependency", additionalProjects: new[] { "PackageLibraryTransitiveDependency" })] public async Task Pack_NoBuild_IncludesStaticWebAssets() { - var result = await DotnetMSBuild("Build", runRestoreBeforeBuildOrPublish: false); + var result = await DotnetMSBuild("Build"); Assert.BuildPassed(result, allowWarnings: true); - var pack = await DotnetMSBuild("Pack", "/p:NoBuild=true", runRestoreBeforeBuildOrPublish: false); + var pack = await DotnetMSBuild("Pack", "/p:NoBuild=true"); Assert.BuildPassed(pack, allowWarnings: true); Assert.FileExists(pack, OutputPath, "PackageLibraryDirectDependency.dll"); diff --git a/src/Razor/test/testassets/Directory.Build.props b/src/Razor/test/testassets/Directory.Build.props index 1bdf3f0025..c1270c5a7f 100644 --- a/src/Razor/test/testassets/Directory.Build.props +++ b/src/Razor/test/testassets/Directory.Build.props @@ -33,6 +33,8 @@ + + OutOfProcess From 1606d9b0d308d4e348c8a4ad42bf7f7f7d662980 Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 12 Sep 2019 22:02:18 -0700 Subject: [PATCH 2/9] Support netcoreapp3.1 TFM (dotnet/aspnetcore-tooling#1122) * Support netcoreapp3.1 TFM * Update branding to preview1 * Skip failing 1.1 test \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/133b252f09e9d77608b6e0e767f299f1db1b5c64 --- .../Microsoft.AspNetCore.Razor.Tools.csproj | 2 +- ...crosoft.AspNetCore.Razor.Tools.Test.csproj | 2 +- .../src/Microsoft.NET.Sdk.Razor.csproj | 12 +++-- .../src/Microsoft.NET.Sdk.Razor.nuspec | 3 ++ ...osoft.NET.Sdk.Razor.CodeGeneration.targets | 6 +-- .../Sdk.Razor.CurrentVersion.targets | 2 +- .../test/BuildVariables.cs | 6 +-- .../IntegrationTests/BuildIntegrationTest.cs | 2 +- .../BuildIntegrationTest11.cs | 2 +- .../InitializeTestProjectAttribute.cs | 4 +- .../MSBuildIntegrationTestBase.cs | 4 +- .../IntegrationTests/PackIntegrationTest.cs | 50 ++++++++++--------- .../PublishIntegrationTest.cs | 2 +- .../test/Microsoft.NET.Sdk.Razor.Test.csproj | 4 +- ...tCore.Razor.Test.MvcShim.Version1_X.csproj | 2 +- ...tCore.Razor.Test.MvcShim.Version2_X.csproj | 2 +- ...osoft.AspNetCore.Razor.Test.MvcShim.csproj | 4 +- .../AppWithP2PReference.csproj | 4 +- .../AppWithPackageAndP2PReference.csproj | 4 +- .../ClassLibrary/ClassLibrary.csproj | 4 +- .../ClassLibrary2/ClassLibrary2.csproj | 6 +-- .../ComponentApp/ComponentApp.csproj | 2 +- .../test/testassets/Directory.Build.props | 5 +- .../test/testassets/Directory.Build.targets | 2 +- .../LargeProject/LargeProject.csproj | 6 +-- .../MvcWithComponents.csproj | 2 +- .../PackageLibraryDirectDependency.csproj | 4 +- .../RestoreTestProjects.csproj | 2 +- .../testassets/SimpleMvc/SimpleMvc.csproj | 2 +- .../SimpleMvcFSharp/SimpleMvcFSharp.fsproj | 2 +- .../testassets/SimplePages/SimplePages.csproj | 2 +- 31 files changed, 83 insertions(+), 73 deletions(-) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj index cec75baae8..d95e126d74 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj @@ -3,7 +3,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This assembly contains infrastructure supporting Razor MSBuild integration. - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) Exe rzc diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/Microsoft.AspNetCore.Razor.Tools.Test.csproj b/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/Microsoft.AspNetCore.Razor.Tools.Test.csproj index 48976ae144..8430edfc23 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/Microsoft.AspNetCore.Razor.Tools.Test.csproj +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/test/Microsoft.AspNetCore.Razor.Tools.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) $(DefaultItemExcludes);TestFiles\** diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj index 24bf87a38e..ba33b9f833 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj @@ -1,7 +1,7 @@  Razor is a markup syntax for adding server-side logic to web pages. This package contains MSBuild support for Razor. - netcoreapp3.0;net46 + $(DefaultNetCoreTargetFramework);net46 Microsoft.NET.Sdk.Razor.Tasks $(MSBuildProjectName).nuspec @@ -11,6 +11,8 @@ $(NoWarn);NU5100 + + $(NoWarn);NU5129 @@ -19,8 +21,8 @@ - - + + @@ -44,7 +46,7 @@ @@ -57,7 +59,7 @@ - + diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.nuspec b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.nuspec index 85713bd963..fc409c5e90 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.nuspec +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.nuspec @@ -2,6 +2,9 @@ $CommonMetadataElements$ + + + diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets index 52037f43c4..5cc0be05e9 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets @@ -39,7 +39,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_RazorGenerateInputsHash> <_RazorGenerateInputsHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorCoreGenerate.cache - <_RazorToolAssembly Condition="'$(_RazorToolAssembly)'==''">$(RazorSdkDirectoryRoot)tools\netcoreapp3.0\rzc.dll + <_RazorToolAssembly Condition="'$(_RazorToolAssembly)'==''">$(RazorSdkDirectoryRoot)tools\$(DefaultNetCoreTargetFramework)\rzc.dll $(MSBuildThisFileDirectory)..\..\ $(RazorSdkDirectoryRoot)tasks\ - <_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp3.0 + <_RazorSdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">$(DefaultNetCoreTargetFramework) <_RazorSdkTasksTFM Condition=" '$(_RazorSdkTasksTFM)' == ''">net46 $(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs index 2fc7b8eae6..1373497c3e 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests internal static partial class BuildVariables { private static string _msBuildPath = string.Empty; - private static string _microsoftNETCoreApp30PackageVersion = string.Empty; + private static string _microsoftNETCoreApp31PackageVersion = string.Empty; private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty; static partial void InitializeVariables(); @@ -20,12 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } } - public static string MicrosoftNETCoreApp30PackageVersion + public static string MicrosoftNETCoreApp31PackageVersion { get { InitializeVariables(); - return _microsoftNETCoreApp30PackageVersion; + return _microsoftNETCoreApp31PackageVersion; } } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs index 6acfd7c50b..6ccfae6bf0 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest.cs @@ -639,7 +639,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); } - [Fact] + [Fact(Skip = "Default C# version is 7.3 for netcoreapp3.1 and later https://github.com/aspnet/AspNetCore/issues/13930")] [InitializeTestProject("SimpleMvc")] public async Task Build_ImplicitCSharp8_NullableEnforcement_WarningsDuringBuild_NoBuildServer() { diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs index a3b255ed18..dc7d470a3c 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs @@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.BuildOutputDoesNotContainLine(result, "ProjectCapability: DotNetCoreRazorConfiguration"); } - [Fact] + [Fact (Skip = "https://github.com/aspnet/AspNetCore-Tooling/pull/1122#issuecomment-530976125")] [InitializeTestProject("SimpleMvc11")] public async Task RazorSdk_DoesNotBuildViewsForNetCoreApp11Projects() { diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs index 5dc1651e47..ebf9ddb067 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/InitializeTestProjectAttribute.cs @@ -37,8 +37,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_originalProjectName, _testProjectName, _baseDirectory, _additionalProjects, _language); -#if NETCOREAPP3_0 - MSBuildIntegrationTestBase.TargetFramework = "netcoreapp3.0"; +#if NETCOREAPP + MSBuildIntegrationTestBase.TargetFramework = "netcoreapp3.1"; #else #error Target frameworks need to be updated #endif diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs index b82e000de2..34c4b87961 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests // Let the test app know it is running as part of a test. "/p:RunningAsTest=true", - $"/p:MicrosoftNETCoreApp30PackageVersion={BuildVariables.MicrosoftNETCoreApp30PackageVersion}", + $"/p:MicrosoftNETCoreApp31PackageVersion={BuildVariables.MicrosoftNETCoreApp31PackageVersion}", $"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}", // Additional restore sources for projects that require built packages @@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests { if (!Directory.Exists(LocalNugetPackagesCacheTempPath)) { - // The local cache folder needs to exist so that nuget + // The local cache folder needs to exist so that nuget Directory.CreateDirectory(LocalNugetPackagesCacheTempPath); } } diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs index f1502e0a37..e148aa2b24 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PackIntegrationTest.cs @@ -11,6 +11,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests { public class PackIntegrationTest : MSBuildIntegrationTestBase, IClassFixture { + private static readonly string TFM = "netcoreapp3.1"; + public PackIntegrationTest(BuildServerTestFixture buildServer) : base(buildServer) { @@ -29,12 +31,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - @""); + $@""); Assert.NupkgContains( result, Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.nupkg"), - Path.Combine("contentFiles", "any", "netcoreapp3.0", "Views", "Shared", "_Layout.cshtml")); + Path.Combine("contentFiles", "any", TFM, "Views", "Shared", "_Layout.cshtml")); } [Fact] @@ -56,25 +58,25 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - $""); + $""); Assert.NuspecDoesNotContain( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - $""); + $""); } Assert.NuspecDoesNotContain( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - @""); + $@""); Assert.NupkgContains( result, Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.nupkg"), - Path.Combine("lib", "netcoreapp3.0", "ClassLibrary.Views.dll")); + Path.Combine("lib", TFM, "ClassLibrary.Views.dll")); } [Fact] @@ -94,25 +96,25 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - $""); + $""); Assert.NuspecDoesNotContain( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - $""); + $""); } Assert.NuspecDoesNotContain( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - @""); + $@""); Assert.NupkgContains( result, Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.nupkg"), - Path.Combine("lib", "netcoreapp3.0", "ClassLibrary.Views.dll")); + Path.Combine("lib", TFM, "ClassLibrary.Views.dll")); } [Fact] @@ -129,21 +131,21 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.symbols.nuspec"), - $""); + $""); Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.symbols.nuspec"), - $""); + $""); } Assert.NupkgContains( result, Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.symbols.nupkg"), - Path.Combine("lib", "netcoreapp3.0", "ClassLibrary.Views.dll"), - Path.Combine("lib", "netcoreapp3.0", "ClassLibrary.Views.pdb")); + Path.Combine("lib", TFM, "ClassLibrary.Views.dll"), + Path.Combine("lib", TFM, "ClassLibrary.Views.pdb")); } [Fact] @@ -163,19 +165,19 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - $""); + $""); Assert.NuspecContains( result, Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"), - @""); + $@""); } Assert.NupkgContains( result, Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.nupkg"), - Path.Combine("lib", "netcoreapp3.0", "ClassLibrary.Views.dll")); + Path.Combine("lib", TFM, "ClassLibrary.Views.dll")); } [Fact] diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs index cebd5de38c..037600112b 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs @@ -434,7 +434,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var result = await DotnetMSBuild("Publish", "/p:NoBuild=true"); Assert.BuildFailed(result); - Assert.BuildError(result, "MSB3030"); // Could not copy the file "obj/Debug/netcoreapp3.0/SimpleMvc.dll because it couldn't be found. + Assert.BuildError(result, "MSB3030"); // Could not copy the file "obj/Debug/netcoreapp3.1/SimpleMvc.dll because it couldn't be found. Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.dll"); Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll"); 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 9f0dab1860..0ae4b051c3 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 @@ -7,7 +7,7 @@ This is also a partial workaround for https://github.com/Microsoft/msbuild/issues/2661 - this project has netcoreapp dependencies that need to be built first. --> - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) true $(DefineConstants);PRESERVE_WORKING_DIRECTORY @@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests static partial void InitializeVariables() { _msBuildPath = @"$(_DesktopMSBuildPath)"; - _microsoftNETCoreApp30PackageVersion = "$(MicrosoftNETCoreApp30PackageVersion)"; + _microsoftNETCoreApp31PackageVersion = "$(MicrosoftNETCoreApp31PackageVersion)"; _microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)"; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj index b3c5ef2c7b..2708eb193f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj @@ -1,7 +1,7 @@ - netcoreapp3.0;net461 + $(DefaultNetCoreTargetFramework);net461 true diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj index b3c5ef2c7b..2708eb193f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X/Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj @@ -1,7 +1,7 @@ - netcoreapp3.0;net461 + $(DefaultNetCoreTargetFramework);net461 true diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.csproj index 868c485056..4b556f73e1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.csproj @@ -1,14 +1,14 @@  - netcoreapp3.0;net461 + $(DefaultNetCoreTargetFramework);net461 true - + diff --git a/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj b/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj index d5034c583f..6102fad181 100644 --- a/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj +++ b/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj @@ -1,11 +1,11 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj b/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj index 076d9b77b0..730b0e4988 100644 --- a/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj +++ b/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj @@ -1,11 +1,11 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) $(MSBuildThisFileDirectory)..\TestPackageRestoreSource\ $(RestoreSources); diff --git a/src/Razor/test/testassets/ClassLibrary/ClassLibrary.csproj b/src/Razor/test/testassets/ClassLibrary/ClassLibrary.csproj index 57ca5669a8..87ec461496 100644 --- a/src/Razor/test/testassets/ClassLibrary/ClassLibrary.csproj +++ b/src/Razor/test/testassets/ClassLibrary/ClassLibrary.csproj @@ -1,5 +1,5 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ @@ -9,7 +9,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) © Microsoft Razor Test Microsoft diff --git a/src/Razor/test/testassets/ClassLibrary2/ClassLibrary2.csproj b/src/Razor/test/testassets/ClassLibrary2/ClassLibrary2.csproj index 8ba54d6c98..0a331a69c0 100644 --- a/src/Razor/test/testassets/ClassLibrary2/ClassLibrary2.csproj +++ b/src/Razor/test/testassets/ClassLibrary2/ClassLibrary2.csproj @@ -1,11 +1,11 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) true @@ -13,7 +13,7 @@ false - + diff --git a/src/Razor/test/testassets/ComponentApp/ComponentApp.csproj b/src/Razor/test/testassets/ComponentApp/ComponentApp.csproj index 68b1028aa0..488b36eb48 100644 --- a/src/Razor/test/testassets/ComponentApp/ComponentApp.csproj +++ b/src/Razor/test/testassets/ComponentApp/ComponentApp.csproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/Directory.Build.props b/src/Razor/test/testassets/Directory.Build.props index c1270c5a7f..fb8728a71e 100644 --- a/src/Razor/test/testassets/Directory.Build.props +++ b/src/Razor/test/testassets/Directory.Build.props @@ -18,7 +18,7 @@ $(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.props $(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets - + $(RestoreSources); @@ -38,6 +38,9 @@ OutOfProcess + + + $(NoWarn);NU5131 diff --git a/src/Razor/test/testassets/Directory.Build.targets b/src/Razor/test/testassets/Directory.Build.targets index 39f4f47645..4e299bd016 100644 --- a/src/Razor/test/testassets/Directory.Build.targets +++ b/src/Razor/test/testassets/Directory.Build.targets @@ -2,7 +2,7 @@ - $(MicrosoftNETCoreApp30PackageVersion) + $(MicrosoftNETCoreApp31PackageVersion) 99.9 diff --git a/src/Razor/test/testassets/LargeProject/LargeProject.csproj b/src/Razor/test/testassets/LargeProject/LargeProject.csproj index b2b6b1019a..109a8d32bc 100644 --- a/src/Razor/test/testassets/LargeProject/LargeProject.csproj +++ b/src/Razor/test/testassets/LargeProject/LargeProject.csproj @@ -17,7 +17,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) @@ -33,8 +33,8 @@ - + - + diff --git a/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj b/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj index 31429c409f..c16ec85c0b 100644 --- a/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj +++ b/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/PackageLibraryDirectDependency/PackageLibraryDirectDependency.csproj b/src/Razor/test/testassets/PackageLibraryDirectDependency/PackageLibraryDirectDependency.csproj index eacc72651e..8bebdb3285 100644 --- a/src/Razor/test/testassets/PackageLibraryDirectDependency/PackageLibraryDirectDependency.csproj +++ b/src/Razor/test/testassets/PackageLibraryDirectDependency/PackageLibraryDirectDependency.csproj @@ -1,5 +1,5 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ @@ -9,7 +9,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) © Microsoft Razor Test Microsoft diff --git a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj index b7ae27c5e0..ced12b1fa3 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -1,6 +1,6 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj b/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj index 1cde2c2ba5..5a395f6802 100644 --- a/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj +++ b/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj b/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj index 611e331385..ef683132a5 100644 --- a/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj +++ b/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) diff --git a/src/Razor/test/testassets/SimplePages/SimplePages.csproj b/src/Razor/test/testassets/SimplePages/SimplePages.csproj index 1cde2c2ba5..5a395f6802 100644 --- a/src/Razor/test/testassets/SimplePages/SimplePages.csproj +++ b/src/Razor/test/testassets/SimplePages/SimplePages.csproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) From a2081d584f4b2a0694a88132214df429513a1d26 Mon Sep 17 00:00:00 2001 From: John Luo Date: Sun, 15 Sep 2019 08:05:47 -0700 Subject: [PATCH 3/9] Fix razor tool assembly path (dotnet/aspnetcore-tooling#1138) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/88cd749f381e5b02e5ed3dd0d9c24f2272fea816 --- .../Microsoft.NET.Sdk.Razor.CodeGeneration.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets index 5cc0be05e9..25ea86a65d 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets @@ -39,7 +39,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_RazorGenerateInputsHash> <_RazorGenerateInputsHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorCoreGenerate.cache - <_RazorToolAssembly Condition="'$(_RazorToolAssembly)'==''">$(RazorSdkDirectoryRoot)tools\$(DefaultNetCoreTargetFramework)\rzc.dll + <_RazorToolAssembly Condition="'$(_RazorToolAssembly)'==''">$(RazorSdkDirectoryRoot)tools\netcoreapp3.1\rzc.dll @@ -112,4 +122,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests + + + + From dfbb36ee1011a3ff58bcb7cab04f6537e56758b6 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Fri, 20 Sep 2019 11:09:22 +0200 Subject: [PATCH 5/9] [Infrastructure] Fix invalid variable names ProcDumpPath -> ProcDumpToolPath _BuildConfiguration -> _BuildConfig\n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/f283e4a7c0d47054c9a178ff0b29f00e68f307d3 --- .../test/IntegrationTests/MSBuildProcessManager.cs | 2 +- .../test/Microsoft.NET.Sdk.Razor.Test.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs index 50bdadf639..97000aa280 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs @@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests .GetCustomAttributes(); var procDumpPath = metadataAttributes - .SingleOrDefault(ama => ama.Key == "ProcDumpPath")?.Value; + .SingleOrDefault(ama => ama.Key == "ProcDumpToolPath")?.Value; if (string.IsNullOrEmpty(procDumpPath)) { 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 e99c60292c..0efaf7b8fd 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 @@ -45,7 +45,7 @@ <_Parameter1>ArtifactsLogDir - <_Parameter2>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log', '$(_BuildConfiguration)')) + <_Parameter2>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log', '$(_BuildConfig)')) @@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests - + From 66f2aac299a0f52148c9a4dee56c9dcb06bab15d Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 10 Sep 2019 13:37:39 -0700 Subject: [PATCH 6/9] Integrate Razor LanguageServer (without plugin) into src/Razor. - Added tests for both the language server and the common language server projects. - Updated publish MSBuild bits to publish to `artifacts/LanguageServer/$(Configuration)/TFM` - Updated the language server to be netcoreapp3.0 aspnet/AspNetCoredotnet/aspnetcore-tooling#13494 \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/984c638b37579a4ecdca4abe48fdf59e1f21ac51 --- .../src/DefaultRazorIntermediateNodeLoweringPhase.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorIntermediateNodeLoweringPhase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorIntermediateNodeLoweringPhase.cs index f3180eb618..2e8a0368a7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorIntermediateNodeLoweringPhase.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorIntermediateNodeLoweringPhase.cs @@ -1099,8 +1099,6 @@ namespace Microsoft.AspNetCore.Razor.Language if (node.Source != null) { - Debug.Assert(node.Source.Value.FilePath != null); - node.Source = new SourceSpan( node.Source.Value.FilePath, node.Source.Value.AbsoluteIndex, From 5bb36d86f1f8cbcef832f02c671a863288ea47cf Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 12 Sep 2019 14:27:54 -0700 Subject: [PATCH 7/9] Integrate Razor VSCode extension functional tests into src/Razor. - Added the `.vscode-test` to `.gitignore` because that's the VSCode folder that gets created when dynamically downloading VSCode for CI purposes. - Migrated functional tests to use the non-deprecated VSCode functional testing APIs. This involved creating a runTest file to control downloading VSCode and passing in appropriate parameters as well as creating an index that discovers tests that should be run. - Changed functional tests to operate on the existing Razor testapps (instead of the old ones). - Updated the "default" completion tests to be latest Razor/Blazor. - Added VSCode launch configurations to enable easy debugging via F5. aspnet/AspNetCoredotnet/aspnetcore-tooling#13494 \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/66e4e8a16917a3b986b92d07b054d8f34bf3a979 --- .../test/testassets/MvcWithComponents/Views/Home/Index.cshtml | 2 +- .../test/testassets/MvcWithComponents/Views/_ViewImports.cshtml | 1 + src/Razor/test/testassets/SimpleMvc/Views/_ViewImports.cshtml | 1 + src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml | 1 + src/Razor/test/testassets/SimpleMvc21/Views/_ViewImports.cshtml | 1 + src/Razor/test/testassets/SimpleMvc22/Views/_ViewImports.cshtml | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Razor/test/testassets/MvcWithComponents/Views/Home/Index.cshtml b/src/Razor/test/testassets/MvcWithComponents/Views/Home/Index.cshtml index 8832e1ad15..b824f4e3e8 100644 --- a/src/Razor/test/testassets/MvcWithComponents/Views/Home/Index.cshtml +++ b/src/Razor/test/testassets/MvcWithComponents/Views/Home/Index.cshtml @@ -2,4 +2,4 @@ ViewData["Title"] = "Home Page"; } -Hello world! \ No newline at end of file +Hello world! diff --git a/src/Razor/test/testassets/MvcWithComponents/Views/_ViewImports.cshtml b/src/Razor/test/testassets/MvcWithComponents/Views/_ViewImports.cshtml index 7e47b2893e..b570117928 100644 --- a/src/Razor/test/testassets/MvcWithComponents/Views/_ViewImports.cshtml +++ b/src/Razor/test/testassets/MvcWithComponents/Views/_ViewImports.cshtml @@ -1,3 +1,4 @@ @using MvcWithComponents @using MvcWithComponents.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc/Views/_ViewImports.cshtml index da00289ea5..26ba8ed20e 100644 --- a/src/Razor/test/testassets/SimpleMvc/Views/_ViewImports.cshtml +++ b/src/Razor/test/testassets/SimpleMvc/Views/_ViewImports.cshtml @@ -1,3 +1,4 @@ @using SimpleMvc @using SimpleMvc.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml index ab07b6cfbc..4d7ce82c24 100644 --- a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml +++ b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml @@ -1,2 +1,3 @@ @using SimpleMvc11 @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc21/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc21/Views/_ViewImports.cshtml index 477d4ba603..c8d7fa63cc 100644 --- a/src/Razor/test/testassets/SimpleMvc21/Views/_ViewImports.cshtml +++ b/src/Razor/test/testassets/SimpleMvc21/Views/_ViewImports.cshtml @@ -2,3 +2,4 @@ @using SimpleMvc.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @namespace SimpleMvc21 +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc22/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc22/Views/_ViewImports.cshtml index 477d4ba603..c8d7fa63cc 100644 --- a/src/Razor/test/testassets/SimpleMvc22/Views/_ViewImports.cshtml +++ b/src/Razor/test/testassets/SimpleMvc22/Views/_ViewImports.cshtml @@ -2,3 +2,4 @@ @using SimpleMvc.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @namespace SimpleMvc21 +@inject DateTime TheTime From f6c5aa73c107bed4688e330fad3edc385f74ed58 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Wed, 25 Sep 2019 18:11:35 +0200 Subject: [PATCH 8/9] Capture process dumps for child dotnet processes (dotnet/aspnetcore-tooling#1170) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/e283d0be151cff29ba2498d930f8b4bae849dc9d --- .../IntegrationTests/MSBuildProcessManager.cs | 74 +++++++++++++++---- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs index 97000aa280..d5d9ee61de 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs @@ -76,6 +76,9 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var output = new StringBuilder(); var outputLock = new object(); + var diagnostics = new StringBuilder(); + diagnostics.AppendLine("Process execution diagnostics:"); + process.ErrorDataReceived += Process_ErrorDataReceived; process.OutputDataReceived += Process_OutputDataReceived; @@ -83,7 +86,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests process.BeginOutputReadLine(); process.BeginErrorReadLine(); - var timeoutTask = GetTimeoutForProcess(process, timeout); + var timeoutTask = GetTimeoutForProcess(process, timeout, diagnostics); var waitTask = Task.Run(() => { @@ -100,10 +103,19 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests process.WaitForExit(); + string outputString; lock (outputLock) { - outputString = output.ToString(); + // This marks the end of the diagnostic info which we collect when something goes wrong. + diagnostics.AppendLine("Process output:"); + + // Expected output + // Process execution diagnostics: + // ... + // Process output: + outputString = diagnostics.ToString(); + outputString += output.ToString(); } var result = new ProcessResult(process.StartInfo.FileName, process.StartInfo.Arguments, process.ExitCode, outputString); @@ -128,7 +140,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } } - async Task GetTimeoutForProcess(Process process, TimeSpan? timeout) + async Task GetTimeoutForProcess(Process process, TimeSpan? timeout, StringBuilder diagnostics) { await Task.Delay(timeout.Value); @@ -139,12 +151,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } if (!process.HasExited) { - var procDumpProcess = await CaptureDump(process); - if (procDumpProcess != null && procDumpProcess.HasExited) - { - Console.WriteLine("ProcDump failed to run."); - procDumpProcess.Kill(); - } + await CollectDumps(process, timeout, diagnostics); // This is a timeout. process.Kill(); @@ -153,7 +160,46 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {timeout}. Output: {output.ToString()}"); } - async Task CaptureDump(Process process) + static async Task CollectDumps(Process process, TimeSpan? timeout, StringBuilder diagnostics) + { + var procDumpProcess = await CaptureDump(process, timeout, diagnostics); + var allDotNetProcesses = Process.GetProcessesByName("dotnet"); + + var allDotNetChildProcessCandidates = allDotNetProcesses + .Where(p => p.StartTime >= process.StartTime && p.Id != process.Id); + + if (!allDotNetChildProcessCandidates.Any()) + { + diagnostics.AppendLine("Couldn't find any candidate child process."); + foreach (var dotnetProcess in allDotNetProcesses) + { + diagnostics.AppendLine($"Found dotnet process with PID {dotnetProcess.Id} and start time {dotnetProcess.StartTime}."); + } + } + + foreach (var childProcess in allDotNetChildProcessCandidates) + { + diagnostics.AppendLine($"Found child process candidate '{childProcess.Id}'."); + } + + var childrenProcessDumpProcesses = await Task.WhenAll(allDotNetChildProcessCandidates.Select(d => CaptureDump(d, timeout, diagnostics))); + foreach (var childProcess in childrenProcessDumpProcesses) + { + if (childProcess != null && childProcess.HasExited) + { + diagnostics.AppendLine($"ProcDump failed to run for child dotnet process candidate '{process.Id}'."); + childProcess.Kill(); + } + } + + if (procDumpProcess != null && procDumpProcess.HasExited) + { + diagnostics.AppendLine($"ProcDump failed to run for '{process.Id}'."); + procDumpProcess.Kill(); + } + } + + static async Task CaptureDump(Process process, TimeSpan? timeout, StringBuilder diagnostics) { var metadataAttributes = Assembly.GetExecutingAssembly() .GetCustomAttributes(); @@ -163,13 +209,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests if (string.IsNullOrEmpty(procDumpPath)) { - Console.WriteLine("ProcDumpPath not defined."); + diagnostics.AppendLine("ProcDumpPath not defined."); return null; } var procDumpExePath = Path.Combine(procDumpPath, "procdump.exe"); if (!File.Exists(procDumpExePath)) { - Console.WriteLine($"Can't find procdump.exe in '{procDumpPath}'."); + diagnostics.AppendLine($"Can't find procdump.exe in '{procDumpPath}'."); return null; } @@ -178,13 +224,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests if (string.IsNullOrEmpty(dumpDirectory)) { - Console.WriteLine("ArtifactsLogDir not defined."); + diagnostics.AppendLine("ArtifactsLogDir not defined."); return null; } if (!Directory.Exists(dumpDirectory)) { - Console.WriteLine($"'{dumpDirectory}' does not exist."); + diagnostics.AppendLine($"'{dumpDirectory}' does not exist."); return null; } From c05fca5137e11edd9fc74e0b3c6336473807425e Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Wed, 25 Sep 2019 10:50:13 -0700 Subject: [PATCH 9/9] Remove 1.x tests (dotnet/aspnetcore-tooling#1169) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/bd71bcf87b1c9a9401454c2df9ebed1f8157f91e --- .../BuildIntegrationTest11.cs | 58 ---------- .../RestoreTestProjects.csproj | 2 - .../test/testassets/SimpleMvc11/Program.cs | 13 --- .../testassets/SimpleMvc11/SimpleMvc11.csproj | 23 ---- .../SimpleMvc11/Views/Home/Index.cshtml | 108 ------------------ .../SimpleMvc11/Views/Shared/_Layout.cshtml | 71 ------------ .../SimpleMvc11/Views/_ViewImports.cshtml | 3 - .../SimpleMvc11/Views/_ViewStart.cshtml | 3 - .../testassets/SimpleMvc11NetFx/Program.cs | 13 --- .../SimpleMvc11NetFx/SimpleMvc11NetFx.csproj | 19 --- .../SimpleMvc11NetFx/Views/Home/Index.cshtml | 108 ------------------ .../Views/Shared/_Layout.cshtml | 71 ------------ .../Views/_ViewImports.cshtml | 2 - .../SimpleMvc11NetFx/Views/_ViewStart.cshtml | 3 - 14 files changed, 497 deletions(-) delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs delete mode 100644 src/Razor/test/testassets/SimpleMvc11/Program.cs delete mode 100644 src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj delete mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml delete mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs deleted file mode 100644 index dc7d470a3c..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs +++ /dev/null @@ -1,58 +0,0 @@ -// 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 (Skip = "https://github.com/aspnet/AspNetCore-Tooling/pull/1122#issuecomment-530976125")] - [InitializeTestProject("SimpleMvc11")] - public async Task RazorSdk_DoesNotBuildViewsForNetCoreApp11Projects() - { - MSBuildIntegrationTestBase.TargetFramework = "netcoreapp1.1"; - var result = await DotnetMSBuild("Build"); - - Assert.BuildPassed(result); - 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/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj index ced12b1fa3..90b54c171b 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -4,8 +4,6 @@ - - diff --git a/src/Razor/test/testassets/SimpleMvc11/Program.cs b/src/Razor/test/testassets/SimpleMvc11/Program.cs deleted file mode 100644 index 5fbbd9ded7..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ - -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 deleted file mode 100644 index b1523f9512..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - 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 deleted file mode 100644 index 00afab6a0c..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml +++ /dev/null @@ -1,108 +0,0 @@ -@{ - 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 deleted file mode 100644 index 2172e5e566..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - @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 deleted file mode 100644 index 4d7ce82c24..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@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 deleted file mode 100644 index a5f10045db..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "_Layout"; -} diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs b/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs deleted file mode 100644 index 5fbbd9ded7..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ - -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 deleted file mode 100644 index b280ec0c9c..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - net461 - - - - - - - - - diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml deleted file mode 100644 index 00afab6a0c..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml +++ /dev/null @@ -1,108 +0,0 @@ -@{ - 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 deleted file mode 100644 index 2172e5e566..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - @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 deleted file mode 100644 index 6f6d009d40..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml +++ /dev/null @@ -1,2 +0,0 @@ -@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 deleted file mode 100644 index a5f10045db..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "_Layout"; -}