Merge branch 'rel/1.1.0' into dev
This commit is contained in:
commit
8b410c5899
|
|
@ -1,4 +1,18 @@
|
|||
{
|
||||
"adx": {
|
||||
"rules": [
|
||||
"DefaultCompositeRule"
|
||||
],
|
||||
"packages": {
|
||||
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation": {
|
||||
"exclusions": {
|
||||
"DOC_MISSING": {
|
||||
"lib/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll": "Not a class library. Docs not required for CLI tools"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Default": {
|
||||
"rules": [
|
||||
"DefaultCompositeRule"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
use assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
|
||||
use namespace="System.IO"
|
||||
use namespace="System.IO.Compression"
|
||||
use namespace="System.Linq"
|
||||
|
||||
use-standard-lifecycle
|
||||
k-standard-goals
|
||||
|
||||
#repack-x86 target='compile' if='Directory.Exists("src") && !IsLinux'
|
||||
@{
|
||||
var buildDir= Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build");
|
||||
var projectName = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation";
|
||||
var projectNupkg = Files
|
||||
.Include(Path.Combine(buildDir, projectName + "*.nupkg"))
|
||||
.Where(path => !path.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
|
||||
.OrderByDescending(f => f) // On local builds multiple nupkgs are generated.
|
||||
.First();
|
||||
|
||||
Log.Info("Repacking Nupkg: " + projectNupkg);
|
||||
|
||||
using (var zipArchive = ZipFile.Open(projectNupkg, ZipArchiveMode.Update))
|
||||
{
|
||||
MoveEntry(zipArchive, "lib/net451/" + projectName + ".exe", "runtimes/win7-x64/lib/net451/" + projectName + ".exe");
|
||||
MoveEntry(zipArchive, "lib/net451/" + projectName + "-x86.exe", "runtimes/win7-x86/lib/net451/" + projectName + "-x86.exe");
|
||||
zipArchive.CreateEntry("lib/net451/_._");
|
||||
}
|
||||
}
|
||||
|
||||
functions @{
|
||||
private static void MoveEntry(ZipArchive archive, string oldPath, string newPath)
|
||||
{
|
||||
var oldEntry = archive.GetEntry(oldPath);
|
||||
if (oldEntry == null)
|
||||
{
|
||||
throw new Exception(oldPath + " was not found in package.");
|
||||
}
|
||||
|
||||
var newEntry = archive.CreateEntry(newPath);
|
||||
using (var newStream = newEntry.Open())
|
||||
using (var oldStream = oldEntry.Open())
|
||||
{
|
||||
oldStream.CopyTo(newStream);
|
||||
}
|
||||
|
||||
oldEntry.Delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class CompilationOptions
|
||||
internal class CompilationOptions
|
||||
{
|
||||
public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type";
|
||||
public static readonly string ContentRootTemplate = "--content-root";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.Linq;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public static class DebugHelper
|
||||
internal static class DebugHelper
|
||||
{
|
||||
public static void HandleDebugSwitch(ref string[] args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class MvcServiceProvider
|
||||
internal class MvcServiceProvider
|
||||
{
|
||||
private readonly string _projectPath;
|
||||
private readonly string _contentRoot;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class PrecompilationApplication : CommandLineApplication
|
||||
internal class PrecompilationApplication : CommandLineApplication
|
||||
{
|
||||
private readonly Type _callingType;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class PrecompileRunCommand
|
||||
internal class PrecompileRunCommand
|
||||
{
|
||||
private static readonly ParallelOptions ParalellOptions = new ParallelOptions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.IO;
|
|||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
// Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs
|
||||
public static class SnkUtils
|
||||
internal static class SnkUtils
|
||||
{
|
||||
const byte PUBLICKEYBLOB = 0x06;
|
||||
const byte PRIVATEKEYBLOB = 0x07;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Razor.Evolution;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class ViewCompilationInfo
|
||||
internal class ViewCompilationInfo
|
||||
{
|
||||
public ViewCompilationInfo(
|
||||
ViewFileInfo viewFileInfo,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.IO;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public struct ViewFileInfo
|
||||
internal struct ViewFileInfo
|
||||
{
|
||||
public ViewFileInfo(string fullPath, string viewEnginePath)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using Microsoft.CodeAnalysis.Text;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||
{
|
||||
public class ViewInfoContainerCodeGenerator
|
||||
internal class ViewInfoContainerCodeGenerator
|
||||
{
|
||||
public ViewInfoContainerCodeGenerator(
|
||||
CSharpCompiler compiler,
|
||||
|
|
|
|||
|
|
@ -1,26 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common.props" />
|
||||
<PropertyGroup>
|
||||
<Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
|
||||
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
||||
<RuntimeIdentifier Condition="!$(TargetFramework.StartsWith('netcoreapp'))">win7-x64</RuntimeIdentifier>
|
||||
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<OutputType>exe</OutputType>
|
||||
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
|
||||
<X86ProjectDirectory>..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\</X86ProjectDirectory>
|
||||
<!-- Include the build outputs in the build directory (and not the lib directory) -->
|
||||
<BuildOutputTargetFolder>build</BuildOutputTargetFolder>
|
||||
<ContentTargetFolders>build</ContentTargetFolders>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="build\**\*" Pack="true" PackagePath="%(Identity)" />
|
||||
<None Include="$(X86ProjectDirectory)bin\$(Configuration)\net451\$(MSBuildThisFileName)-x86.exe" Pack="true" PackagePath="build\net451\$(MSBuildThisFileName)-x86.exe" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.2.0-*" />
|
||||
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net451'" />
|
||||
</ItemGroup>
|
||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||
<Import Project="..\..\build\common.props" />
|
||||
<PropertyGroup>
|
||||
<Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
|
||||
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
||||
<RuntimeIdentifier Condition="!$(TargetFramework.StartsWith('netcoreapp'))">win7-x64</RuntimeIdentifier>
|
||||
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<OutputType>exe</OutputType>
|
||||
<X86ProjectDirectory>..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\</X86ProjectDirectory>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="build\**\*" Pack="true" PackagePath="%(Identity)" />
|
||||
<None Include="buildMultiTargeting\*" Pack="true" PackagePath="%(Identity)" />
|
||||
<None Include="$(X86ProjectDirectory)\bin\$(Configuration)\net451\$(MSBuildThisFileName)-x86.exe" Pack="true" PackagePath="lib\net451\$(MSBuildThisFileName)-x86.exe" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.2.0-*" />
|
||||
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net451'" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||
{
|
||||
public class Program
|
||||
internal class Program
|
||||
{
|
||||
private readonly static Type ProgramType = typeof(Program);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +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.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<MvcRazorContentRoot Condition="'$(MvcRazorContentRoot)'==''">$(MSBuildProjectDirectory)</MvcRazorContentRoot>
|
||||
<MvcRazorExcludeViewFilesFromPublish Condition="'$(MvcRazorExcludeViewFilesFromPublish)'==''">true</MvcRazorExcludeViewFilesFromPublish>
|
||||
<MvcRazorExcludeRefAssembliesFromPublish Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'==''">true</MvcRazorExcludeRefAssembliesFromPublish>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'@(MvcRazorFilesToCompile)' == ''">
|
||||
|
|
@ -53,7 +54,7 @@
|
|||
Condition="'$(MvcRazorCompileOnPublish)'=='true'" />
|
||||
|
||||
<Target Name="_MvcRazorResolveFilesToCompute"
|
||||
AfterTargets="ComputeFilesToPublish"
|
||||
AfterTargets="ComputeRefAssembliesToPublish"
|
||||
Condition="'$(MvcRazorCompileOnPublish)'=='true'">
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -65,6 +66,12 @@
|
|||
<RelativePath>$([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)'))</RelativePath>
|
||||
</ResolvedFileToPublish>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'=='true'">
|
||||
<ResolvedFileToPublish
|
||||
Remove="%(ResolvedFileToPublish.Identity)"
|
||||
Condition="'%(ResolvedFileToPublish.RelativePath)'=='$(RefAssembliesFolderName)\%(Filename)%(Extension)'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,18 +17,12 @@
|
|||
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config">
|
||||
<Destination>$(OutputPath)$(MSBuildThisFileName)-x86.exe.config</Destination>
|
||||
</FilesToCopy>
|
||||
<FilesToCopy Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName)-x86.exe">
|
||||
<Destination>$(OutputPath)$(MSBuildThisFileName)-x86.exe</Destination>
|
||||
</FilesToCopy>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PlatformTarget)'!='x86'">
|
||||
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config" Condition="">
|
||||
<Destination>$(OutputPath)$(MSBuildThisFileName).exe.config</Destination>
|
||||
</FilesToCopy>
|
||||
<FilesToCopy Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).exe">
|
||||
<Destination>$(OutputPath)$(MSBuildThisFileName).exe</Destination>
|
||||
</FilesToCopy>
|
||||
</ItemGroup>
|
||||
|
||||
<Copy
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<PropertyGroup>
|
||||
<ExecArgs>--runtimeconfig "$(ProjectRuntimeConfigFilePath)"</ExecArgs>
|
||||
<ExecArgs>$(ExecArgs) --depsfile "$(ProjectDepsFilePath)"</ExecArgs>
|
||||
<ExecArgs>$(ExecArgs) "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll"</ExecArgs>
|
||||
<ExecArgs>$(ExecArgs) "$(MSBuildThisFileDirectory)../../lib/netcoreapp1.1/$(MSBuildThisFileName).dll"</ExecArgs>
|
||||
<ExecArgs>$(ExecArgs) @"$(_MvcRazorResponseFilePath)"</ExecArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[ConditionalTheory(Skip = "MVC #5736")]
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux,
|
||||
SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForViewsUsingRelativePath(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
}
|
||||
}
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
}
|
||||
}
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
}
|
||||
}
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(ApplicationWithTagHelpersData))]
|
||||
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public ILogger Logger { get; private set; }
|
||||
|
||||
public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor)
|
||||
{
|
||||
PrepareForDeployment(flavor);
|
||||
var deploymentParameters = GetDeploymentParameters(flavor);
|
||||
return ApplicationDeployerFactory.Create(deploymentParameters, Logger);
|
||||
}
|
||||
|
||||
public virtual void PrepareForDeployment(RuntimeFlavor flavor)
|
||||
{
|
||||
Logger = CreateLogger(flavor);
|
||||
|
||||
|
|
@ -46,7 +53,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
Restore();
|
||||
_isRestored = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor)
|
||||
{
|
||||
var tempRestoreDirectoryEnvironment = new KeyValuePair<string, string>(
|
||||
NuGetPackagesEnvironmentKey,
|
||||
TempRestoreDirectory);
|
||||
|
|
@ -82,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
},
|
||||
};
|
||||
|
||||
return ApplicationDeployerFactory.Create(deploymentParameters, Logger);
|
||||
return deploymentParameters;
|
||||
}
|
||||
|
||||
protected virtual ILogger CreateLogger(RuntimeFlavor flavor)
|
||||
|
|
@ -132,14 +142,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
}
|
||||
}
|
||||
|
||||
Command
|
||||
var command = Command
|
||||
.CreateDotNet("restore", args)
|
||||
.EnvironmentVariable(DotnetSkipFirstTimeExperience, "true")
|
||||
.ForwardStdErr(Console.Error)
|
||||
.ForwardStdOut(Console.Out)
|
||||
.CaptureStdErr()
|
||||
.CaptureStdOut()
|
||||
.WorkingDirectory(applicationDirectory)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
.Execute();
|
||||
|
||||
if (command.ExitCode != 0)
|
||||
{
|
||||
throw new Exception(
|
||||
$@"dotnet {command.StartInfo.Arguments} failed.
|
||||
===StdOut===
|
||||
{command.StdOut}
|
||||
===StdErr===
|
||||
{command.StdErr}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string CreateTempRestoreDirectory()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="0.3.0-*" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="1.0.0-preview2-003121" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="1.2.0-*" />
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
Hello from Index: AspNetCore._Views_Home_Index_cshtml, SimpleAppMvc11.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
|
||||
AspNetCore._Views_Shared__Layout_cshtml, SimpleAppMvc11.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact(Skip = "MVC #5736")]
|
||||
[ConditionalFact]
|
||||
[OSSkipConditionAttribute(OperatingSystems.Linux)]
|
||||
[OSSkipConditionAttribute(OperatingSystems.MacOSX)]
|
||||
public async Task Precompilation_WorksForSimpleApps()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact(Skip = "MVC #5736")]
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||
public async Task Precompilation_WorksForSimpleApps()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory(Skip = "MVC #5736")]
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
// 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.IO;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||
{
|
||||
public class ViewCompilationOptionsTest : IClassFixture<ViewCompilationOptionsTest.TestFixture>
|
||||
{
|
||||
public ViewCompilationOptionsTest(TestFixture fixture)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public void Precompilation_PreventsRefAssembliesFromBeingPublished(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
using (var deployer = Fixture.CreateDeployment(flavor))
|
||||
{
|
||||
// Act
|
||||
var deploymentResult = deployer.Deploy();
|
||||
|
||||
// Assert
|
||||
Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public void PublishingWithOption_AllowsPublishingRefAssemblies(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.PrepareForDeployment(flavor);
|
||||
var deploymentParameters = Fixture.GetDeploymentParameters(flavor);
|
||||
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||
|
||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.Logger))
|
||||
{
|
||||
// Act
|
||||
var deploymentResult = deployer.Deploy();
|
||||
|
||||
// Assert
|
||||
Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : ApplicationTestFixture
|
||||
{
|
||||
public TestFixture()
|
||||
: base("SimpleApp")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,4 +13,8 @@
|
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-*" />
|
||||
<PackageReference Include="xunit" Version="2.2.0-*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue