diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 66087e2ef6..f092a992e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,9 +37,9 @@ jobs: pool: # agent pool can't be read from a user-defined variable (Azure DevOps limitation) ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: - name: dotnet-external-temp + name: dotnet-external-temp-vs2019 ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - name: dotnet-internal-temp + name: dotnet-internal-temp-vs2019 strategy: matrix: debug: diff --git a/global.json b/global.json index 14e76b587c..97ecf837f5 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "3.0.100-preview-009812", + "dotnet": "3.0.100-preview-010184", "vs": { "version": "15.9", "components": [ @@ -9,7 +9,7 @@ } }, "sdk": { - "version": "3.0.100-preview-009812" + "version": "3.0.100-preview-010184" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19108.1" diff --git a/src/Razor/Razor.Slim.sln b/src/Razor/Razor.Slim.sln index 669dc1f7f1..6fbbc1598e 100644 --- a/src/Razor/Razor.Slim.sln +++ b/src/Razor/Razor.Slim.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28410.60 -MinimumVisualStudioVersion = 15.0.26730.03 +MinimumVisualStudioVersion = 16.0.0.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}" ProjectSection(SolutionItems) = preProject src\Directory.Build.props = src\Directory.Build.props diff --git a/src/Razor/Razor.sln b/src/Razor/Razor.sln index 25bce58253..1dedb586c4 100644 --- a/src/Razor/Razor.sln +++ b/src/Razor/Razor.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28410.60 -MinimumVisualStudioVersion = 15.0.26730.03 +MinimumVisualStudioVersion = 16.0.0.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}" ProjectSection(SolutionItems) = preProject src\Directory.Build.props = src\Directory.Build.props diff --git a/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props index aa0a8da485..4d60b543ae 100644 --- a/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props +++ b/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props @@ -42,14 +42,6 @@ Copyright (c) .NET Foundation. All rights reserved. --> false - - false - .g.cs + true + + + false diff --git a/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets index e148904829..ffb77fce72 100644 --- a/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets +++ b/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets @@ -174,8 +174,14 @@ Copyright (c) .NET Foundation. All rights reserved. false true - false - true + + $(CopyRefAssembliesToPublishDirectory) + + false + true + + + true + + @@ -711,21 +727,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - - - - $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES - netstandard2.0 + netstandard2.0;net461 diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs index a3ae5fbed3..920fd2566e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs @@ -32,6 +32,7 @@ namespace Microsoft.CodeAnalysis private static IEnumerable ResolvePaths(CompilationLibrary library) { +#if NETFRAMEWORK var assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (var i = 0; i < assemblies.Length; i++) { @@ -40,6 +41,7 @@ namespace Microsoft.CodeAnalysis return new[] { assemblies[i].Location }; } } +#endif try { diff --git a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest.cs b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest.cs index 5c0562d7dc..d430c85650 100644 --- a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest.cs +++ b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest.cs @@ -235,7 +235,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [Fact] [InitializeTestProject("SimpleMvc")] - public async Task Build_WithViews_ProducesDepsFileWithCompilationContext() + public async Task Build_WithViews_ProducesDepsFileWithCompilationContext_ButNoReferences() { var customDefine = "RazorSdkTest"; var result = await DotnetMSBuild("Build", $"/p:DefineConstants={customDefine}"); @@ -247,13 +247,16 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var dependencyContext = ReadDependencyContext(depsFilePath); // Pick a couple of libraries and ensure they have some compile references - var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "Microsoft.NETCore.App"); + var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "System.Diagnostics.DiagnosticSource"); Assert.NotEmpty(packageReference.Assemblies); var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc"); Assert.NotEmpty(projectReference.Assemblies); Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines); + + // Verify no refs folder is produced + Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll"); } [Fact] diff --git a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest21.cs b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest21.cs index ee221c6022..061399ddfc 100644 --- a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest21.cs +++ b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/BuildIntegrationTest21.cs @@ -37,5 +37,25 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Path.Combine(IntermediateOutputPath, "SimpleMvc21.TagHelpers.output.cache"), @"""Name"":""SimpleMvc.SimpleTagHelper"""); } + + [Fact] + [InitializeTestProject("SimpleMvc21")] + public async Task Publish_NETCoreApp21TargetingProject() + { + TargetFramework = "netcoreapp2.1"; + + var result = await DotnetMSBuild("Publish"); + + Assert.BuildPassed(result); + + Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.dll"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.pdb"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.Views.dll"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.Views.pdb"); + + // By default refs and .cshtml files will not be copied on publish + Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll"); + Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml"); + } } } diff --git a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/PublishIntegrationTest.cs index 7734f7dc16..52a0582328 100644 --- a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/PublishIntegrationTest.cs +++ b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests/PublishIntegrationTest.cs @@ -247,6 +247,30 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml"); } + [Fact] + [InitializeTestProject("SimpleMvc")] + public async Task Publish_WithCopySettingsInProjectFile_CopiesFiles() + { + AddProjectFileContent(@" + + true + true + "); + + var result = await DotnetMSBuild("Publish"); + + Assert.BuildPassed(result); + + Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.dll"); + Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.pdb"); + + // By default refs and .cshtml files will not be copied on publish + Assert.FileExists(result, PublishOutputPath, "refs", "mscorlib.dll"); + Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml"); + } + [Fact] // Tests old MvcPrecompilation behavior that we support for compat. [InitializeTestProject("SimpleMvc")] public async Task Publish_MvcRazorExcludeFilesFromPublish_False_CopiesFiles() diff --git a/src/Razor/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj b/src/Razor/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj index bbd86a5772..9386f89689 100644 --- a/src/Razor/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj +++ b/src/Razor/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Razor/test/testapps/LargeProject/LargeProject.csproj b/src/Razor/test/testapps/LargeProject/LargeProject.csproj index 0581e93450..8e8dea1809 100644 --- a/src/Razor/test/testapps/LargeProject/LargeProject.csproj +++ b/src/Razor/test/testapps/LargeProject/LargeProject.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Razor/test/testapps/MvcWithComponents/MvcWithComponents.csproj b/src/Razor/test/testapps/MvcWithComponents/MvcWithComponents.csproj index d89f94bc3e..523061d189 100644 --- a/src/Razor/test/testapps/MvcWithComponents/MvcWithComponents.csproj +++ b/src/Razor/test/testapps/MvcWithComponents/MvcWithComponents.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/Razor/test/testapps/SimpleMvc/SimpleMvc.csproj b/src/Razor/test/testapps/SimpleMvc/SimpleMvc.csproj index 12fca67a75..21ed48c476 100644 --- a/src/Razor/test/testapps/SimpleMvc/SimpleMvc.csproj +++ b/src/Razor/test/testapps/SimpleMvc/SimpleMvc.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Razor/test/testapps/SimpleMvcFSharp/SimpleMvcFSharp.fsproj b/src/Razor/test/testapps/SimpleMvcFSharp/SimpleMvcFSharp.fsproj index 4edd0713ca..e9a2f2c754 100644 --- a/src/Razor/test/testapps/SimpleMvcFSharp/SimpleMvcFSharp.fsproj +++ b/src/Razor/test/testapps/SimpleMvcFSharp/SimpleMvcFSharp.fsproj @@ -20,7 +20,7 @@ - + diff --git a/src/Razor/test/testapps/SimplePages/SimplePages.csproj b/src/Razor/test/testapps/SimplePages/SimplePages.csproj index 858eeeb71e..66d48660f4 100644 --- a/src/Razor/test/testapps/SimplePages/SimplePages.csproj +++ b/src/Razor/test/testapps/SimplePages/SimplePages.csproj @@ -15,7 +15,7 @@ - +