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, 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 381d0011fa..9c811eb9c2 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 @@ -10,7 +10,9 @@ - $(NoWarn);NU5100;NU5129 + $(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/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..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\netcoreapp3.0\rzc.dll + <_RazorToolAssembly Condition="'$(_RazorToolAssembly)'==''">$(RazorSdkDirectoryRoot)tools\netcoreapp3.1\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 deleted file mode 100644 index a3b255ed18..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] - [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/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/MSBuildProcessManager.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildProcessManager.cs index de81c1f049..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,22 +86,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests process.BeginOutputReadLine(); process.BeginErrorReadLine(); - var timeoutTask = Task.Delay(timeout.Value).ContinueWith((t) => - { - // Don't timeout during debug sessions - while (Debugger.IsAttached) - { - Thread.Sleep(TimeSpan.FromSeconds(1)); - } - - if (!process.HasExited) - { - // This is a timeout. - process.Kill(); - } - - throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {timeout}. Output: {output.ToString()}"); - }); + var timeoutTask = GetTimeoutForProcess(process, timeout, diagnostics); var waitTask = Task.Run(() => { @@ -115,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); @@ -142,6 +139,121 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests output.AppendLine(e.Data); } } + + async Task GetTimeoutForProcess(Process process, TimeSpan? timeout, StringBuilder diagnostics) + { + await Task.Delay(timeout.Value); + + // Don't timeout during debug sessions + while (Debugger.IsAttached) + { + Thread.Sleep(TimeSpan.FromSeconds(1)); + } + if (!process.HasExited) + { + await CollectDumps(process, timeout, diagnostics); + + // This is a timeout. + process.Kill(); + } + + throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {timeout}. Output: {output.ToString()}"); + } + + 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(); + + var procDumpPath = metadataAttributes + .SingleOrDefault(ama => ama.Key == "ProcDumpToolPath")?.Value; + + if (string.IsNullOrEmpty(procDumpPath)) + { + diagnostics.AppendLine("ProcDumpPath not defined."); + return null; + } + var procDumpExePath = Path.Combine(procDumpPath, "procdump.exe"); + if (!File.Exists(procDumpExePath)) + { + diagnostics.AppendLine($"Can't find procdump.exe in '{procDumpPath}'."); + return null; + } + + var dumpDirectory = metadataAttributes + .SingleOrDefault(ama => ama.Key == "ArtifactsLogDir")?.Value; + + if (string.IsNullOrEmpty(dumpDirectory)) + { + diagnostics.AppendLine("ArtifactsLogDir not defined."); + return null; + } + + if (!Directory.Exists(dumpDirectory)) + { + diagnostics.AppendLine($"'{dumpDirectory}' does not exist."); + return null; + } + + var procDumpPattern = Path.Combine(dumpDirectory, "HangingProcess_PROCESSNAME_PID_YYMMDD_HHMMSS.dmp"); + var procDumpStartInfo = new ProcessStartInfo( + procDumpExePath, + $"-accepteula -ma {process.Id} {procDumpPattern}") + { + CreateNoWindow = true, + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true + }; + + var procDumpProcess = Process.Start(procDumpStartInfo); + var tcs = new TaskCompletionSource(); + + procDumpProcess.Exited += (s, a) => tcs.TrySetResult(null); + procDumpProcess.EnableRaisingEvents = true; + + await Task.WhenAny(tcs.Task, Task.Delay(timeout ?? TimeSpan.FromSeconds(30))); + return procDumpProcess; + } } internal class ProcessResult 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..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 @@ -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 @@ -43,6 +43,16 @@ <_Parameter2>$(MSBuildThisFileDirectory)..\testapps\TestPackageRestoreSource + + <_Parameter1>ArtifactsLogDir + <_Parameter2>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log', '$(_BuildConfig)')) + + + + <_Parameter1>ProcDumpToolPath + <_Parameter2>$(ProcDumpPath) + + @@ -86,7 +96,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests static partial void InitializeVariables() { _msBuildPath = @"$(_DesktopMSBuildPath)"; - _microsoftNETCoreApp30PackageVersion = "$(MicrosoftNETCoreApp30PackageVersion)"; + _microsoftNETCoreApp31PackageVersion = "$(MicrosoftNETCoreApp31PackageVersion)"; _microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)"; } } @@ -112,4 +122,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests + + + + 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 1bc4281ac7..f92a85eee6 100644 --- a/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj +++ b/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj @@ -5,7 +5,7 @@ - netcoreapp3.0 + $(DefaultNetCoreTargetFramework) $(MSBuildThisFileDirectory)..\TestPackageRestoreSource\ $(RestoreAdditionalProjectSources);$(RuntimeAdditionalRestoreSources) 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 5d13eb6e52..9515093308 100644 --- a/src/Razor/test/testassets/Directory.Build.props +++ b/src/Razor/test/testassets/Directory.Build.props @@ -25,6 +25,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/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/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..90b54c171b 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -1,11 +1,9 @@ - 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/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/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 ab07b6cfbc..0000000000 --- a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml +++ /dev/null @@ -1,2 +0,0 @@ -@using SimpleMvc11 -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 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"; -} 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 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)