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/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ProjectDirectory.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ProjectDirectory.cs index 6f19052ebb..1506165b14 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ProjectDirectory.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/ProjectDirectory.cs @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var newProjectFilePath = Path.Combine(directoryPath, targetProjectName + extension); File.Move(oldProjectFilePath, newProjectFilePath); - CopyGlobalJson(repositoryRoot, destinationPath); + CopyRepositoryAssets(repositoryRoot, destinationPath); return new ProjectDirectory( destinationPath, @@ -140,16 +140,16 @@ $@" }); } - void CopyGlobalJson(string repositoryRoot, string projectRoot) + void CopyRepositoryAssets(string repositoryRoot, string projectRoot) { - var srcGlobalJson = Path.Combine(repositoryRoot, "global.json"); - if (!File.Exists(srcGlobalJson)) - { - throw new InvalidOperationException("global.json at the root of the repository could not be found. Run './build /t:Noop' at the repository root and re-run these tests."); - } + var files = new[] { "global.json", "NuGet.config" }; - var destinationGlobalJson = Path.Combine(projectRoot, "global.json"); - File.Copy(srcGlobalJson, destinationGlobalJson); + foreach (var file in files) + { + var srcFile = Path.Combine(repositoryRoot, file); + var destinationFile = Path.Combine(projectRoot, file); + File.Copy(srcFile, destinationFile); + } } } diff --git a/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj b/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj index 076d9b77b0..1bc4281ac7 100644 --- a/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj +++ b/src/Razor/test/testassets/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj @@ -1,16 +1,13 @@ - + $(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\ netcoreapp3.0 - $(MSBuildThisFileDirectory)..\TestPackageRestoreSource\ - - $(RestoreSources); - $(RuntimeAdditionalRestoreSources) - + $(MSBuildThisFileDirectory)..\TestPackageRestoreSource\ + $(RestoreAdditionalProjectSources);$(RuntimeAdditionalRestoreSources) diff --git a/src/Razor/test/testassets/Directory.Build.props b/src/Razor/test/testassets/Directory.Build.props index 1bdf3f0025..5d13eb6e52 100644 --- a/src/Razor/test/testassets/Directory.Build.props +++ b/src/Razor/test/testassets/Directory.Build.props @@ -18,21 +18,10 @@ $(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); - https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json; - https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json; - https://api.nuget.org/v3/index.json; - - - - $(RestoreSources); - https://dotnet.myget.org/F/roslyn/api/v3/index.json; - + + OutOfProcess