parent
de8aa5bffa
commit
9b05f240ae
|
|
@ -259,6 +259,22 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("SimpleMvc")]
|
||||||
|
public async Task Build_WithPreserveCompilationReferencesEnabled_ProducesRefsDirectory()
|
||||||
|
{
|
||||||
|
// This simulates the behavior of 3.0 with RuntimeCompilation enabled
|
||||||
|
AddProjectFileContent(@"
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||||
|
</PropertyGroup>");
|
||||||
|
|
||||||
|
var result = await DotnetMSBuild("Build");
|
||||||
|
|
||||||
|
// Verify no refs folder is produced
|
||||||
|
Assert.FileExists(result, OutputPath, "refs", "mscorlib.dll");
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[InitializeTestProject("ClassLibrary")]
|
[InitializeTestProject("ClassLibrary")]
|
||||||
public async Task Build_CodeGensAssemblyInfoUsingValuesFromProject()
|
public async Task Build_CodeGensAssemblyInfoUsingValuesFromProject()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
|
@ -8,33 +9,69 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
{
|
{
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
public class BuildIntegrationTest22NetFx :
|
||||||
public class BuildIntegrationTest22NetFx : BuildIntegrationTestLegacy
|
MSBuildIntegrationTestBase,
|
||||||
|
IClassFixture<LegacyBuildServerTestFixture>
|
||||||
{
|
{
|
||||||
|
private const string TestProjectName = "SimpleMvc22NetFx";
|
||||||
|
|
||||||
public BuildIntegrationTest22NetFx(LegacyBuildServerTestFixture buildServer)
|
public BuildIntegrationTest22NetFx(LegacyBuildServerTestFixture buildServer)
|
||||||
: base(buildServer)
|
: base(buildServer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TestProjectName => "SimpleMvc22NetFx";
|
public string OutputFileName => $"{TestProjectName}.exe";
|
||||||
public override string TargetFramework => "net461";
|
|
||||||
public override string OutputFileName => $"{TestProjectName}.exe";
|
|
||||||
|
|
||||||
[Fact]
|
[ConditionalFact]
|
||||||
public override async Task BuildingProject_CopyToOutputDirectoryFiles()
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
[InitializeTestProject(TestProjectName)]
|
||||||
|
public async Task BuildingProject_CopyToOutputDirectoryFiles()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
TargetFramework = "net461";
|
||||||
{
|
|
||||||
// Build
|
|
||||||
var result = await DotnetMSBuild("Build");
|
|
||||||
|
|
||||||
Assert.BuildPassed(result);
|
// Build
|
||||||
// No cshtml files should be in the build output directory
|
var result = await DotnetMSBuild("Build");
|
||||||
Assert.FileCountEquals(result, 0, Path.Combine(OutputPath, "Views"), "*.cshtml");
|
|
||||||
|
|
||||||
// refs are required for runtime compilation in desktop targeting projects.
|
Assert.BuildPassed(result);
|
||||||
Assert.FileCountEquals(result, 97, Path.Combine(OutputPath, "refs"), "*.dll");
|
// No cshtml files should be in the build output directory
|
||||||
}
|
Assert.FileCountEquals(result, 0, Path.Combine(OutputPath, "Views"), "*.cshtml");
|
||||||
|
|
||||||
|
// refs are required for runtime compilation in desktop targeting projects.
|
||||||
|
Assert.FileCountEquals(result, 97, Path.Combine(OutputPath, "refs"), "*.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
[InitializeTestProject(TestProjectName)]
|
||||||
|
public async Task PublishingProject_CopyToOutputDirectoryFiles()
|
||||||
|
{
|
||||||
|
TargetFramework = "net461";
|
||||||
|
|
||||||
|
// Build
|
||||||
|
var result = await DotnetMSBuild("Publish");
|
||||||
|
|
||||||
|
Assert.BuildPassed(result);
|
||||||
|
// No cshtml files should be in the build output directory
|
||||||
|
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
|
||||||
|
|
||||||
|
// refs shouldn't be produced by default
|
||||||
|
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
[InitializeTestProject(TestProjectName)]
|
||||||
|
public async Task PublishingProject_CopyToOutputDirectoryFiles_WithCopyRefAssembliesToPublishDirectory()
|
||||||
|
{
|
||||||
|
TargetFramework = "net461";
|
||||||
|
|
||||||
|
// Build
|
||||||
|
var result = await DotnetMSBuild("Publish", "/p:CopyRefAssembliesToPublishDirectory=true");
|
||||||
|
|
||||||
|
Assert.BuildPassed(result);
|
||||||
|
|
||||||
|
// refs should be present if CopyRefAssembliesToPublishDirectory is set.
|
||||||
|
Assert.FileExists(result, PublishOutputPath, "refs", "System.Threading.Tasks.Extensions.dll");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
|
|
@ -30,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
return new Disposable();
|
return new Disposable();
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Building_Project()
|
public virtual async Task Building_Project()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -55,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task BuildingProject_CopyToOutputDirectoryFiles()
|
public virtual async Task BuildingProject_CopyToOutputDirectoryFiles()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -72,7 +71,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Publish_Project()
|
public virtual async Task Publish_Project()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -92,7 +91,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Publish_NoopsWithMvcRazorCompileOnPublish_False()
|
public virtual async Task Publish_NoopsWithMvcRazorCompileOnPublish_False()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -109,7 +108,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact] // This will use the old precompilation tool, RazorSDK shouldn't get involved.
|
[Fact] // This will use the old precompilation tool, RazorSDK shouldn't get involved.
|
||||||
public virtual async Task Build_WithMvcRazorCompileOnPublish_Noops()
|
public virtual async Task Build_WithMvcRazorCompileOnPublish_Noops()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -125,7 +124,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Build_DoesNotAddRelatedAssemblyPart_IfToolSetIsNotRazorSdk()
|
public virtual async Task Build_DoesNotAddRelatedAssemblyPart_IfToolSetIsNotRazorSdk()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -140,7 +139,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Build_DoesNotPrintsWarnings_IfProjectFileContainsRazorFiles()
|
public virtual async Task Build_DoesNotPrintsWarnings_IfProjectFileContainsRazorFiles()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
@ -153,7 +152,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public virtual async Task Publish_IncludesRefAssemblies_WhenCopyRefAssembliesToPublishDirectoryIsSet()
|
public virtual async Task Publish_IncludesRefAssemblies_WhenCopyRefAssembliesToPublishDirectoryIsSet()
|
||||||
{
|
{
|
||||||
using (CreateTestProject())
|
using (CreateTestProject())
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,29 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
|
Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("SimpleMvc")]
|
||||||
|
public async Task Publish_WithPreserveCompilationReferencesSetInProjectFile_CopiesRefs()
|
||||||
|
{
|
||||||
|
// This simulates the behavior of 3.0 with RuntimeCompilation enabled
|
||||||
|
AddProjectFileContent(@"
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||||
|
</PropertyGroup>");
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
[Fact] // Tests old MvcPrecompilation behavior that we support for compat.
|
[Fact] // Tests old MvcPrecompilation behavior that we support for compat.
|
||||||
[InitializeTestProject("SimpleMvc")]
|
[InitializeTestProject("SimpleMvc")]
|
||||||
public async Task Publish_MvcRazorExcludeFilesFromPublish_False_CopiesFiles()
|
public async Task Publish_MvcRazorExcludeFilesFromPublish_False_CopiesFiles()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue