Make precompilation tests use project reference instead of package reference

Fixes #95
This commit is contained in:
Pranav K 2017-03-11 09:25:24 -08:00
parent b57d8079ff
commit 7d7ecf3a1b
29 changed files with 293 additions and 507 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26208.0
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}"
EndProject
@ -20,9 +20,37 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{87FEE984-F627-4F1E-8995-E5F969B85A19}"
ProjectSection(SolutionItems) = preProject
build\common-testapps.props = build\common-testapps.props
build\common.props = build\common.props
build\dependencies.props = build\dependencies.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleApp", "testapps\SimpleApp\SimpleApp.csproj", "{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppWithAssemblyRename", "testapps\SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj", "{D5677246-BC78-426D-9233-0313A04C6D92}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublishWithEmbedViewSources", "testapps\PublishWithEmbedViewSources\PublishWithEmbedViewSources.csproj", "{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "testapps\StrongNamedApp\StrongNamedApp.csproj", "{87C6A03D-1655-4D1C-82E5-8F553BF4096D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithParseErrors", "testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj", "{AF647059-B86B-46DD-9559-E1324A39B148}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingRelativePaths", "testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj", "{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "testapps\ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{196EF313-71CB-47A9-A77D-AACAF62881A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryWithPrecompiledViews", "testapps\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj", "{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingPrecompiledViewClassLibrary", "testapps\ApplicationUsingPrecompiledViewClassLibrary\ApplicationUsingPrecompiledViewClassLibrary.csproj", "{037F4B73-75FB-4570-A38A-9109B580168C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", "testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{08552602-37E7-48A7-95A2-BB1A1F57C804}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -41,6 +69,54 @@ Global
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|Any CPU.Build.0 = Release|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|Any CPU.Build.0 = Release|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|Any CPU.Build.0 = Release|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|Any CPU.Build.0 = Release|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|Any CPU.Build.0 = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|Any CPU.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.Build.0 = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|Any CPU.Build.0 = Release|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|Any CPU.Build.0 = Release|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|Any CPU.Build.0 = Release|Any CPU
{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Release|Any CPU.Build.0 = Release|Any CPU
{037F4B73-75FB-4570-A38A-9109B580168C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{037F4B73-75FB-4570-A38A-9109B580168C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{037F4B73-75FB-4570-A38A-9109B580168C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{037F4B73-75FB-4570-A38A-9109B580168C}.Release|Any CPU.Build.0 = Release|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -49,5 +125,17 @@ Global
{4339FC9B-AEC6-442A-B413-A41555ED76C7} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720}
{46C9A4B2-8B1C-451B-B670-C194901D66AC} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB}
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB}
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{D5677246-BC78-426D-9233-0313A04C6D92} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{87C6A03D-1655-4D1C-82E5-8F553BF4096D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{AF647059-B86B-46DD-9559-E1324A39B148} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{68BB859F-E5D5-407E-9DFB-8CD478EFE90D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{037F4B73-75FB-4570-A38A-9109B580168C} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{08552602-37E7-48A7-95A2-BB1A1F57C804} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
EndGlobalSection
EndGlobal

View File

@ -1,8 +1,22 @@
<Project>
<Import Project="dependencies.props" />
<PropertyGroup>
<TestIncludeViewCompilationTargets Condition="'$(TestIncludeViewCompilationTargets)'==''">$(MvcRazorCompileOnPublish)</TestIncludeViewCompilationTargets>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" Version="1.0.1-*" PrivateAssets="All" />
<Import Project="..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\build\netcoreapp1.1\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets"
Condition="'$(TestIncludeViewCompilationTargets)'=='true'"/>
<ItemGroup Condition="'$(TestIncludeViewCompilationTargets)'=='true'">
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj" />
</ItemGroup>
<Target
Name="SetMvcRazorViewCompilationBinaryPath"
BeforeTargets="MvcRazorPrecompile"
Condition="'$(TestIncludeViewCompilationTargets)'=='true'">
<PropertyGroup>
<_MvcViewCompilationBinaryPath>$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll</_MvcViewCompilationBinaryPath>
</PropertyGroup>
</Target>
</Project>

View File

@ -2,6 +2,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\common.targets" />
<PropertyGroup>
<MvcRazorRunCommand>dotnet</MvcRazorRunCommand>
<_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll</_MvcViewCompilationBinaryPath>
</PropertyGroup>
<Target
Name="MvcRazorPrecompile"
@ -14,7 +15,7 @@
<PropertyGroup>
<ExecArgs>--runtimeconfig &quot;$(ProjectRuntimeConfigFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) --depsfile &quot;$(ProjectDepsFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) &quot;$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) &quot;$(_MvcViewCompilationBinaryPath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) @&quot;$(_MvcRazorResponseFilePath)&quot;</ExecArgs>
</PropertyGroup>

View File

@ -1,13 +1,7 @@
// 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.
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.DotNet.Cli.Utils;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
@ -22,85 +16,26 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux,
SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")]
[OSSkipCondition(OperatingSystems.MacOSX,
SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")]
[Fact]
public async Task ConsumingClassLibrariesWithPrecompiledViewsWork()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri + "Manage/Home",
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri + "Manage/Home",
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
}
public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture
{
private readonly string _packOutputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
public ApplicationConsumingPrecompiledViewsFixture()
: base("ApplicationUsingPrecompiledViewClassLibrary")
{
ClassLibraryPath = Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryWithPrecompiledViews"));
}
private string ClassLibraryPath { get; }
protected override void Restore()
{
CreateClassLibraryPackage();
var nuGetConfigPath = Path.Combine(ApplicationPaths.SolutionDirectory, "NuGet.config");
var nugetConfig = XDocument.Parse(File.ReadAllText(nuGetConfigPath));
var sources = nugetConfig
.Root
.Element("packageSources")
.Elements("add")
.Select(s => s.Attribute("value").Value)
.ToList();
sources.Add(_packOutputDirectory);
RestoreProject(ApplicationPath, sources);
}
private void CreateClassLibraryPackage()
{
RestoreProject(ClassLibraryPath);
ExecuteForClassLibrary(Command.CreateDotNet(
"build",
new[] { "-c", "Release" }));
var packCommand = Command
.CreateDotNet("pack", new[] { "-c", "Release", "-o", _packOutputDirectory });
ExecuteForClassLibrary(packCommand);
}
private void ExecuteForClassLibrary(ICommand command)
{
Console.WriteLine($"Running {command.CommandName} {command.CommandArgs} in {ClassLibraryPath}");
command
.WorkingDirectory(ClassLibraryPath)
.EnvironmentVariable(NuGetPackagesEnvironmentKey, TempRestoreDirectory)
.EnvironmentVariable(DotnetSkipFirstTimeExperience, "true")
.ForwardStdErr(Console.Error)
.ForwardStdOut(Console.Out)
.Execute()
.EnsureSuccessful();
}
public override void Dispose()
{
TryDeleteDirectory(_packOutputDirectory);
base.Dispose();
}
}
}

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
@ -21,36 +20,30 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task Precompilation_WorksForViewsUsingRelativePath()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
[Fact]
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
public class ApplicationUsingRelativePathsTestFixture : ApplicationTestFixture

View File

@ -20,38 +20,32 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response);
}
[Fact]
public async Task Precompilation_UsesConfiguredParseOptions()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor",
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor",
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent(
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
response);
}
// Assert
TestEmbeddedResource.AssertContent(
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
response);
}
public class ApplicationWithConfigureMvcFixture : ApplicationTestFixture

View File

@ -24,20 +24,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
[Fact]
public async Task ApplicationWithCustomInputFiles_Works()
{
// Arrange
var expectedText = "Hello Index!";
using (var deployer = Fixture.CreateDeployment())
{
// Arrange
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
Assert.Equal(expectedText, response.Trim());
}
// Assert
Assert.Equal(expectedText, response.Trim());
}
[Fact]
@ -49,21 +46,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
"/Views/Home/About.cshtml",
"/Views/Home/Index.cshtml",
};
var deploymentResult = Fixture.CreateDeployment();
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
// Act
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
Fixture.Logger);
// Act
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
Fixture.Logger);
// Assert
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
// Assert
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
[Fact]
@ -80,24 +73,20 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
{
"NotIncluded.cshtml",
};
var deploymentResult = Fixture.CreateDeployment();
var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home");
using (var deployer = Fixture.CreateDeployment())
// Act & Assert
foreach (var file in viewsPublished)
{
var deploymentResult = deployer.Deploy();
var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home");
// Act & Assert
foreach (var file in viewsPublished)
{
var filePath = Path.Combine(viewsDirectory, file);
Assert.True(File.Exists(filePath), $"{filePath} was not published.");
}
var filePath = Path.Combine(viewsDirectory, file);
Assert.True(File.Exists(filePath), $"{filePath} was not published.");
}
foreach (var file in viewsNotPublished)
{
var filePath = Path.Combine(viewsDirectory, file);
Assert.False(File.Exists(filePath), $"{filePath} was published.");
}
foreach (var file in viewsNotPublished)
{
var filePath = Path.Combine(viewsDirectory, file);
Assert.False(File.Exists(filePath), $"{filePath} was published.");
}
}

View File

@ -4,14 +4,14 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
{
public class ApplicationWithParseErrorsTest : IClassFixture<ApplicationWithParseErrorsTest.ApplicationWithParseErrorsFixture>
public class ApplicationWithParseErrorsTest :
IClassFixture<ApplicationWithParseErrorsTest.ApplicationWithParseErrorsFixture>
{
public ApplicationWithParseErrorsTest(ApplicationWithParseErrorsFixture fixture)
{
@ -31,18 +31,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
viewImportsPath + " (1): A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between.",
};
using (var deployer = Fixture.CreateDeployment())
// Act & Assert
Assert.Throws<Exception>(() => Fixture.CreateDeployment());
// Assert
var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
foreach (var error in expectedErrors)
{
// Act & Assert
Assert.Throws<Exception>(() => deployer.Deploy());
// Assert
var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
foreach (var error in expectedErrors)
{
Assert.Contains(error, output);
}
Assert.Contains(error, output);
}
}
@ -55,7 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public TestSink TestSink { get; } = new TestSink();
protected override ILogger CreateLogger()
public override ILogger CreateLogger()
{
return new TestLoggerFactory(TestSink, enabled: true).CreateLogger($"{ApplicationName}");
}

View File

@ -1,7 +1,6 @@
// 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.
using System.IO;
using System.Threading.Tasks;
using Xunit;
@ -33,18 +32,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url)
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/{url}",
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/{url}",
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response);
}
public class ApplicationWithTagHelpersFixture : ApplicationTestFixture
@ -53,12 +49,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
: base("ApplicationWithTagHelpers")
{
}
protected override void Restore()
{
RestoreProject(Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryTagHelper")));
base.Restore();
}
}
}
}

View File

@ -5,66 +5,53 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
{
public abstract class ApplicationTestFixture : IDisposable
{
public const string NuGetPackagesEnvironmentKey = "NUGET_PACKAGES";
public const string DotnetSkipFirstTimeExperience = "DOTNET_SKIP_FIRST_TIME_EXPERIENCE";
public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
private readonly string _oldRestoreDirectory;
private bool _isRestored;
private readonly object _deploymentLock = new object();
private IApplicationDeployer _deployer;
private DeploymentResult _deploymentResult;
protected ApplicationTestFixture(string applicationName)
{
ApplicationName = applicationName;
_oldRestoreDirectory = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey);
}
public string ApplicationName { get; }
public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName);
public string TempRestoreDirectory { get; } = CreateTempRestoreDirectory();
public HttpClient HttpClient { get; } = new HttpClient();
public ILogger Logger { get; private set; }
public IApplicationDeployer CreateDeployment()
public DeploymentResult CreateDeployment()
{
PrepareForDeployment();
var deploymentParameters = GetDeploymentParameters();
return ApplicationDeployerFactory.Create(deploymentParameters, Logger);
}
public virtual void PrepareForDeployment()
{
Logger = CreateLogger();
if (!_isRestored)
lock (_deploymentLock)
{
Restore();
_isRestored = true;
if (_deployer != null)
{
return _deploymentResult;
}
Logger = CreateLogger();
var deploymentParameters = GetDeploymentParameters();
var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Logger);
_deploymentResult = deployer.Deploy();
_deployer = deployer;
return _deploymentResult;
}
}
public virtual DeploymentParameters GetDeploymentParameters()
{
var tempRestoreDirectoryEnvironment = new KeyValuePair<string, string>(
NuGetPackagesEnvironmentKey,
TempRestoreDirectory);
var skipFirstTimeCacheCreation = new KeyValuePair<string, string>(
DotnetSkipFirstTimeExperience,
"true");
var telemetryOptOut = new KeyValuePair<string, string>(
DotnetCLITelemetryOptOut,
"1");
@ -81,17 +68,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
#else
#error the target framework needs to be updated.
#endif
#if DEBUG
Configuration = "Debug",
#else
Configuration = "Release",
#endif
EnvironmentVariables =
{
tempRestoreDirectoryEnvironment,
skipFirstTimeCacheCreation,
telemetryOptOut,
},
PublishEnvironmentVariables =
{
tempRestoreDirectoryEnvironment,
skipFirstTimeCacheCreation,
telemetryOptOut,
},
};
@ -99,22 +86,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
return deploymentParameters;
}
protected virtual ILogger CreateLogger()
public virtual ILogger CreateLogger()
{
return new LoggerFactory()
.AddConsole()
.CreateLogger($"{ApplicationName}");
}
protected virtual void Restore()
public void Dispose()
{
RestoreProject(ApplicationPath);
}
public virtual void Dispose()
{
TryDeleteDirectory(TempRestoreDirectory);
HttpClient.Dispose();
HttpClient?.Dispose();
_deployer?.Dispose();
}
protected static void TryDeleteDirectory(string directory)
@ -128,68 +110,5 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
// Ignore delete failures.
}
}
protected void RestoreProject(string applicationDirectory, IList<string> feeds = null)
{
var args = new List<string>
{
"--packages",
TempRestoreDirectory,
};
if (feeds != null)
{
foreach (var feed in feeds)
{
args.Add("-s");
args.Add(feed);
}
}
var command = Command
.CreateDotNet("restore", args)
.EnvironmentVariable(DotnetSkipFirstTimeExperience, "true")
.CaptureStdErr()
.CaptureStdOut()
.WorkingDirectory(applicationDirectory)
.Execute();
if (command.ExitCode != 0)
{
throw new Exception(
$@"dotnet {command.StartInfo.Arguments} failed.
===StdOut===
{command.StdOut}
===StdErr===
{command.StdErr}");
}
}
private static string CreateTempRestoreDirectory()
{
var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
return Directory.CreateDirectory(path).FullName;
}
private static string GetNuGetPackagesDirectory()
{
var nugetFeed = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey);
if (!string.IsNullOrEmpty(nugetFeed))
{
return nugetFeed;
}
string basePath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
basePath = Environment.GetEnvironmentVariable("USERPROFILE");
}
else
{
basePath = Environment.GetEnvironmentVariable("HOME");
}
return Path.Combine(basePath, ".nuget", "packages");
}
}
}

View File

@ -32,31 +32,29 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
"/Views/Home/Index.cshtml",
};
var expectedText = "Hello Index!";
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var assemblyPath = Path.Combine(
deploymentResult.DeploymentParameters.PublishedApplicationRootPath,
$"{ApplicationName}.PrecompiledViews.dll");
var deploymentResult = Fixture.CreateDeployment();
// Act - 1
var response1 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/Index",
Fixture.Logger);
var assemblyPath = Path.Combine(
deploymentResult.DeploymentParameters.PublishedApplicationRootPath,
$"{ApplicationName}.PrecompiledViews.dll");
// Assert - 1
Assert.Equal(expectedText, response1.Trim());
// Act - 1
var response1 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/Index",
Fixture.Logger);
// Act - 2
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
Fixture.Logger);
// Assert - 1
Assert.Equal(expectedText, response1.Trim());
// Assert - 2
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
// Act - 2
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
Fixture.Logger);
// Assert - 2
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture

View File

@ -1,10 +1,7 @@
// 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.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
@ -22,18 +19,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task Precompilation_WorksForSimpleApps()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
}
public class SimpleAppTestFixture : ApplicationTestFixture

View File

@ -20,18 +20,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task Precompilation_WorksForSimpleApps()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
}
public class TestFixture : ApplicationTestFixture

View File

@ -19,18 +19,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
var deploymentResult = deployer.Deploy();
var deploymentResult = Fixture.CreateDeployment();
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Act
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
deploymentResult.ApplicationBaseUri,
Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response);
}
// Assert
TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response);
}
public class StrongNamedAppFixture : ApplicationTestFixture

View File

@ -20,27 +20,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
[Fact]
public void Precompilation_PreventsRefAssembliesFromBeingPublished()
{
// Arrange
using (var deployer = Fixture.CreateDeployment())
{
// Act
var deploymentResult = deployer.Deploy();
// Arrange & Act
var deploymentResult = Fixture.CreateDeployment();
// Assert
Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
}
// Assert
Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
}
[Fact]
public void PublishingWithOption_AllowsPublishingRefAssemblies()
{
// Arrange
Fixture.PrepareForDeployment();
var deploymentParameters = Fixture.GetDeploymentParameters();
deploymentParameters.PublishEnvironmentVariables.Add(
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
var logger = Fixture.CreateLogger();
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.Logger))
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
{
// Act
var deploymentResult = deployer.Deploy();

View File

@ -1,16 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="ClassLibraryWithPrecompiledViews" Version="1.0.0-*" />
<ProjectReference Include="..\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
</ItemGroup>
<Target Name="CopyPrecompiledViewAssets" BeforeTargets="Publish">
<ItemGroup>
<PrecompiledArtifacts Include="..\ClassLibraryWithPrecompiledViews\obj\precompiled\$(TargetFramework)\*.dll" />
</ItemGroup>
<Copy SourceFiles="@(PrecompiledArtifacts)" DestinationFolder="$(PublishDir)" />
</Target>
</Project>

View File

@ -1,16 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,16 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
@ -9,11 +8,8 @@
<ItemGroup>
<MvcRazorFilesToCompile Include="Views/Home/Index.cshtml;Views/Home/About.cshtml" />
</ItemGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,15 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<ProjectReference Include="..\ClassLibraryTagHelper\ClassLibraryTagHelper.csproj" />
@ -12,10 +12,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>

View File

@ -1,31 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Version>1.0.0-z$([System.DateTime]::UtcNow.Ticks)</Version>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorOutputPath Condition="'$(TargetFramework)'!=''">obj\precompiled\$(TargetFramework)</MvcRazorOutputPath>
<TestIncludeViewCompilationTargets>true</TestIncludeViewCompilationTargets>
</PropertyGroup>
<ItemGroup>
<Content
Include="obj\precompiled\**\*"
Pack="true"
PackagePath="lib\%(RecursiveDir)%(FileName)%(Extension)" />
</ItemGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<Target
Name="PrecompileRazorViews"
AfterTargets="Build"
DependsOnTargets="MvcRazorPrecompile"
Condition="'$(TargetFramework)'!=''" />
<Target Name="PrecompileRazorViews" AfterTargets="Build" DependsOnTargets="MvcRazorPrecompile" Condition="'$(TargetFramework)'!=''" />
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="LocalArtifacts" value="../artifacts/build" />
</packageSources>
</configuration>

View File

@ -1,18 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<MvcRazorEmbedViewSources>true</MvcRazorEmbedViewSources>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />

View File

@ -1,15 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<PropertyGroup>
<AssemblyName>NewAssemblyName</AssemblyName>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common-testapps.props" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
@ -8,12 +7,10 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<Import Project="..\..\build\common-testapps.props" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation">
<Version>1.2.0-*</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />

View File

@ -1,64 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26206.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{43488AEE-CCF2-4A90-B890-05320282BE29}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
NuGet.config = NuGet.config
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", "ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{2079872F-E8F9-4DB1-A340-C0D897807B86}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{39EFA075-3673-49AB-95F3-AA5E88DF6C30}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryWithPrecompiledViews", "ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublishWIthEmbedViewSources", "PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.csproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "StrongNamedApp\StrongNamedApp.csproj", "{88903BE5-0676-4667-8160-B24646E0B76E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppWithAssemblyRename", "SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj", "{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.Build.0 = Release|Any CPU
{39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.Build.0 = Release|Any CPU
{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.Build.0 = Release|Any CPU
{4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.Build.0 = Release|Any CPU
{E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.Build.0 = Release|Any CPU
{88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.Build.0 = Release|Any CPU
{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal