Do not restore as part of test (dotnet/aspnetcore-tooling#350)
\n\nCommit migrated from 84bc53671f
This commit is contained in:
parent
e5064d3c76
commit
cf116d619b
|
|
@ -296,7 +296,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileExists(result, OutputPath, "ClassLibrary.Views.dll");
|
||||
Assert.FileExists(result, OutputPath, "ClassLibrary.Views.pdb");
|
||||
|
||||
result = await DotnetMSBuild(target: "Clean", "/p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: "Clean", "/p:BuildProjectReferences=false");
|
||||
Assert.BuildPassed(result);
|
||||
|
||||
Assert.FileDoesNotExist(result, OutputPath, "AppWithP2PReference.dll");
|
||||
|
|
@ -306,7 +306,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileDoesNotExist(result, OutputPath, "ClassLibrary.Views.pdb");
|
||||
|
||||
// dotnet msbuild /p:BuildProjectReferences=false
|
||||
result = await DotnetMSBuild(target: default, "/p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: default, "/p:BuildProjectReferences=false");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
Assert.FileExists(result, OutputPath, "AppWithP2PReference.dll");
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
File.AppendAllText(class2Path, Environment.NewLine + "// Some changes");
|
||||
|
||||
// dotnet msbuild /p:BuildProjectReferences=false
|
||||
result = await DotnetMSBuild(target: default, "/p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: default, "/p:BuildProjectReferences=false");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileExists(result, OutputPath, "ClassLibrary.dll");
|
||||
Assert.FileExists(result, OutputPath, "ClassLibrary.Views.dll");
|
||||
|
||||
result = await DotnetMSBuild(target: "GetCopyToOutputDirectoryItems", "/t:_IntrospectGetCopyToOutputDirectoryItems /p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: "GetCopyToOutputDirectoryItems", "/t:_IntrospectGetCopyToOutputDirectoryItems /p:BuildProjectReferences=false");
|
||||
Assert.BuildPassed(result);
|
||||
Assert.BuildOutputContainsLine(result, "AllItemsFullPathWithTargetPath: ClassLibrary.Views.dll");
|
||||
Assert.BuildOutputContainsLine(result, "AllItemsFullPathWithTargetPath: ClassLibrary.Views.pdb");
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Directory.Delete(Path.Combine(Project.DirectoryPath, "Views"), recursive: true);
|
||||
|
||||
// dotnet msbuild /p:BuildProjectReferences=false
|
||||
result = await DotnetMSBuild(target: "GetCopyToOutputDirectoryItems", "/t:_IntrospectGetCopyToOutputDirectoryItems /p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: "GetCopyToOutputDirectoryItems", "/t:_IntrospectGetCopyToOutputDirectoryItems /p:BuildProjectReferences=false");
|
||||
|
||||
Assert.BuildOutputDoesNotContainLine(result, "AllItemsFullPathWithTargetPath: ClassLibrary.Views.dll");
|
||||
Assert.BuildOutputDoesNotContainLine(result, "AllItemsFullPathWithTargetPath: ClassLibrary.Views.pdb");
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
internal Task<MSBuildResult> DotnetMSBuild(
|
||||
string target,
|
||||
string args = null,
|
||||
bool suppressRestore = false,
|
||||
bool suppressTimeout = false,
|
||||
bool suppressBuildServer = false,
|
||||
string buildServerPipeName = null,
|
||||
|
|
@ -76,11 +75,6 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
$"/p:MicrosoftNETCoreApp30PackageVersion={BuildVariables.MicrosoftNETCoreApp30PackageVersion}",
|
||||
};
|
||||
|
||||
if (!suppressRestore)
|
||||
{
|
||||
buildArgumentList.Add("/restore");
|
||||
}
|
||||
|
||||
if (!suppressBuildServer)
|
||||
{
|
||||
buildArgumentList.Add($@"/p:_RazorBuildServerPipeName=""{buildServerPipeName ?? BuildServer.PipeName}""");
|
||||
|
|
|
|||
|
|
@ -86,11 +86,21 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
throw;
|
||||
}
|
||||
|
||||
void CopyDirectory(DirectoryInfo source, DirectoryInfo destination)
|
||||
void CopyDirectory(DirectoryInfo source, DirectoryInfo destination, bool recursive = true)
|
||||
{
|
||||
foreach (var file in source.EnumerateFiles())
|
||||
{
|
||||
file.CopyTo(Path.Combine(destination.FullName, file.Name));
|
||||
}
|
||||
|
||||
if (!recursive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var directory in source.EnumerateDirectories())
|
||||
{
|
||||
if (directory.Name == "bin" || directory.Name == "obj")
|
||||
if (directory.Name == "bin")
|
||||
{
|
||||
// Just in case someone has opened the project in an IDE or built it. We don't want to copy
|
||||
// these folders.
|
||||
|
|
@ -98,12 +108,15 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
|
||||
var created = destination.CreateSubdirectory(directory.Name);
|
||||
CopyDirectory(directory, created);
|
||||
}
|
||||
|
||||
foreach (var file in source.EnumerateFiles())
|
||||
{
|
||||
file.CopyTo(Path.Combine(destination.FullName, file.Name));
|
||||
if (directory.Name == "obj")
|
||||
{
|
||||
// Copy NuGet restore assets (viz all the files at the root of the obj directory, but stop there.)
|
||||
CopyDirectory(directory, created, recursive: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyDirectory(directory, created);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileExists(result, OutputPath, "ClassLibrary2.Views.dll");
|
||||
|
||||
// dotnet msbuild /t:Publish /p:BuildProjectReferences=false
|
||||
result = await DotnetMSBuild(target: "Publish", "/p:BuildProjectReferences=false", suppressRestore: true);
|
||||
result = await DotnetMSBuild(target: "Publish", "/p:BuildProjectReferences=false");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreTestProjects" BeforeTargets="Restore">
|
||||
<Target Name="RestoreTestProjects" BeforeTargets="Restore;Build">
|
||||
<MSBuild Projects="..\testapps\RestoreTestProjects\RestoreTestProjects.csproj" Targets="Restore" />
|
||||
</Target>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
<ProjectReference Include="..\ClassLibrary\ClassLibrary.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
<ProjectReference Include="..\ClassLibrary\ClassLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<SolutionRoot Condition="'$(SolutionRoot)' == ''">$(MSBuildThisFileDirectory)..\..\</SolutionRoot>
|
||||
<SolutionRoot>$([MSBuild]::EnsureTrailingSlash('$(SolutionRoot)'))</SolutionRoot>
|
||||
<RepositoryRoot>$(SolutionRoot)..\..\</RepositoryRoot>
|
||||
|
||||
<!-- Retarget tests to use the copy of the Sdk from source -->
|
||||
<RazorSdkArtifactsDirectory>$(SolutionRoot)..\..\artifacts\bin\Microsoft.NET.Sdk.Razor\</RazorSdkArtifactsDirectory>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -11,12 +11,16 @@
|
|||
<ProjectReference Include="..\ComponentLibrary\ComponentLibrary.csproj" />
|
||||
<ProjectReference Include="..\ComponentApp\ComponentApp.csproj" />
|
||||
<ProjectReference Include="..\LargeProject\LargeProject.csproj" />
|
||||
<ProjectReference Include="..\MvcWithComponents\MvcWithComponents.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvcFSharp\SimpleMvcFSharp.fsproj" />
|
||||
<ProjectReference Include="..\SimpleMvc\SimpleMvc.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvc11\SimpleMvc11.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvc21\SimpleMvc21.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvc22\SimpleMvc22.csproj" />
|
||||
<ProjectReference Include="..\SimplePages\SimplePages.csproj" />
|
||||
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
<Compile Include="Program.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||
<PropertyGroup Condition="'$(BinariesRoot)'==''">
|
||||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj"/>
|
||||
</ItemGroup>
|
||||
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue