diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs
index f6379ae723..2fc7b8eae6 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/BuildVariables.cs
@@ -7,6 +7,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
private static string _msBuildPath = string.Empty;
private static string _microsoftNETCoreApp30PackageVersion = string.Empty;
+ private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty;
static partial void InitializeVariables();
@@ -27,5 +28,14 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
return _microsoftNETCoreApp30PackageVersion;
}
}
+
+ public static string MicrosoftNetCompilersToolsetPackageVersion
+ {
+ get
+ {
+ InitializeVariables();
+ return _microsoftNetCompilersToolsetPackageVersion;
+ }
+ }
}
}
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildServerIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildServerIntegrationTest.cs
index 6121bc9646..7cab7ac3ee 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildServerIntegrationTest.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildServerIntegrationTest.cs
@@ -77,6 +77,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
[InitializeTestProject(originalProjectName: "SimpleMvc", targetProjectName: "Whitespace in name", baseDirectory: "")]
public async Task Build_AppWithWhitespaceInName_CanBuildSuccessfully()
{
+ // We need to separately restore the project in order to ensure this project uses the latest Roslyn. Without this
+ // the Csc task from Roslyn would have already been loaded and any update to it from nuget packages would not have
+ // an effect. This allows us to create our obj/Whitespace in name.csproj.nuget.g.props file (we renamed the project)
+ // and then properly build the project with an appropriate Csc.
+ await DotnetMSBuild("Restore");
+
var result = await DotnetMSBuild(
"Build",
"/p:_RazorForceBuildServer=true");
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 b17592bb80..e8a001c49d 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/MSBuildIntegrationTestBase.cs
@@ -95,6 +95,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
"/p:RunningAsTest=true",
$"/p:MicrosoftNETCoreApp30PackageVersion={BuildVariables.MicrosoftNETCoreApp30PackageVersion}",
+ $"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}",
// Additional restore sources for projects that require built packages
$"/p:RuntimeAdditionalRestoreSources={additionalRestoreSources}",
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..80e404a083 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");
+ var result = await DotnetMSBuild("Build", runRestoreBeforeBuildOrPublish: false);
Assert.BuildPassed(result, allowWarnings: true);
- var pack = await DotnetMSBuild("Pack", "/p:NoBuild=true");
+ var pack = await DotnetMSBuild("Pack", "/p:NoBuild=true", runRestoreBeforeBuildOrPublish: false);
Assert.BuildPassed(pack, allowWarnings: true);
Assert.FileExists(pack, OutputPath, "PackageLibraryDirectDependency.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 ac9c318068..9f0dab1860 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
@@ -87,6 +87,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
_msBuildPath = @"$(_DesktopMSBuildPath)";
_microsoftNETCoreApp30PackageVersion = "$(MicrosoftNETCoreApp30PackageVersion)";
+ _microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)";
}
}
}
@@ -108,7 +109,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
-
+
diff --git a/src/Razor/test/testassets/Directory.Build.props b/src/Razor/test/testassets/Directory.Build.props
index 8cc9caef29..1bdf3f0025 100644
--- a/src/Razor/test/testassets/Directory.Build.props
+++ b/src/Razor/test/testassets/Directory.Build.props
@@ -6,6 +6,13 @@
$([MSBuild]::EnsureTrailingSlash('$(SolutionRoot)'))
$(SolutionRoot)..\..\
+
+ false
+ true
+
$(SolutionRoot)..\..\artifacts\bin\Microsoft.NET.Sdk.Razor\
@@ -19,6 +26,11 @@
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;
+
@@ -36,6 +48,13 @@
<_MvcAssemblyName Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib" />
+
+
+
+