Delete src/MvcPrecompilation/**

- out-of-date and no longer shipped
- related to #3754
This commit is contained in:
Doug Bunting 2018-12-14 19:37:01 -08:00 committed by Doug Bunting
parent 6046ad27f6
commit 826f950530
186 changed files with 0 additions and 5850 deletions

View File

@ -1,43 +0,0 @@
[Oo]bj/
[Bb]in/
TestResults/
.nuget/
.build/
.testPublish/
*.sln.ide/
_ReSharper.*/
packages/
artifacts/
PublishProfiles/
.vs/
.vscode/
bower_components/
node_modules/
debugSettings.json
project.lock.json
*.user
*.suo
*.cache
*.docstates
_ReSharper.*
nuget.exe
*net45.csproj
*net451.csproj
*k10.csproj
*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
*.*sdf
*.ipch
.settings
*.sln.ide
node_modules
*launchSettings.json
*.orig
BuildInfo.generated.cs
msbuild.log
msbuild.binlog
global.json

View File

@ -1,19 +0,0 @@
<Project>
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
<Import Project="version.props" />
<Import Project="build\dependencies.props" />
<Import Project="build\sources.props" />
<PropertyGroup>
<Product>Microsoft ASP.NET Core</Product>
<RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>

View File

@ -1,10 +0,0 @@
<Project>
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion>
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
</PropertyGroup>
</Project>

View File

@ -1,21 +0,0 @@
{
"adx": {
"rules": [
"DefaultCompositeRule"
],
"packages": {
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation": {
"exclusions": {
"BUILD_ITEMS_FRAMEWORK": {
"*": "Purposefully creating a netstandard2.0 build item so our targets can be injected for desktop and non-desktop based projects."
}
}
}
}
},
"Default": {
"rules": [
"DefaultCompositeRule"
]
}
}

View File

@ -1,55 +0,0 @@
ASP.NET Core MVC Precompilation
===
## NOTE: This repo is solely for maintenance of the existing MVC precompilation feature. Future work on Razor compilation is now being handled in the [Razor](https://github.com/aspnet/razor) repo. See [aspnet/Razor#1740](https://github.com/aspnet/Razor/issues/1740) for additional details.
AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/jx955ph2045dw1w0/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/mvcprecompilation/branch/dev)
Travis: [![Travis](https://travis-ci.org/aspnet/MvcPrecompilation.svg?branch=dev)](https://travis-ci.org/aspnet/mvcprecompilation)
The Razor syntax provides a fast, terse, clean, and lightweight way to combine server code with HTML to create dynamic web content. This repo contains tooling that allows compilation of MVC Razor views as part of build and publish.
## Installation and usage
### Referencing the `Microsoft.AspNetCore.Mvc.Razor.ViewCompilation` package
* If you're targeting ASP.NET Core 2.0 or higher on netcoreapp2.0, a reference to the `Microsoft.AspNetCore.Mvc.Razor.ViewCompilation` package is added by `Microsoft.AspNetCore.All` and you do not need to explicitly reference it.
* For desktop targeting projects or projects targeting ASP.NET Core 1.x, add a package reference to the appropriate version of `Microsoft.AspNetCore.Mvc.Razor.ViewCompilation` in your project:
```xml
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="1.1.1" />
</ItemGroup>
```
### Enabling view compilation
View compilation as part of publishing is enabled by default if you're referencing the Web SDK (`Microsoft.NET.Sdk.Web`) that ships with .NET Core 2.0 or later versions. For older versions, add the `MvcRazorCompileOnPublish` property to your project:
```xml
<PropertyGroup>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
```
Alternatively, you may wire up the `MvcRazorPrecompile` target to a build event:
```xml
<Target
Name="PrecompileRazorViews"
AfterTargets="Build"
DependsOnTargets="MvcRazorPrecompile" />
```
## Options
Some aspects of view compilation can be configured by editing the project:
* `MvcRazorCompileOnPublish`: Setting this to `false` turns off all functions of view compilation that are enabled as part of publishing.
* `MvcRazorExcludeViewFilesFromPublish`: Enabling `MvcRazorCompileOnPublish` prevents .cshtml files from being published. This option disables this behavior.
Note: ASP.NET Core Mvc does not support updateable precompiled views. Any modifications to published cshtml files will be ignored if a precompiled view is discovered for that path.
* `MvcRazorExcludeRefAssembliesFromPublish`: Enabling `MvcRazorCompileOnPublish` causes the target to prevent the `refs` directory from being published. This option disables this behavior.
Note: Setting this option is useful if your application is using a mix of precompiled and runtime compiled views.
* `MvcRazorFilesToCompile`: An item group that specifies view files to compile. By default this includes all .cshtml files marked as content.
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.

View File

@ -1,312 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 15.0.26730.03
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
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{01707B64-7DC7-4B5A-B0BB-7CD2773AA297}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
NuGet.config = NuGet.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02F7AA35-91AF-491E-9F0E-03CFAF86C720}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-505E-4283-89DA-BBD9D28B53DB}"
ProjectSection(SolutionItems) = preProject
test\Directory.Build.props = test\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "test\FunctionalTests\FunctionalTests.csproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{87FEE984-F627-4F1E-8995-E5F969B85A19}"
ProjectSection(SolutionItems) = preProject
build\dependencies.props = build\dependencies.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}"
ProjectSection(SolutionItems) = preProject
testapps\Directory.Build.props = testapps\Directory.Build.props
testapps\Directory.Build.targets = testapps\Directory.Build.targets
EndProjectSection
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}") = "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}") = "ApplicationWithTagHelpers", "testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{08552602-37E7-48A7-95A2-BB1A1F57C804}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPagesApp", "testapps\RazorPagesApp\RazorPagesApp.csproj", "{779BACC4-B20E-4F73-A9C7-350443CF1941}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{75244EBD-DFBD-4C4B-9543-C135AC142C7F}"
ProjectSection(SolutionItems) = preProject
tools\Directory.Build.props = tools\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj", "{996D4DEB-1701-435E-8048-1E65790C2050}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithRazorSdkNeitherUsed", "testapps\ApplicationWithRazorSdkNeitherUsed\ApplicationWithRazorSdkNeitherUsed.csproj", "{B64D2B9C-5737-4A39-AA46-27757F345B1E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithRazorSdkPrecompilationUsed", "testapps\ApplicationWithRazorSdkPrecompilationUsed\ApplicationWithRazorSdkPrecompilationUsed.csproj", "{3147D272-E8E8-404D-A62C-35CD2C71FC05}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithRazorSdkUsed", "testapps\ApplicationWithRazorSdkUsed\ApplicationWithRazorSdkUsed.csproj", "{FAA20AFB-1B2E-4A0B-A421-B83741C81644}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x64.ActiveCfg = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x64.Build.0 = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x86.ActiveCfg = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x86.Build.0 = Debug|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|Any CPU.Build.0 = Release|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x64.ActiveCfg = Release|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x64.Build.0 = Release|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x86.ActiveCfg = Release|Any CPU
{4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x86.Build.0 = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x64.ActiveCfg = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x64.Build.0 = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x86.ActiveCfg = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x86.Build.0 = Debug|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|Any CPU.Build.0 = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x64.ActiveCfg = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x64.Build.0 = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x86.ActiveCfg = Release|Any CPU
{46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x86.Build.0 = Release|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x64.ActiveCfg = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x64.Build.0 = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x86.ActiveCfg = Debug|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x86.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
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x64.ActiveCfg = Release|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x64.Build.0 = Release|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.ActiveCfg = Release|Any CPU
{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|x64.Build.0 = Debug|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|x86.ActiveCfg = Debug|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|x86.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
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|x64.ActiveCfg = Release|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|x64.Build.0 = Release|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|x86.ActiveCfg = Release|Any CPU
{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Debug|x64.Build.0 = Debug|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Debug|x86.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
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|x64.ActiveCfg = Release|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|x64.Build.0 = Release|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|x86.ActiveCfg = Release|Any CPU
{D5677246-BC78-426D-9233-0313A04C6D92}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|x64.Build.0 = Debug|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|x86.ActiveCfg = Debug|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|x86.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
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|x64.ActiveCfg = Release|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|x64.Build.0 = Release|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|x86.ActiveCfg = Release|Any CPU
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|x64.Build.0 = Debug|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|x86.ActiveCfg = Debug|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|x86.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
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|x64.ActiveCfg = Release|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|x64.Build.0 = Release|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|x86.ActiveCfg = Release|Any CPU
{87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Debug|x64.Build.0 = Debug|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Debug|x86.ActiveCfg = Debug|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Debug|x86.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
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x64.ActiveCfg = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x64.Build.0 = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.ActiveCfg = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x64.Build.0 = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x86.ActiveCfg = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x86.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
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|x64.ActiveCfg = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|x64.Build.0 = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|x86.ActiveCfg = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|x64.Build.0 = Debug|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|x86.ActiveCfg = Debug|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|x86.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
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|x64.ActiveCfg = Release|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|x64.Build.0 = Release|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|x86.ActiveCfg = Release|Any CPU
{8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|x64.Build.0 = Debug|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|x86.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
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|x64.ActiveCfg = Release|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|x64.Build.0 = Release|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|x86.ActiveCfg = Release|Any CPU
{196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|x86.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}.Debug|x64.ActiveCfg = Debug|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|x64.Build.0 = Debug|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|x86.ActiveCfg = Debug|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|x86.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
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|x64.ActiveCfg = Release|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|x64.Build.0 = Release|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|x86.ActiveCfg = Release|Any CPU
{08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|x86.Build.0 = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|Any CPU.Build.0 = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|x64.ActiveCfg = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|x64.Build.0 = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|x86.ActiveCfg = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Debug|x86.Build.0 = Debug|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|Any CPU.ActiveCfg = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|Any CPU.Build.0 = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|x64.ActiveCfg = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|x64.Build.0 = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|x86.ActiveCfg = Release|Any CPU
{779BACC4-B20E-4F73-A9C7-350443CF1941}.Release|x86.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|Any CPU.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x64.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x64.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x86.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x86.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|Any CPU.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|Any CPU.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x64.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x64.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x86.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x86.Build.0 = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|x64.ActiveCfg = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|x64.Build.0 = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|x86.ActiveCfg = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Debug|x86.Build.0 = Debug|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|Any CPU.Build.0 = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|x64.ActiveCfg = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|x64.Build.0 = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|x86.ActiveCfg = Release|Any CPU
{B64D2B9C-5737-4A39-AA46-27757F345B1E}.Release|x86.Build.0 = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|x64.ActiveCfg = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|x64.Build.0 = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|x86.ActiveCfg = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Debug|x86.Build.0 = Debug|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|Any CPU.Build.0 = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|x64.ActiveCfg = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|x64.Build.0 = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|x86.ActiveCfg = Release|Any CPU
{3147D272-E8E8-404D-A62C-35CD2C71FC05}.Release|x86.Build.0 = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|x64.ActiveCfg = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|x64.Build.0 = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|x86.ActiveCfg = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Debug|x86.Build.0 = Debug|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|Any CPU.Build.0 = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|x64.ActiveCfg = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|x64.Build.0 = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|x86.ActiveCfg = Release|Any CPU
{FAA20AFB-1B2E-4A0B-A421-B83741C81644}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{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}
{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}
{08552602-37E7-48A7-95A2-BB1A1F57C804} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{779BACC4-B20E-4F73-A9C7-350443CF1941} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{996D4DEB-1701-435E-8048-1E65790C2050} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720}
{B64D2B9C-5737-4A39-AA46-27757F345B1E} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{3147D272-E8E8-404D-A62C-35CD2C71FC05} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{FAA20AFB-1B2E-4A0B-A421-B83741C81644} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {177268A1-F5B2-451E-8ABE-BEF0C572481A}
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@ -1,33 +0,0 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Label="Package Versions">
<InternalAspNetCoreSdkPackageVersion>3.0.0-alpha1-20180821.3</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreMvcRazorPagesPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreMvcRazorPagesPackageVersion>
<MicrosoftAspNetCoreRazorDesignPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreRazorDesignPackageVersion>
<MicrosoftAspNetCoreRazorRuntimePackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreRazorRuntimePackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.7.0-alpha1-10352</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>3.0.0-alpha1-10352</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftBuildTasksCorePackageVersion>15.6.82</MicrosoftBuildTasksCorePackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>3.0.0-alpha1-10352</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>3.0.0-alpha1-10352</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-alpha1-10352</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>3.0.0-alpha1-10352</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>3.0.0-alpha1-10352</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.2</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview1-26618-02</MicrosoftNETCoreApp22PackageVersion>
<MicrosoftNETSdkRazorPackageVersion>3.0.0-preview-18579-0056</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup>
<PropertyGroup Label="Package Versions: Pinned" />
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
</Project>

View File

@ -1,9 +0,0 @@
<Project>
<Import Project="dependencies.props" />
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,17 +0,0 @@
<Project>
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
<PropertyGroup Label="RestoreSources">
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true' AND '$(AspNetUniverseBuildOffline)' != 'true' ">
$(RestoreSources);
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json;
</RestoreSources>
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
$(RestoreSources);
https://api.nuget.org/v3/index.json;
</RestoreSources>
</PropertyGroup>
</Project>

View File

@ -1,7 +0,0 @@
<Project>
<Import Project="..\Directory.Build.props" />
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,21 +0,0 @@
// 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 Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.BuildTools
{
public class GetDotNetHost : Task
{
[Output]
public string MuxerPath { get; set; }
public override bool Execute()
{
MuxerPath = DotNetMuxer.MuxerPathOrDefault();
return true;
}
}
}

View File

@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Microsoft Build Tasks supporting Razor view compilation.</Description>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<EnableApiCheck>false</EnableApiCheck>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCorePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,46 +0,0 @@
// 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.Reflection;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal static class AssemblyMetadataGenerator
{
public static CSharpCompilation AddAssemblyMetadata(
CSharpCompiler compiler,
CSharpCompilation compilation,
CompilationOptions compilationOptions)
{
if (!string.IsNullOrEmpty(compilationOptions.KeyFile))
{
var updatedOptions = compilation.Options.WithStrongNameProvider(new DesktopStrongNameProvider());
var keyFilePath = Path.GetFullPath(compilationOptions.KeyFile);
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || compilationOptions.PublicSign)
{
updatedOptions = updatedOptions.WithCryptoPublicKey(
SnkUtils.ExtractPublicKey(File.ReadAllBytes(keyFilePath)));
}
else
{
updatedOptions = updatedOptions.WithCryptoKeyFile(keyFilePath)
.WithDelaySign(compilationOptions.DelaySign);
}
compilation = compilation.WithOptions(updatedOptions);
}
var applicationAssemblyName = Assembly.Load(new AssemblyName(compilationOptions.ApplicationName)).GetName();
var assemblyVersionContent = $"[assembly:{typeof(AssemblyVersionAttribute).FullName}(\"{applicationAssemblyName.Version}\")]";
var syntaxTree = compiler.CreateSyntaxTree(SourceText.From(assemblyVersionContent));
return compilation.AddSyntaxTrees(syntaxTree);
}
}
}

View File

@ -1,105 +0,0 @@
// 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 Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal class CompilationOptions
{
public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type";
public static readonly string ContentRootTemplate = "--content-root";
public static readonly string EmbedViewSourceTemplate = "--embed-view-sources";
public static readonly string StrongNameKeyPath = "--key-file";
public static readonly string DelaySignTemplate = "--delay-sign";
public static readonly string PublicSignTemplate = "--public-sign";
public static readonly string ApplicationNameTemplate = "--application-name";
public static readonly string OutputPathTemplate = "--output-path";
public static readonly string ViewsToCompileTemplate = "--file";
public CompilationOptions(CommandLineApplication app)
{
OutputPathOption = app.Option(
OutputPathTemplate,
"Path to the emit the precompiled assembly to.",
CommandOptionType.SingleValue);
ApplicationNameOption = app.Option(
ApplicationNameTemplate,
"Name of the application to produce precompiled assembly for.",
CommandOptionType.SingleValue);
ProjectArgument = app.Argument(
"project",
"The path to the project file.");
ConfigureCompilationType = app.Option(
ConfigureCompilationTypeTemplate,
"Type with Configure method",
CommandOptionType.SingleValue);
ContentRootOption = app.Option(
ContentRootTemplate,
"The application's content root.",
CommandOptionType.SingleValue);
EmbedViewSourcesOption = app.Option(
EmbedViewSourceTemplate,
"Embed view sources as resources in the generated assembly.",
CommandOptionType.NoValue);
KeyFileOption = app.Option(
StrongNameKeyPath,
"Strong name key path.",
CommandOptionType.SingleValue);
DelaySignOption = app.Option(
DelaySignTemplate,
"Determines if the precompiled view assembly is to be delay signed.",
CommandOptionType.NoValue);
PublicSignOption = app.Option(
PublicSignTemplate,
"Determines if the precompiled view assembly is to be public signed.",
CommandOptionType.NoValue);
ViewsToCompileOption = app.Option(
ViewsToCompileTemplate,
"Razor files to compile.",
CommandOptionType.MultipleValue);
}
public CommandArgument ProjectArgument { get; }
public CommandOption ConfigureCompilationType { get; }
public CommandOption ContentRootOption { get; }
public CommandOption EmbedViewSourcesOption { get; }
public CommandOption KeyFileOption { get; }
public CommandOption DelaySignOption { get; }
public CommandOption PublicSignOption { get; }
public CommandOption OutputPathOption { get; }
public CommandOption ApplicationNameOption { get; }
public CommandOption ViewsToCompileOption { get; }
public string OutputPath => OutputPathOption.Value();
public string ApplicationName => ApplicationNameOption.Value();
public string KeyFile => KeyFileOption.Value();
public bool DelaySign => DelaySignOption.HasValue();
public bool PublicSign => PublicSignOption.HasValue();
public List<string> ViewsToCompile => ViewsToCompileOption.Values;
}
}

View File

@ -1,25 +0,0 @@
// 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.
#if DEBUG
using System;
using System.Diagnostics;
using System.Linq;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal static class DebugHelper
{
public static void HandleDebugSwitch(ref string[] args)
{
if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase))
{
args = args.Skip(1).ToArray();
Console.WriteLine("Waiting for debugger to attach. Press ENTER to continue");
Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}");
Console.ReadLine();
}
}
}
}
#endif

View File

@ -1,124 +0,0 @@
// 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.Diagnostics;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Razor.Extensions;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal class MvcServiceProvider
{
private readonly string _projectPath;
private readonly string _contentRoot;
private readonly string _applicationName;
public MvcServiceProvider(
string projectPath,
string applicationName,
string contentRoot,
string configureCompilationType)
{
_projectPath = projectPath;
_contentRoot = contentRoot;
_applicationName = applicationName;
var mvcBuilderConfiguration = GetConfigureCompilationAction(configureCompilationType);
var serviceProvider = GetProvider(mvcBuilderConfiguration);
Engine = serviceProvider.GetRequiredService<RazorEngine>();
TemplateEngine = new MvcRazorTemplateEngine(Engine, serviceProvider.GetRequiredService<RazorProject>())
{
Options =
{
ImportsFileName = "_ViewImports.cshtml",
}
};
Compiler = serviceProvider.GetRequiredService<CSharpCompiler>();
ViewEngineOptions = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>().Value;
}
public MvcRazorTemplateEngine TemplateEngine { get; }
public RazorEngine Engine { get; }
public CSharpCompiler Compiler { get; }
public RazorViewEngineOptions ViewEngineOptions { get; }
private IDesignTimeMvcBuilderConfiguration GetConfigureCompilationAction(string configureCompilationType)
{
Type type;
if (!string.IsNullOrEmpty(configureCompilationType))
{
type = Type.GetType(configureCompilationType);
if (type == null)
{
throw new InvalidOperationException($"Unable to find type '{type}.");
}
}
else
{
var assemblyName = new AssemblyName(_applicationName);
var assembly = Assembly.Load(assemblyName);
type = assembly
.GetExportedTypes()
.FirstOrDefault(typeof(IDesignTimeMvcBuilderConfiguration).IsAssignableFrom);
}
if (type == null)
{
return null;
}
var instance = Activator.CreateInstance(type) as IDesignTimeMvcBuilderConfiguration;
if (instance == null)
{
throw new InvalidOperationException($"Type {configureCompilationType} does not implement " +
$"{typeof(IDesignTimeMvcBuilderConfiguration)}.");
}
return instance;
}
private IServiceProvider GetProvider(IDesignTimeMvcBuilderConfiguration mvcBuilderConfiguration)
{
var services = new ServiceCollection();
var hostingEnvironment = new HostingEnvironment
{
ApplicationName = _applicationName,
WebRootFileProvider = new PhysicalFileProvider(_projectPath),
ContentRootFileProvider = new PhysicalFileProvider(_contentRoot),
ContentRootPath = _contentRoot,
};
var diagnosticSource = new DiagnosticListener("Microsoft.AspNetCore");
services
.AddSingleton<IHostingEnvironment>(hostingEnvironment)
.AddSingleton<DiagnosticSource>(diagnosticSource)
.AddLogging()
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();
var mvcCoreBuilder = services
.AddMvcCore()
.AddRazorViewEngine();
var mvcBuilder = new MvcBuilder(mvcCoreBuilder.Services, mvcCoreBuilder.PartManager);
mvcBuilderConfiguration?.ConfigureMvc(mvcBuilder);
return mvcBuilder.Services.BuildServiceProvider();
}
}
}

View File

@ -1,80 +0,0 @@
// 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.Collections.Generic;
using System.IO;
using System.Reflection;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal class PrecompilationApplication : CommandLineApplication
{
private readonly Type _callingType;
public PrecompilationApplication(Type callingType)
{
_callingType = callingType;
Name = "razor-precompile";
FullName = "Microsoft Razor Precompilation Utility";
Description = "Precompiles Razor views.";
ShortVersionGetter = GetInformationalVersion;
HelpOption("-?|-h|--help");
OnExecute(() =>
{
ShowHelp();
return 2;
});
}
public new int Execute(params string[] args)
{
try
{
return base.Execute(ExpandResponseFiles(args));
}
catch (AggregateException ex) when (ex.InnerException != null)
{
Error.WriteLine(ex.InnerException.Message);
Error.WriteLine(ex.InnerException.StackTrace);
return 1;
}
catch (Exception ex)
{
Error.WriteLine(ex.Message);
Error.WriteLine(ex.StackTrace);
return 1;
}
}
private string GetInformationalVersion()
{
var assembly = _callingType.GetTypeInfo().Assembly;
var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
return attribute.InformationalVersion;
}
private static string[] ExpandResponseFiles(string[] args)
{
var expandedArgs = new List<string>();
foreach (var arg in args)
{
if (!arg.StartsWith("@", StringComparison.Ordinal))
{
expandedArgs.Add(arg);
}
else
{
var fileName = arg.Substring(1);
expandedArgs.AddRange(File.ReadLines(fileName));
}
}
return expandedArgs.ToArray();
}
}
}

View File

@ -1,264 +0,0 @@
// 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.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal class PrecompileRunCommand
{
private static readonly ParallelOptions ParalellOptions = new ParallelOptions
{
MaxDegreeOfParallelism = 4
};
private CommandLineApplication Application { get; set; }
private MvcServiceProvider MvcServiceProvider { get; set; }
private CompilationOptions Options { get; set; }
private string ProjectPath { get; set; }
public void Configure(CommandLineApplication app)
{
Application = app;
Options = new CompilationOptions(app);
app.OnExecute(() => Execute());
}
private int Execute()
{
if (!ParseArguments())
{
return 1;
}
MvcServiceProvider = new MvcServiceProvider(
ProjectPath,
Options.ApplicationNameOption.Value(),
Options.ContentRootOption.Value(),
Options.ConfigureCompilationType.Value());
var results = GenerateCode();
var success = true;
foreach (var result in results)
{
if (result.CSharpDocument.Diagnostics.Count > 0)
{
success = false;
foreach (var error in result.CSharpDocument.Diagnostics)
{
Application.Error.WriteLine($"{result.ViewFileInfo.FullPath} ({error.Span.LineIndex}): {error.GetMessage()}");
}
}
}
if (!success)
{
return 1;
}
var precompileAssemblyName = $"{Options.ApplicationName}.PrecompiledViews";
var compilation = CompileViews(results, precompileAssemblyName);
var resources = GetResources(results);
var assemblyPath = Path.Combine(Options.OutputPath, precompileAssemblyName + ".dll");
var emitResult = EmitAssembly(
compilation,
MvcServiceProvider.Compiler.EmitOptions,
assemblyPath,
resources);
if (!emitResult.Success)
{
foreach (var diagnostic in emitResult.Diagnostics)
{
Application.Error.WriteLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic));
}
return 1;
}
return 0;
}
private ResourceDescription[] GetResources(ViewCompilationInfo[] results)
{
if (!Options.EmbedViewSourcesOption.HasValue())
{
return new ResourceDescription[0];
}
var resources = new ResourceDescription[results.Length];
for (var i = 0; i < results.Length; i++)
{
var fileInfo = results[i].ViewFileInfo;
resources[i] = new ResourceDescription(
fileInfo.ViewEnginePath,
fileInfo.CreateReadStream,
isPublic: true);
}
return resources;
}
public EmitResult EmitAssembly(
CSharpCompilation compilation,
EmitOptions emitOptions,
string assemblyPath,
ResourceDescription[] resources)
{
EmitResult emitResult;
using (var assemblyStream = new MemoryStream())
{
using (var pdbStream = new MemoryStream())
{
emitResult = compilation.Emit(
assemblyStream,
pdbStream,
manifestResources: resources,
options: emitOptions);
if (emitResult.Success)
{
Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath));
var pdbPath = Path.ChangeExtension(assemblyPath, ".pdb");
assemblyStream.Position = 0;
pdbStream.Position = 0;
// Avoid writing to disk unless the compilation is successful.
using (var assemblyFileStream = File.OpenWrite(assemblyPath))
{
assemblyStream.CopyTo(assemblyFileStream);
}
using (var pdbFileStream = File.OpenWrite(pdbPath))
{
pdbStream.CopyTo(pdbFileStream);
}
}
}
}
return emitResult;
}
private CSharpCompilation CompileViews(ViewCompilationInfo[] results, string assemblyname)
{
var compiler = MvcServiceProvider.Compiler;
var compilation = compiler.CreateCompilation(assemblyname);
var syntaxTrees = new SyntaxTree[results.Length];
Parallel.For(0, results.Length, ParalellOptions, i =>
{
var result = results[i];
var sourceText = SourceText.From(result.CSharpDocument.GeneratedCode, Encoding.UTF8);
var fileInfo = result.ViewFileInfo;
var syntaxTree = compiler.CreateSyntaxTree(sourceText)
.WithFilePath(fileInfo.FullPath ?? fileInfo.ViewEnginePath);
syntaxTrees[i] = syntaxTree;
});
compilation = compilation.AddSyntaxTrees(syntaxTrees);
// Post process the compilation - run ExpressionRewritter and any user specified callbacks.
compilation = ExpressionRewriter.Rewrite(compilation);
var compilationContext = new RoslynCompilationContext(compilation);
#pragma warning disable CS0618 // Type or member is obsolete
MvcServiceProvider.ViewEngineOptions.CompilationCallback(compilationContext);
#pragma warning restore CS0618 // Type or member is obsolete
compilation = AssemblyMetadataGenerator.AddAssemblyMetadata(
compiler,
compilationContext.Compilation,
Options);
return compilation;
}
private bool ParseArguments()
{
ProjectPath = Options.ProjectArgument.Value;
if (string.IsNullOrEmpty(ProjectPath))
{
Application.Error.WriteLine("Project path not specified.");
return false;
}
if (!Options.OutputPathOption.HasValue())
{
Application.Error.WriteLine($"Option {CompilationOptions.OutputPathTemplate} does not specify a value.");
return false;
}
if (!Options.ApplicationNameOption.HasValue())
{
Application.Error.WriteLine($"Option {CompilationOptions.ApplicationNameTemplate} does not specify a value.");
return false;
}
if (!Options.ContentRootOption.HasValue())
{
Application.Error.WriteLine($"Option {CompilationOptions.ContentRootTemplate} does not specify a value.");
return false;
}
return true;
}
private ViewCompilationInfo[] GenerateCode()
{
var files = GetRazorFiles();
var results = new ViewCompilationInfo[files.Count];
Parallel.For(0, results.Length, ParalellOptions, i =>
{
var fileInfo = files[i];
var templateEngine = MvcServiceProvider.TemplateEngine;
ViewCompilationInfo compilationInfo;
using (var fileStream = fileInfo.CreateReadStream())
{
var csharpDocument = templateEngine.GenerateCode(fileInfo.ViewEnginePath);
compilationInfo = new ViewCompilationInfo(fileInfo, csharpDocument);
}
results[i] = compilationInfo;
});
return results;
}
private List<ViewFileInfo> GetRazorFiles()
{
var contentRoot = Options.ContentRootOption.Value();
var viewFiles = Options.ViewsToCompile;
var viewFileInfo = new List<ViewFileInfo>(viewFiles.Count);
var trimLength = contentRoot.EndsWith("/") ? contentRoot.Length - 1 : contentRoot.Length;
for (var i = 0; i < viewFiles.Count; i++)
{
var fullPath = viewFiles[i];
if (fullPath.StartsWith(contentRoot, StringComparison.OrdinalIgnoreCase))
{
var viewEnginePath = fullPath.Substring(trimLength).Replace('\\', '/');
viewFileInfo.Add(new ViewFileInfo(fullPath, viewEnginePath));
}
}
return viewFileInfo;
}
}
}

View File

@ -1,88 +0,0 @@
// 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.Collections.Immutable;
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
internal static class SnkUtils
{
const byte PUBLICKEYBLOB = 0x06;
const byte PRIVATEKEYBLOB = 0x07;
private const uint CALG_RSA_SIGN = 0x00002400;
private const uint CALG_SHA = 0x00008004;
private const uint RSA1 = 0x31415352; //"RSA1" publickeyblob
private const uint RSA2 = 0x32415352; //"RSA2" privatekeyblob
private const int VersionOffset = 1;
private const int ModulusLengthOffset = 12;
private const int ExponentOffset = 16;
private const int MagicPrivateKeyOffset = 8;
private const int MagicPublicKeyOffset = 20;
public static ImmutableArray<byte> ExtractPublicKey(byte[] snk)
{
ValidateBlob(snk);
if (snk[0] != PRIVATEKEYBLOB)
{
return ImmutableArray.Create(snk);
}
var version = snk[VersionOffset];
int modulusBitLength = ReadInt32(snk, ModulusLengthOffset);
uint exponent = (uint)ReadInt32(snk, ExponentOffset);
var modulus = new byte[modulusBitLength >> 3];
Array.Copy(snk, 20, modulus, 0, modulus.Length);
return CreatePublicKey(version, exponent, modulus);
}
private static void ValidateBlob(byte[] snk)
{
// 160 - the size of public key
if (snk.Length >= 160)
{
if (snk[0] == PRIVATEKEYBLOB && ReadInt32(snk, MagicPrivateKeyOffset) == RSA2 || // valid private key
snk[12] == PUBLICKEYBLOB && ReadInt32(snk, MagicPublicKeyOffset) == RSA1) // valid public key
{
return;
}
}
throw new InvalidOperationException("Invalid key file.");
}
private static int ReadInt32(byte[] array, int index)
{
return array[index] | array[index + 1] << 8 | array[index + 2] << 16 | array[index + 3] << 24;
}
private static ImmutableArray<byte> CreatePublicKey(byte version, uint exponent, byte[] modulus)
{
using (var ms = new MemoryStream(160))
using (var binaryWriter = new BinaryWriter(ms))
{
binaryWriter.Write(CALG_RSA_SIGN);
binaryWriter.Write(CALG_SHA);
// total size of the rest of the blob (20 - size of RSAPUBKEY)
binaryWriter.Write(modulus.Length + 20);
binaryWriter.Write(PUBLICKEYBLOB);
binaryWriter.Write(version);
binaryWriter.Write((ushort)0x00000000); // reserved
binaryWriter.Write(CALG_RSA_SIGN);
binaryWriter.Write(RSA1);
binaryWriter.Write(modulus.Length << 3);
binaryWriter.Write(exponent);
binaryWriter.Write(modulus);
return ImmutableArray.Create(ms.ToArray());
}
}
}
}

View File

@ -1,22 +0,0 @@
// 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 Microsoft.AspNetCore.Razor.Language;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal struct ViewCompilationInfo
{
public ViewCompilationInfo(
ViewFileInfo viewFileInfo,
RazorCSharpDocument cSharpDocument)
{
ViewFileInfo = viewFileInfo;
CSharpDocument = cSharpDocument;
}
public ViewFileInfo ViewFileInfo { get; }
public RazorCSharpDocument CSharpDocument { get; }
}
}

View File

@ -1,34 +0,0 @@
// 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;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
internal struct ViewFileInfo
{
public ViewFileInfo(string fullPath, string viewEnginePath)
{
FullPath = fullPath;
ViewEnginePath = viewEnginePath;
}
public string FullPath { get; }
public string ViewEnginePath { get; }
public Stream CreateReadStream()
{
// We are setting buffer size to 1 to prevent FileStream from allocating it's internal buffer
// 0 causes constructor to throw
var bufferSize = 1;
return new FileStream(
FullPath,
FileMode.Open,
FileAccess.Read,
FileShare.ReadWrite,
bufferSize,
FileOptions.Asynchronous | FileOptions.SequentialScan);
}
}
}

View File

@ -1,88 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
<PreserveCompilationContext>true</PreserveCompilationContext>
<OutputType>exe</OutputType>
<TasksProjectDirectory>..\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\</TasksProjectDirectory>
<IncludeBuildOutput>false</IncludeBuildOutput>
<EnableApiCheck>false</EnableApiCheck>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TasksProjectDirectory)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="$(MicrosoftAspNetCoreMvcRazorPagesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Update="Microsoft.NETCore.App" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<SignedPackageFile Include="$(TargetPath)" PackagePath="build/netstandard2.0/netcoreapp2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<SignedPackageFile Include="$(TargetDir)\$(AssemblyName)-x86.exe" PackagePath="build/netstandard2.0/net461/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe" Certificate="$(AssemblySigningCertName)" />
<SignedPackageFile Include="$(TargetDir)\$(AssemblyName).exe" PackagePath="build/netstandard2.0/net461/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.exe" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == ''">
<SignedPackageFile Include="$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.dll;" PackagePath="build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
<Target Name="BuildX86" AfterTargets="Build" Condition="'$(TargetFramework)'=='net461' AND '$(PlatformTarget)'!='x86'">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="Build"
Properties="
Configuration=$(Configuration);
TargetFramework=$(TargetFramework);
Platform=x86;
BuildNumber=$(BuildNumber);
OutputPath=$(OutputPath);
TargetName=$(TargetName)-x86" />
</Target>
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="BuildX86">
<PropertyGroup>
<!-- Make sure we create a symbols.nupkg. -->
<IncludeSymbols>true</IncludeSymbols>
<!-- RepositoryCommit is only available when "build" runs, but not during dotnet pack -->
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">unknown</RepositoryCommit>
<NuspecProperties>
id=$(PackageId);
version=$(PackageVersion);
authors=$(Authors);
MicrosoftAspNetCoreHostingPackageVersion=$(MicrosoftAspNetCoreHostingPackageVersion);
MicrosoftAspNetCoreMvcRazorPagesPackageVersion=$(MicrosoftAspNetCoreMvcRazorPagesPackageVersion);
description=$(Description);
tags=$(PackageTags.Replace(';', ' '));
licenseUrl=$(PackageLicenseUrl);
projectUrl=$(PackageProjectUrl);
iconUrl=$(PackageIconUrl);
repositoryUrl=$(RepositoryUrl);
repositoryCommit=$(RepositoryCommit);
copyright=$(Copyright);
AssemblyName=$(AssemblyName);
OutputBinary=$(OutputPath)netcoreapp2.0\$(AssemblyName).dll;
OutputSymbol=$(OutputPath)netcoreapp2.0\$(AssemblyName).pdb;
TaskBinary=$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.dll;
TaskSymbol=$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.pdb;
OutputExeX86=$(OutputPath)net461\$(AssemblyName)-x86.exe;
OutputExeSymbolX86=$(OutputPath)net461\$(AssemblyName)-x86.pdb;
OutputExeAnyCPU=$(OutputPath)net461\$(AssemblyName).exe;
OutputExeSymbolAnyCPU=$(OutputPath)net461\$(AssemblyName).pdb;
</NuspecProperties>
</PropertyGroup>
</Target>
</Project>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<authors>$authors$</authors>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<iconUrl>$iconUrl$</iconUrl>
<description>$description$</description>
<copyright>$copyright$</copyright>
<tags>$tags$</tags>
<repository type="git" url="$repositoryUrl$" commit="$repositoryCommit$" />
<dependencies>
<group targetFramework=".NETFramework4.6.1">
<dependency id="Microsoft.AspNetCore.Hosting" version="$MicrosoftAspNetCoreHostingPackageVersion$" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.RazorPages" version="$MicrosoftAspNetCoreMvcRazorPagesPackageVersion$" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETCoreApp2.0">
<dependency id="Microsoft.AspNetCore.Hosting" version="$MicrosoftAspNetCoreHostingPackageVersion$" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.RazorPages" version="$MicrosoftAspNetCoreMvcRazorPagesPackageVersion$" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
<files>
<file src="build\**\*" target="build\" />
<file src="$OutputBinary$" target="build\netstandard2.0\netcoreapp2.0\" />
<file src="$OutputSymbol$" target="build\netstandard2.0\netcoreapp2.0\" />
<file src="$OutputExeX86$" target="build\netstandard2.0\net461\" />
<file src="$OutputExeSymbolX86$" target="build\netstandard2.0\net461\" />
<file src="$OutputExeAnyCPU$" target="build\netstandard2.0\net461\" />
<file src="$OutputExeSymbolAnyCPU$" target="build\netstandard2.0\net461\" />
<file src="$TaskBinary$" target="build\netstandard2.0\$AssemblyName$.Tasks.dll" />
<file src="$TaskSymbol$" target="build\netstandard2.0\$AssemblyName$.Tasks.pdb" />
</files>
</package>

View File

@ -1,24 +0,0 @@
// 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 Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
{
internal class Program
{
private readonly static Type ProgramType = typeof(Program);
public static int Main(string[] args)
{
#if DEBUG
DebugHelper.HandleDebugSwitch(ref args);
#endif
var app = new PrecompilationApplication(ProgramType);
new PrecompileRunCommand().Configure(app);
return app.Execute(args);
}
}
}

View File

@ -1,7 +0,0 @@
// 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")]

View File

@ -1,4 +0,0 @@
{
"AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": []
}

View File

@ -1,206 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="_ResolveInputArguments">
<PropertyGroup>
<MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'==''">$(IntermediateOutputPath)</MvcRazorOutputPath>
<_MvcRazorOutputFullPath Condition="'$(_MvcRazorOutputFullPath)'==''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))$(AssemblyName).PrecompiledViews.dll</_MvcRazorOutputFullPath>
<_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp</_MvcRazorResponseFilePath>
<MvcRazorContentRoot Condition="'$(MvcRazorContentRoot)'==''">$(MSBuildProjectDirectory)</MvcRazorContentRoot>
<MvcRazorExcludeViewFilesFromPublish Condition="'$(MvcRazorExcludeViewFilesFromPublish)'==''">true</MvcRazorExcludeViewFilesFromPublish>
<MvcRazorExcludeRefAssembliesFromPublish Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'==''">true</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>
<ItemGroup Condition="'@(MvcRazorFilesToCompile)' == ''">
<MvcRazorFilesToCompile Include="@(Content)" Condition="'%(Extension)'=='.cshtml'" />
</ItemGroup>
</Target>
<Target
Name="MvcRazorPrecompile"
DependsOnTargets="_ResolveInputArguments"
Inputs="@(MvcRazorFilesToCompile);@(IntermediateAssembly);@(DocFileItem);@(_DebugSymbolsIntermediatePath);@(ReferencePath);$(MSBuildAllProjects)"
Outputs="$(_MvcRazorOutputFullPath)">
<CallTarget Targets="_MvcRazorPrecompile" />
</Target>
<Target Name="_MvcRazorPrecompile" DependsOnTargets="_RunForCore;_RunForCoreWithRID;_RunForDesktop" />
<PropertyGroup>
<_MvcViewCompilationTasksPath Condition="'$(_MvcViewCompilationTasksPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Tasks.dll</_MvcViewCompilationTasksPath>
</PropertyGroup>
<UsingTask TaskName="GetDotNetHost" AssemblyFile="$(_MvcViewCompilationTasksPath)" />
<Target
Name="_RunForCore"
DependsOnTargets="_CreateResponseFileForMvcRazorPrecompile"
Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' AND '$(RuntimeIdentifier)'==''">
<!--
GetDotNetHost attempts to locate the muxer path if the executing process is a .NET Core application i.e. dotnet msbuild.
If we know we're being launched from desktop MSBuild, avoid running the task. We'll use the dotnet that appears in the path.
-->
<GetDotNetHost Condition="'$(MSBuildRuntimeType)'=='Core' AND '$(MvcRazorRunCommand)'==''">
<Output TaskParameter="MuxerPath" PropertyName="MvcRazorRunCommand" />
</GetDotNetHost>
<PropertyGroup>
<MvcRazorRunCommand Condition="'$(MvcRazorRunCommand)'==''">dotnet</MvcRazorRunCommand>
<_MvcViewCompilationBinariesDir Condition="'$(_MvcViewCompilationBinariesDir)' == ''">$(MSBuildThisFileDirectory)</_MvcViewCompilationBinariesDir>
<_MvcViewCompilationBinaryPath>$(_MvcViewCompilationBinariesDir)netcoreapp2.0\$(MSBuildThisFileName).dll</_MvcViewCompilationBinaryPath>
<ExecArgs>&quot;$(MvcRazorRunCommand)&quot; exec</ExecArgs>
<ExecArgs>$(ExecArgs) --runtimeconfig &quot;$(ProjectRuntimeConfigFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) --depsfile &quot;$(ProjectDepsFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) &quot;$(_MvcViewCompilationBinaryPath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) @&quot;$(_MvcRazorResponseFilePath)&quot;</ExecArgs>
</PropertyGroup>
<Exec Command="$(ExecArgs)" WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>
<Target
Name="_RunForCoreWithRID"
DependsOnTargets="_ResolveInputArguments;_CreateResponseFileForMvcRazorPrecompile"
Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' AND '$(RuntimeIdentifier)'!=''">
<ItemGroup>
<_RazorCompilationProject Include="$(MSBuildProjectFullPath)">
<AdditionalProperties>RuntimeIdentifier=;MvcRazorOutputPath=$(MvcRazorOutputPath)</AdditionalProperties>
</_RazorCompilationProject>
</ItemGroup>
<MSBuild
Projects="@(_RazorCompilationProject)"
Targets="Build;MvcRazorPrecompile" />
</Target>
<Target Name="_ResolveBinaryPath">
<PropertyGroup>
<_MvcViewCompilationBinariesDir Condition="'$(_MvcViewCompilationBinariesDir)' == ''">$(MSBuildThisFileDirectory)</_MvcViewCompilationBinariesDir>
<_MvcViewCompilationBinaryPath Condition="'$(PlatformTarget)'=='x86'">$(_MvcViewCompilationBinariesDir)net461\$(MSBuildThisFileName)-x86.exe</_MvcViewCompilationBinaryPath>
<_MvcViewCompilationBinaryPath Condition="'$(PlatformTarget)'!='x86'">$(_MvcViewCompilationBinariesDir)net461\$(MSBuildThisFileName).exe</_MvcViewCompilationBinaryPath>
</PropertyGroup>
</Target>
<Target
Name="_AddDesktopReferences"
AfterTargets="ResolveLockFileReferences"
Condition="'$(MvcRazorCompileOnPublish)'=='true' AND '$(ResolvedRazorCompileToolset)'=='PrecompilationTool' AND '$(TargetFrameworkIdentifier)'=='.NETFramework'">
<ItemGroup Condition="'$(_MvcViewCompilationBinaryPath)'!=''">
<Reference Include="$(_MvcViewCompilationBinaryPath)" Private="false" Visible="false" />
</ItemGroup>
</Target>
<Target
Name="_RunForDesktop"
DependsOnTargets="_ResolveBinaryPath;_AddDesktopReferences;_CreateResponseFileForMvcRazorPrecompile"
Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'">
<PropertyGroup>
<_MvcViewCompilationBinaryName>$([System.IO.Path]::GetFileName('$(_MvcViewCompilationBinaryPath)'))</_MvcViewCompilationBinaryName>
</PropertyGroup>
<ItemGroup>
<_PreCompilationFilesToCopy
Include="$(OutputPath)$(AssemblyName).exe.config"
Destination="$(OutputPath)$(_MvcViewCompilationBinaryName).config" />
<_PreCompilationFilesToCopy
Include="$(_MvcViewCompilationBinaryPath)"
Destination="$(OutputPath)$(_MvcViewCompilationBinaryName)" />
</ItemGroup>
<PropertyGroup Condition="'$(MvcRazorRunCommand)'==''">
<MvcRazorRunCommand>$(OutputPath)$(_MvcViewCompilationBinaryName)</MvcRazorRunCommand>
</PropertyGroup>
<Copy
SourceFiles="@(_PreCompilationFilesToCopy)"
DestinationFiles="%(Destination)" />
<Exec
Command="&quot;$(MvcRazorRunCommand)&quot; @&quot;$(_MvcRazorResponseFilePath)&quot;"
WorkingDirectory="$(MSBuildProjectDirectory)"/>
<Delete Files="%(_PreCompilationFilesToCopy.Destination)" />
</Target>
<Target Name="_CreateResponseFileForMvcRazorPrecompile">
<ItemGroup>
<_ResponseFileLines Include="
$(MSBuildProjectDirectory);
--output-path=$(MvcRazorOutputPath);
--application-name=$(AssemblyName);
--content-root=$(MvcRazorContentRoot);" />
<_ResponseFileLines
Condition="'$(MvcRazorEmbedViewSources)'=='true'"
Include="--embed-view-sources" />
<_ResponseFileLines Include="--file=%(MvcRazorFilesToCompile.FullPath)" />
</ItemGroup>
<ItemGroup Condition="'$(SignAssembly)'=='true'">
<_ResponseFileLines
Condition="'$(DelaySign)'=='true'"
Include="--delay-sign" />
<_ResponseFileLines
Condition="'$(PublicSign)'=='true'"
Include="--public-sign" />
<_ResponseFileLines Include="--key-file=$(AssemblyOriginatorKeyFile)" />
</ItemGroup>
<WriteLinesToFile
File="$(_MvcRazorResponseFilePath)"
Lines="@(_ResponseFileLines)"
Overwrite="true" />
</Target>
<Target
Name="_MvcRazorPrecompileOnPublish"
DependsOnTargets="MvcRazorPrecompile"
AfterTargets="PrepareForPublish"
Condition="'$(ResolvedRazorCompileToolset)'=='PrecompilationTool' and '$(MvcRazorCompileOnPublish)'=='true'" />
<Target Name="_MvcRazorResolveFilesToCompute"
AfterTargets="ComputeRefAssembliesToPublish"
Condition="'$(ResolvedRazorCompileToolset)'=='PrecompilationTool' and '$(MvcRazorCompileOnPublish)'=='true'">
<PropertyGroup>
<_MvcRazorOutputPdbFullPath>$([System.IO.Path]::ChangeExtension('$(_MvcRazorOutputFullPath)', '.pdb'))</_MvcRazorOutputPdbFullPath>
</PropertyGroup>
<ItemGroup>
<ResolvedFileToPublish
Remove="%(MvcRazorFilesToCompile.FullPath)"
Condition="'$(MvcRazorExcludeViewFilesFromPublish)'=='true'" />
<ResolvedFileToPublish Include="$(_MvcRazorOutputFullPath)"
CopyToPublishDirectory="Always"
Condition="'$(CopyBuildOutputToPublishDirectory)'=='true' AND Exists('$(_MvcRazorOutputFullPath)')">
<RelativePath>$([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)'))</RelativePath>
</ResolvedFileToPublish>
<ResolvedFileToPublish Include="$(_MvcRazorOutputPdbFullPath)"
CopyToPublishDirectory="Always"
Condition="'$(CopyOutputSymbolsToPublishDirectory)'=='true'AND Exists('$(_MvcRazorOutputPdbFullPath)')">
<RelativePath>$([System.IO.Path]::GetFileName('$(_MvcRazorOutputPdbFullPath)'))</RelativePath>
</ResolvedFileToPublish>
</ItemGroup>
<ItemGroup Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'=='true'">
<ResolvedFileToPublish
Remove="%(ResolvedFileToPublish.Identity)"
Condition="'%(ResolvedFileToPublish.RelativePath)'=='$(RefAssembliesFolderName)\%(Filename)%(Extension)'" />
</ItemGroup>
</Target>
</Project>

View File

@ -1,18 +0,0 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.2</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,62 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ApplicationWithConfigureMvcTest_CoreCLR
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
{
public ApplicationWithConfigureMvcTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response);
}
}
[Fact]
public async Task Precompilation_UsesConfiguredParseOptions()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/ViewWithPreprocessor",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent(
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
response);
}
}
}
}

View File

@ -1,105 +0,0 @@
// 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 Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ApplicationWithCustomInputFilesTest_CoreCLR
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
{
public ApplicationWithCustomInputFilesTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task ApplicationWithCustomInputFiles_Works()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var expectedText = "Hello Index!";
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
Assert.Equal(expectedText, response.Trim());
}
}
[Fact]
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var expectedViews = new[]
{
"/Views/Home/About.cshtml",
"/Views/Home/Index.cshtml",
};
// Act
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/GetPrecompiledResourceNames",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
}
[Fact]
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var viewsNotPublished = new[]
{
"Index.cshtml",
"About.cshtml",
};
var viewsPublished = new[]
{
"NotIncluded.cshtml",
};
var viewsDirectory = Path.Combine(deployment.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.");
}
foreach (var file in viewsNotPublished)
{
var filePath = Path.Combine(viewsDirectory, file);
Assert.False(File.Exists(filePath), $"{filePath} was published.");
}
}
}
}
}

View File

@ -1,49 +0,0 @@
// 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 Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace FunctionalTests
{
public class ApplicationWithParseErrorsTest_CoreCLR
: IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup>>
{
public ApplicationWithParseErrorsTest_CoreCLR(CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup> fixture)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact(Skip = "Flaky test in many build configurations. See issue #277.")]
public async Task PublishingPrintsParseErrors()
{
// Arrange
var indexPath = Path.Combine(Fixture.TestProjectDirectory, "Views", "Home", "Index.cshtml");
var viewImportsPath = Path.Combine(Fixture.TestProjectDirectory, "Views", "Home", "About.cshtml");
var expectedErrors = new[]
{
indexPath + " (0): The code block is missing a closing \"}\" character. Make sure you have a matching \"}\" character for all the \"{\" characters within this block, and that none of the \"}\" characters are being interpreted as markup.",
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.",
};
var testSink = new TestSink();
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
// Act
await Assert.ThrowsAsync<Exception>(() => Fixture.CreateDeploymentAsync(loggerFactory));
// Assert
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
foreach (var expectedError in expectedErrors)
{
Assert.Contains(logs, log => log.Contains(expectedError));
}
}
}
}

View File

@ -1,75 +0,0 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ApplicationWithTagHelpersTest_CoreCLR :
LoggedTest, IClassFixture<ApplicationWithTagHelpersTest_CoreCLR.ApplicationWithTagHelpersTestFixture>
{
public ApplicationWithTagHelpersTest_CoreCLR(
ApplicationWithTagHelpersTestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/ClassLibraryTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response);
}
}
[Fact]
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/LocalTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response);
}
}
public class ApplicationWithTagHelpersTestFixture : CoreCLRApplicationTestFixture<ApplicationWithTagHelpers.Startup>
{
protected override Task<DeploymentResult> CreateDeploymentAsyncCore(ILoggerFactory loggerFactory)
{
CopyDirectory(
new DirectoryInfo(Path.Combine(ApplicationPath, "..", "ClassLibraryTagHelper")),
new DirectoryInfo(Path.Combine(WorkingDirectory, "ClassLibraryTagHelper")));
return base.CreateDeploymentAsyncCore(loggerFactory);
}
}
}
}

View File

@ -1,29 +0,0 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
namespace FunctionalTests
{
public class CoreCLRApplicationTestFixture<TStartup> : ApplicationTestFixture
{
private const string TargetFramework =
#if NETCOREAPP2_2
"netcoreapp2.2";
#else
#error Target frameworks need to be updated
#endif
public CoreCLRApplicationTestFixture()
: this(typeof(TStartup).Assembly.GetName().Name, null)
{
}
protected CoreCLRApplicationTestFixture(string applicationName, string applicationPath)
: base(applicationName, applicationPath)
{
}
protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.CoreClr, TargetFramework);
}
}

View File

@ -1,62 +0,0 @@
// 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.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class PublishWithEmbedViewSourcesTest_CoreCLR
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
{
public PublishWithEmbedViewSourcesTest_CoreCLR(
CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_CanEmbedViewSourcesAsResources()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var logger = loggerFactory.CreateLogger(Fixture.ApplicationName);
var expectedViews = new[]
{
"/Areas/TestArea/Views/Home/Index.cshtml",
"/Views/Home/About.cshtml",
"/Views/Home/Index.cshtml",
};
var expectedText = "Hello Index!";
// Act - 1
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/Index",
logger);
// Assert - 1
Assert.Equal(expectedText, response1.Trim());
// Act - 2
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/GetPrecompiledResourceNames",
logger);
// Assert - 2
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
}
}
}

View File

@ -1,134 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class RazorPagesAppTest_CoreCLR :
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<RazorPagesApp.Startup>>
{
public RazorPagesAppTest_CoreCLR(
CoreCLRApplicationTestFixture<RazorPagesApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksForIndexPage_UsingFolderName()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
}
}
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksForIndexPage_UsingFileName()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/Index",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
}
}
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksForPageWithModel()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/PageWithModel?person=Dan",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
}
}
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksForPageWithRoute()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/PageWithRoute/Dan",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
}
}
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksForPageInNestedFolder()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/Nested1/Nested2/PageWithTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
}
}
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
public async Task Precompilation_WorksWithPageConventions()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await RetryHelper.RetryRequest(
() => deployment.HttpClient.GetAsync("/Auth/Index"),
loggerFactory.CreateLogger(Fixture.ApplicationName),
retryCount: 5);
// Assert
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
}
}
}
}

View File

@ -1,46 +0,0 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
public class RazorSdkNeitherUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkNeitherUsed.Startup>>
{
public RazorSdkNeitherUsedTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkNeitherUsed.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Publish_HasNoPrecompilation()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await RetryHelper.RetryRequest(
() => deployment.HttpClient.GetAsync(deployment.ApplicationBaseUri),
loggerFactory.CreateLogger(Fixture.ApplicationName),
retryCount: 5);
// Assert
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkNeitherUsed.PrecompiledViews.dll")));
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkNeitherUsed.Views.dll")));
}
}
}
}

View File

@ -1,45 +0,0 @@
// 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 Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
public class RazorSdkPrecompilationUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkPrecompilationUsed.Startup>>
{
public RazorSdkPrecompilationUsedTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkPrecompilationUsed.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Publish_UsesRazorSDK()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
Assert.True(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkPrecompilationUsed.PrecompiledViews.dll")));
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkPrecompilationUsed.Views.dll")));
TestEmbeddedResource.AssertContent("ApplicationWithRazorSdkPrecompilationUsed.Home.Index.txt", response);
}
}
}
}

View File

@ -1,47 +0,0 @@
// 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 Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
public class RazorSdkUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkUsed.Startup>>
{
public RazorSdkUsedTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkUsed.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Publish_UsesRazorSDK()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var expectedViewLocation = Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkUsed.Views.dll");
var expectedPrecompiledViewsLocation = Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkUsed.PrecompiledViews.dll");
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
Assert.False(File.Exists(expectedPrecompiledViewsLocation), $"{expectedPrecompiledViewsLocation} existed, but shouldn't have.");
Assert.True(File.Exists(expectedViewLocation), $"{expectedViewLocation} didn't exist.");
TestEmbeddedResource.AssertContent("ApplicationWithRazorSdkUsed.Home.Index.txt", response);
}
}
}
}

View File

@ -1,42 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class SimpleAppTest_CoreCLR :
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<SimpleApp.Startup>>
{
public SimpleAppTest_CoreCLR(
CoreCLRApplicationTestFixture<SimpleApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_WorksForSimpleApps()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
}
}
}
}

View File

@ -1,52 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class SimpleAppWithAssemblyRenameTest_CoreCLR :
LoggedTest, IClassFixture<SimpleAppWithAssemblyRenameTest_CoreCLR.TestFixture>
{
public SimpleAppWithAssemblyRenameTest_CoreCLR(
TestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_WorksForSimpleApps()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
}
}
public class TestFixture : CoreCLRApplicationTestFixture<SimpleAppWithAssemblyRename.Startup>
{
public TestFixture()
: base(
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
{
}
}
}
}

View File

@ -1,42 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class StrongNamedAppTest_CoreCLR :
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<StrongNamedApp.Startup>>
{
public StrongNamedAppTest_CoreCLR(
CoreCLRApplicationTestFixture<StrongNamedApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response);
}
}
}
}

View File

@ -1,57 +0,0 @@
// 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 System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished :
LoggedTest, IClassFixture<ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
{
public ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished(
TestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task PublishingWithOption_AllowsPublishingRefAssemblies()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act & Assert
Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs")));
}
}
public class TestFixture : CoreCLRApplicationTestFixture<SimpleApp.Startup>
{
public TestFixture()
{
PublishOnly = true;
}
protected override DeploymentParameters GetDeploymentParameters()
{
var deploymentParameters = base.GetDeploymentParameters();
deploymentParameters.PublishEnvironmentVariables.Add(
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
return deploymentParameters;
}
}
}
}

View File

@ -1,65 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationWithConfigureMvcTest_Desktop
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
{
public ApplicationWithConfigureMvcTest_Desktop(
DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_UsesConfiguredParseOptions()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/ViewWithPreprocessor",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent(
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
response);
}
}
}
}

View File

@ -1,108 +0,0 @@
// 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 Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationWithCustomInputFilesTest_Desktop
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
{
public ApplicationWithCustomInputFilesTest_Desktop(
DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task ApplicationWithCustomInputFiles_Works()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var expectedText = "Hello Index!";
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
Assert.Equal(expectedText, response.Trim());
}
}
[ConditionalFact]
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var expectedViews = new[]
{
"/Views/Home/About.cshtml",
"/Views/Home/Index.cshtml",
};
// Act
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/GetPrecompiledResourceNames",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
}
[ConditionalFact]
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var viewsNotPublished = new[]
{
"Index.cshtml",
"About.cshtml",
};
var viewsPublished = new[]
{
"NotIncluded.cshtml",
};
var viewsDirectory = Path.Combine(deployment.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.");
}
foreach (var file in viewsNotPublished)
{
var filePath = Path.Combine(viewsDirectory, file);
Assert.False(File.Exists(filePath), $"{filePath} was published.");
}
}
}
}
}

View File

@ -1,52 +0,0 @@
// 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 Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationWithParseErrorsTest_Desktop
: IClassFixture<DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup>>
{
public ApplicationWithParseErrorsTest_Desktop(DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup> fixture)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact(Skip = "Flaky test in many build configurations.See issue #277.")]
public async Task PublishingPrintsParseErrors()
{
// Arrange
var indexPath = Path.Combine(Fixture.TestProjectDirectory, "Views", "Home", "Index.cshtml");
var viewImportsPath = Path.Combine(Fixture.TestProjectDirectory, "Views", "Home", "About.cshtml");
var expectedErrors = new[]
{
indexPath + " (0): The code block is missing a closing \"}\" character. Make sure you have a matching \"}\" character for all the \"{\" characters within this block, and that none of the \"}\" characters are being interpreted as markup.",
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.",
};
var testSink = new TestSink();
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
// Act
await Assert.ThrowsAsync<Exception>(() => Fixture.CreateDeploymentAsync(loggerFactory));
// Assert
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
foreach (var expectedError in expectedErrors)
{
Assert.Contains(logs, log => log.Contains(expectedError));
}
}
}
}

View File

@ -1,78 +0,0 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationWithTagHelpersTest_Desktop :
LoggedTest, IClassFixture<ApplicationWithTagHelpersTest_Desktop.ApplicationWithTagHelpersTestFixture>
{
public ApplicationWithTagHelpersTest_Desktop(
ApplicationWithTagHelpersTestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/ClassLibraryTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/LocalTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response);
}
}
public class ApplicationWithTagHelpersTestFixture : DesktopApplicationTestFixture<ApplicationWithTagHelpers.Startup>
{
protected override Task<DeploymentResult> CreateDeploymentAsyncCore(ILoggerFactory loggerFactory)
{
CopyDirectory(
new DirectoryInfo(Path.Combine(ApplicationPath, "..", "ClassLibraryTagHelper")),
new DirectoryInfo(Path.Combine(WorkingDirectory, "ClassLibraryTagHelper")));
return base.CreateDeploymentAsyncCore(loggerFactory);
}
}
}
}

View File

@ -1,22 +0,0 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
namespace FunctionalTests
{
public class DesktopApplicationTestFixture<TStartup> : ApplicationTestFixture
{
public DesktopApplicationTestFixture()
: this(typeof(TStartup).Assembly.GetName().Name, null)
{
}
protected DesktopApplicationTestFixture(string applicationName, string applicationPath)
: base(applicationName, applicationPath)
{
}
protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.Clr, "net461");
}
}

View File

@ -1,65 +0,0 @@
// 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.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class PublishWithEmbedViewSourcesTest_Desktop
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
{
public PublishWithEmbedViewSourcesTest_Desktop(
DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_CanEmbedViewSourcesAsResources()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
var logger = loggerFactory.CreateLogger(Fixture.ApplicationName);
var expectedViews = new[]
{
"/Areas/TestArea/Views/Home/Index.cshtml",
"/Views/Home/About.cshtml",
"/Views/Home/Index.cshtml",
};
var expectedText = "Hello Index!";
// Act - 1
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/Index",
logger);
// Assert - 1
Assert.Equal(expectedText, response1.Trim());
// Act - 2
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
"Home/GetPrecompiledResourceNames",
logger);
// Assert - 2
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
Assert.Equal(expectedViews, actual);
}
}
}
}

View File

@ -1,137 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class RazorPagesAppTest_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<RazorPagesApp.Startup>>
{
public RazorPagesAppTest_Desktop(
DesktopApplicationTestFixture<RazorPagesApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForIndexPage_UsingFolderName()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForIndexPage_UsingFileName()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/Index",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForPageWithModel()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/PageWithModel?person=Dan",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForPageWithRoute()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/PageWithRoute/Dan",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForPageInNestedFolder()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
"/Nested1/Nested2/PageWithTagHelper",
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksWithPageConventions()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await RetryHelper.RetryRequest(
() => deployment.HttpClient.GetAsync("/Auth/Index"),
loggerFactory.CreateLogger(Fixture.ApplicationName),
retryCount: 5);
// Assert
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
}
}
}
}

View File

@ -1,57 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class SimpleAppTestWithPlatformx86_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<SimpleApp.Startup>>
{
public SimpleAppTestWithPlatformx86_Desktop(
DesktopApplicationTestFixture<SimpleApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_PublishingForPlatform()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
}
}
public class SimpleAppTestWithPlatformx86_DesktopFixture : DesktopApplicationTestFixture<SimpleApp.Startup>
{
protected override DeploymentParameters GetDeploymentParameters()
{
var parameters = base.GetDeploymentParameters();
parameters.AdditionalPublishParameters = "/p:Platform=x86";
return parameters;
}
}
}
}

View File

@ -1,46 +0,0 @@
// 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 Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class SimpleAppTest_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<SimpleApp.Startup>>
{
public SimpleAppTest_Desktop(
DesktopApplicationTestFixture<SimpleApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForSimpleApps()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
}
}
}
}

View File

@ -1,55 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class SimpleAppWithAssemblyRenameTest_Desktop :
LoggedTest, IClassFixture<SimpleAppWithAssemblyRenameTest_Desktop.TestFixture>
{
public SimpleAppWithAssemblyRenameTest_Desktop(
TestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForSimpleApps()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
}
}
public class TestFixture : DesktopApplicationTestFixture<SimpleAppWithAssemblyRename.Startup>
{
public TestFixture()
: base(
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
{
}
}
}
}

View File

@ -1,45 +0,0 @@
// 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.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class StrongNamedAppTest_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<StrongNamedApp.Startup>>
{
public StrongNamedAppTest_Desktop(
DesktopApplicationTestFixture<StrongNamedApp.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response);
}
}
}
}

View File

@ -1,60 +0,0 @@
// 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 System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished :
LoggedTest, IClassFixture<ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
{
public ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished(
TestFixture fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task PublishingWithOption_AllowsPublishingRefAssemblies()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act & Assert
Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs")));
}
}
public class TestFixture : DesktopApplicationTestFixture<SimpleApp.Startup>
{
public TestFixture()
{
PublishOnly = true;
}
protected override DeploymentParameters GetDeploymentParameters()
{
var deploymentParameters = base.GetDeploymentParameters();
deploymentParameters.PublishEnvironmentVariables.Add(
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
return deploymentParameters;
}
}
}
}

View File

@ -1,50 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<DefineConstants>$(DefineConstants);__remove_this_to__GENERATE_BASELINES</DefineConstants>
<DefineConstants Condition="'$(GenerateBaseLines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
<SignAssembly>false</SignAssembly>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net461'">win7-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\*" />
<Compile Include="Infrastructure\*.cs" />
<Compile Include="DesktopTests\*.cs" Condition="'$(TargetFramework)'=='net461'" />
<Compile Include="CoreCLRTests\*.cs" Condition="'$(TargetFramework)'=='netcoreapp2.2'" />
</ItemGroup>
<ItemGroup>
<None Remove="CoreCLRTests\RazorSdkNeitherUsedTest_CoreCLR.cs" />
<None Remove="CoreCLRTests\RazorSdkPrecompilationUsedTest_CoreCLR.cs" />
<None Remove="Resources\ApplicationWithRazorSdkPrecompilationUsed.Home.Index.txt" />
<None Remove="Resources\ApplicationWithRazorSdkUsed.Home.Index.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithRazorSdkNeitherUsed\ApplicationWithRazorSdkNeitherUsed.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithRazorSdkPrecompilationUsed\ApplicationWithRazorSdkPrecompilationUsed.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithRazorSdkUsed\ApplicationWithRazorSdkUsed.csproj" />
<ProjectReference Include="..\..\testapps\PublishWithEmbedViewSources\PublishWithEmbedViewSources.csproj" />
<ProjectReference Include="..\..\testapps\RazorPagesApp\RazorPagesApp.csproj" />
<ProjectReference Include="..\..\testapps\SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj" />
<ProjectReference Include="..\..\testapps\SimpleApp\SimpleApp.csproj" />
<ProjectReference Include="..\..\testapps\StrongNamedApp\StrongNamedApp.csproj" />
</ItemGroup>
</Project>

View File

@ -1,39 +0,0 @@
// 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;
namespace FunctionalTests
{
public static class ApplicationPaths
{
private const string SolutionName = "RazorViewCompilation.sln";
public static string SolutionDirectory { get; } = GetSolutionDirectory();
public static string ArtifactPackagesDirectory => Path.Combine(SolutionDirectory, "artifacts", "build");
public static string GetTestAppDirectory(string appName) =>
Path.Combine(SolutionDirectory, "testapps", appName);
private static string GetSolutionDirectory()
{
var applicationBasePath = AppContext.BaseDirectory;
var directoryInfo = new DirectoryInfo(applicationBasePath);
do
{
var solutionFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, SolutionName));
if (solutionFileInfo.Exists)
{
return directoryInfo.FullName;
}
directoryInfo = directoryInfo.Parent;
} while (directoryInfo.Parent != null);
throw new InvalidOperationException($"Solution directory could not be found for {applicationBasePath}.");
}
}
}

View File

@ -1,188 +0,0 @@
// 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.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Logging;
namespace FunctionalTests
{
public abstract class ApplicationTestFixture : IDisposable
{
private const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
private static readonly string SolutionDirectory;
private Task<DeploymentResult> _deploymentTask;
private ApplicationDeployer _deployer;
static ApplicationTestFixture()
{
SolutionDirectory = TestPathUtilities.GetSolutionRootDirectory("RazorViewCompilation");
if (!SolutionDirectory.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
SolutionDirectory += Path.DirectorySeparatorChar;
}
}
protected ApplicationTestFixture(string applicationName, string applicationPath)
{
ApplicationName = applicationName;
ApplicationPath = applicationPath ?? ApplicationPaths.GetTestAppDirectory(applicationName);
WorkingDirectory = Path.Combine(Path.GetTempPath(), "PrecompilationTool", Path.GetRandomFileName());
TestProjectDirectory = Path.Combine(WorkingDirectory, ApplicationName);
}
public string ApplicationName { get; }
public string ApplicationPath { get; }
public string WorkingDirectory { get; }
public string TestProjectDirectory { get; }
public bool PublishOnly { get; set; }
protected abstract DeploymentParameters GetDeploymentParameters();
protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor, string targetFramework)
=> GetDeploymentParameters(TestProjectDirectory, ApplicationName, flavor, targetFramework);
private static DeploymentParameters GetDeploymentParameters(string applicationPath, string applicationName, RuntimeFlavor flavor, string targetFramework)
{
// This determines the configuration of the the test project and consequently the configuration the src projects are most likely built in.
var projectConfiguration =
#if DEBUG
"Debug";
#elif RELEASE
"Release";
#else
#error Unknown configuration
#endif
var deploymentParameters = new DeploymentParameters(
applicationPath,
ServerType.Kestrel,
flavor,
RuntimeArchitecture.x64)
{
ApplicationName = applicationName,
ApplicationType = flavor == RuntimeFlavor.Clr ? ApplicationType.Standalone : ApplicationType.Portable,
PublishApplicationBeforeDeployment = true,
Configuration = projectConfiguration,
EnvironmentVariables =
{
new KeyValuePair<string, string>(DotnetCLITelemetryOptOut, "1"),
new KeyValuePair<string, string>("SolutionDirectory", SolutionDirectory),
new KeyValuePair<string, string>("SolutionConfiguration", projectConfiguration),
},
PublishEnvironmentVariables =
{
new KeyValuePair<string, string>(DotnetCLITelemetryOptOut, "1"),
new KeyValuePair<string, string>("SolutionDirectory", SolutionDirectory),
new KeyValuePair<string, string>("SolutionConfiguration", projectConfiguration),
},
TargetFramework = targetFramework,
};
return deploymentParameters;
}
public void Dispose()
{
if (_deploymentTask?.Status == TaskStatus.RanToCompletion)
{
_deploymentTask.Result.HttpClient?.Dispose();
}
CleanupWorkingDirectory();
_deployer?.Dispose();
}
public Task<DeploymentResult> CreateDeploymentAsync(ILoggerFactory loggerFactory)
{
if (_deploymentTask == null)
{
_deploymentTask = CreateDeploymentAsyncCore(loggerFactory);
}
return _deploymentTask;
}
protected virtual Task<DeploymentResult> CreateDeploymentAsyncCore(ILoggerFactory loggerFactory)
{
CopyDirectory(new DirectoryInfo(ApplicationPath), new DirectoryInfo(TestProjectDirectory));
File.Copy(Path.Combine(SolutionDirectory, "global.json"), Path.Combine(TestProjectDirectory, "global.json"));
File.Copy(Path.Combine(ApplicationPath, "..", "Directory.Build.props"), Path.Combine(TestProjectDirectory, "Directory.Build.props"));
File.Copy(Path.Combine(ApplicationPath, "..", "Directory.Build.targets"), Path.Combine(TestProjectDirectory, "Directory.Build.targets"));
var deploymentParameters = GetDeploymentParameters();
if (PublishOnly)
{
_deployer = new PublishOnlyDeployer(deploymentParameters, loggerFactory);
}
else
{
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory);
}
return _deployer.DeployAsync();
}
public void CopyDirectory(DirectoryInfo source, DirectoryInfo destination, bool recursive = true)
{
// Recurse into subdirectories
foreach (var directory in source.EnumerateDirectories())
{
if (directory.Name == "bin")
{
continue;
}
var created = destination.CreateSubdirectory(directory.Name);
// We only want to copy the restore artifacts from obj directory while ignoring in any configuration specific directories
CopyDirectory(directory, created, recursive: directory.Name != "obj");
}
foreach (var file in source.EnumerateFiles())
{
file.CopyTo(Path.Combine(destination.FullName, file.Name));
}
}
private void CleanupWorkingDirectory()
{
var tries = 5;
var sleep = TimeSpan.FromSeconds(3);
for (var i = 0; i < tries; i++)
{
try
{
if (Directory.Exists(WorkingDirectory))
{
Directory.Delete(WorkingDirectory, recursive: true);
}
return;
}
catch when (i < tries - 1)
{
Console.WriteLine($"Failed to delete directory {TestProjectDirectory}, trying again.");
Thread.Sleep(sleep);
}
catch
{
// Do nothing
}
}
}
}
}

View File

@ -1,38 +0,0 @@
// 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.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging;
using Xunit;
namespace FunctionalTests
{
public static class HttpClientExtensions
{
public static Task<string> GetStringWithRetryAsync(
this HttpClient httpClient,
ILogger logger)
{
return GetStringWithRetryAsync(httpClient, httpClient.BaseAddress.AbsoluteUri, logger);
}
public static async Task<string> GetStringWithRetryAsync(
this HttpClient httpClient,
string url,
ILogger logger)
{
var response = await RetryHelper.RetryRequest(() => httpClient.GetAsync(url), logger, retryCount: 5);
var content = await response.Content.ReadAsStringAsync();
Assert.True(response.IsSuccessStatusCode,
$"Failed to GET content from {url}. Status code {response.StatusCode}." +
Environment.NewLine +
content);
return content;
}
}
}

View File

@ -1,47 +0,0 @@
// 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.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
public class PublishOnlyDeployer : SelfHostDeployer
{
public PublishOnlyDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory)
: base(deploymentParameters, loggerFactory)
{
}
public override Task<DeploymentResult> DeployAsync()
{
using (Logger.BeginScope("SelfHost.Deploy"))
{
// Start timer
StartTimer();
if (DeploymentParameters.PublishApplicationBeforeDeployment)
{
DotnetPublish();
}
var result = new DeploymentResult(
LoggerFactory,
DeploymentParameters,
applicationBaseUri: "http://localhost",
contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath,
hostShutdownToken: default(CancellationToken));
return Task.FromResult(result);
}
}
}
}

View File

@ -1,58 +0,0 @@
// 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.Reflection;
using Xunit;
namespace FunctionalTests
{
public static class TestEmbeddedResource
{
private static readonly object _writeLock = new object();
private static readonly string ProjectName = typeof(TestEmbeddedResource).GetTypeInfo().Assembly.GetName().Name;
public static void AssertContent(string resourceFile, string actual)
{
var expected = GetResourceContent(resourceFile);
#if GENERATE_BASELINES
// Normalize line endings to '\r\n' for comparison. This removes Environment.NewLine from the equation. Not
// worth updating files just because we generate baselines on a different system.
var normalizedContent = actual.Replace("\r", "").Replace("\n", "\r\n");
if (!string.Equals(expected, normalizedContent, System.StringComparison.Ordinal))
{
var solutionRoot = ApplicationPaths.SolutionDirectory;
var projectName = typeof(TestEmbeddedResource).GetTypeInfo().Assembly.GetName().Name;
var fullPath = Path.Combine(solutionRoot, "test", ProjectName, "Resources", resourceFile);
lock (_writeLock)
{
// Write content to the file, creating it if necessary.
File.WriteAllText(fullPath, actual);
}
}
#else
Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
#endif
}
private static string GetResourceContent(string resourceFile)
{
resourceFile = $"{ProjectName}.Resources.{resourceFile}";
var assembly = typeof(TestEmbeddedResource).GetTypeInfo().Assembly;
var resourceStream = assembly.GetManifestResourceStream(resourceFile);
if (resourceStream == null)
{
return null;
}
using (var streamReader = new StreamReader(resourceStream))
{
// Normalize line endings to '\r\n' (CRLF). This removes core.autocrlf, core.eol, core.safecrlf, and
// .gitattributes from the equation and treats "\r\n" and "\n" as equivalent. Does not handle
// some line endings like "\r" but otherwise ensures checksums and line mappings are consistent.
return streamReader.ReadToEnd().Replace("\r", "").Replace("\n", "\r\n");
}
}
}
}

View File

@ -1,3 +0,0 @@
using Xunit;
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<body>
ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
<h1>Admin home page</h1>
Test section
</body>
</html>

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<body>
ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello from Index!
</body>
</html>

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<body>
ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello from Index!
</body>
</html>

View File

@ -1,2 +0,0 @@
ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
<br />Hello world!

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<body>
ApplicationWithRazorSdkPrecompilationUsed.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello from Index!
</body>
</html>

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<body>
ApplicationWithRazorSdkUsed.Views, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello from Index!
</body>
</html>

View File

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title> - ApplicationWithTagHelpers</title>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
</head>
<body>
<div class="container body-content">
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
<div><b>To boldy tag that no one has ever tagged before...</b></div>
<hr />
<footer>
<p>&copy; 2016 - ApplicationWithTagHelpers</p>
</footer>
</div>
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
</body>
</html>

View File

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title> - ApplicationWithTagHelpers</title>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
</head>
<body>
<div class="container body-content">
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
<test href="/Home/About">TestTagHelper content.</test>
<hr />
<footer>
<p>&copy; 2016 - ApplicationWithTagHelpers</p>
</footer>
</div>
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
</body>
</html>

View File

@ -1,2 +0,0 @@
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>

View File

@ -1,165 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home Page - SimpleApp</title>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
<link rel="stylesheet" href="/css/site.min.css" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">SimpleApp</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/Home/About">About</a></li>
<li><a href="/Home/Contact">Contact</a></li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Learn how to build ASP.NET apps that can run anywhere.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
There are powerful new features in Visual Studio for building modern web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="/images/banner3.svg" alt="Package Management" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="row">
<div class="col-md-3">
<h2>Application uses</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
</div>
<hr />
<footer>
<p>&copy; 2016 - SimpleApp</p>
</footer>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js">
</script>
<script>(window.jQuery||document.write("\u003Cscript src=\u0022\/lib\/jquery\/dist\/jquery.min.js\u0022\u003E\u003C\/script\u003E"));</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js">
</script>
<script>(window.jQuery && window.jQuery.fn && window.jQuery.fn.modal||document.write("\u003Cscript src=\u0022\/lib\/bootstrap\/dist\/js\/bootstrap.min.js\u0022\u003E\u003C\/script\u003E"));</script>
<script src="/js/site.min.js"></script>
SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
</body>
</html>

View File

@ -1,2 +0,0 @@
NewAssemblyName.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

View File

@ -1 +0,0 @@
Hello from view in StrongNamedApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

View File

@ -1,11 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj" />
</ItemGroup>
</Project>

View File

@ -1,220 +0,0 @@
// 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.Reflection;
using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
{
public class PrecompileRunCommandTest
{
[Fact]
public void RunPrintsHelp_WhenHelpOptionIsSpecified()
{
// Arrange
var expected =
$@"Microsoft Razor Precompilation Utility {GetToolVersion()}
Usage: razor-precompile [arguments] [options]
Arguments:
project The path to the project file.
Options:
-?|-h|--help Show help information
--output-path Path to the emit the precompiled assembly to.
--application-name Name of the application to produce precompiled assembly for.
--configure-compilation-type Type with Configure method
--content-root The application's content root.
--embed-view-sources Embed view sources as resources in the generated assembly.
--key-file Strong name key path.
--delay-sign Determines if the precompiled view assembly is to be delay signed.
--public-sign Determines if the precompiled view assembly is to be public signed.
--file Razor files to compile.";
var args = new[]
{
"--help"
};
// Act
var result = Execute(args);
// Assert
Assert.Equal(0, result.ExitCode);
Assert.Equal(expected, result.Out.Trim(), ignoreLineEndingDifferences: true);
Assert.Empty(result.Error);
}
[Fact]
public void Run_PrintsHelpWhenInvalidOptionsAreSpecified()
{
// Arrange
var expectedOut = @"Specify --help for a list of available options and commands.";
var expectedError = @"Unrecognized option '--bad-option'";
var args = new[]
{
"--bad-option"
};
// Act
var result = Execute(args);
// Assert
Assert.Equal(1, result.ExitCode);
Assert.Equal(expectedOut, result.Out.Trim());
Assert.Equal(
expectedError,
result.Error.Split(new[] { Environment.NewLine }, StringSplitOptions.None).First());
}
[Fact]
public void Run_PrintsErrorWhenArgumentIsMissing()
{
// Arrange
var expectedError = @"Project path not specified.";
var args = new string[0];
// Act
var result = Execute(args);
// Assert
Assert.Equal(1, result.ExitCode);
Assert.Empty(result.Out);
Assert.Equal(expectedError, result.Error.Trim());
}
[Fact]
public void Run_PrintsErrorWhenOutputPathOptionIsMissing()
{
// Arrange
var expectedError = @"Option --output-path does not specify a value.";
var args = new[]
{
Directory.GetCurrentDirectory(),
};
// Act
var result = Execute(args);
// Assert
Assert.Equal(1, result.ExitCode);
Assert.Empty(result.Out);
Assert.Equal(expectedError, result.Error.Trim());
}
[Fact]
public void Run_PrintsErrorWhenApplicationNameOptionIsMissing()
{
// Arrange
var expectedError = @"Option --application-name does not specify a value.";
var args = new[]
{
Directory.GetCurrentDirectory(),
"--output-path",
Directory.GetCurrentDirectory(),
};
// Act
var result = Execute(args);
// Assert
Assert.Equal(1, result.ExitCode);
Assert.Empty(result.Out);
Assert.Equal(expectedError, result.Error.Trim());
}
[Fact]
public void Run_PrintsErrorWhenContentRootOptionIsMissing()
{
// Arrange
var expectedError = @"Option --content-root does not specify a value.";
var args = new[]
{
Directory.GetCurrentDirectory(),
"--output-path",
Directory.GetCurrentDirectory(),
"--application-name",
"TestApplicationName",
};
// Act
var result = Execute(args);
// Assert
Assert.Equal(1, result.ExitCode);
Assert.Empty(result.Out);
Assert.Equal(expectedError, result.Error.Trim());
}
[Fact]
public void EmitAssembly_DoesNotWriteAssembliesToDisk_IfCompilationFails()
{
// Arrange
var assemblyDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
var assemblyPath = Path.Combine(assemblyDirectory, "out.dll");
var precompileRunCommand = new PrecompileRunCommand();
var syntaxTree = CSharpSyntaxTree.ParseText("using Microsoft.DoestNotExist");
var compilation = CSharpCompilation.Create("Test.dll", new[] { syntaxTree });
// Act
var emitResult = precompileRunCommand.EmitAssembly(
compilation,
new EmitOptions(),
assemblyPath,
new ResourceDescription[0]);
// Assert
Assert.False(emitResult.Success);
Assert.False(Directory.Exists(assemblyDirectory));
Assert.False(File.Exists(assemblyPath));
}
private static string GetToolVersion()
{
return typeof(Program)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion;
}
private class ExecuteResult
{
public string Out { get; set; }
public string Error { get; set; }
public int ExitCode { get; set; }
}
private ExecuteResult Execute(string[] args)
{
using (var outputWriter = new StringWriter())
using (var errorWriter = new StringWriter())
{
var app = new PrecompilationApplication(typeof(Program))
{
Out = outputWriter,
Error = errorWriter,
};
new PrecompileRunCommand().Configure(app);
var exitCode = app.Execute(args);
return new ExecuteResult
{
ExitCode = exitCode,
Out = outputWriter.ToString(),
Error = errorWriter.ToString(),
};
}
}
}
}

View File

@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<DefineConstants>$(DefineConstants);TEST123</DefineConstants>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,11 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationWithConfigureStartup.Controllers
{
public class HomeController : Controller
{
public IActionResult Index() => View();
public IActionResult ViewWithPreprocessor() => View();
}
}

View File

@ -1,26 +0,0 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithConfigureStartup
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

View File

@ -1,21 +0,0 @@
using System;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace ApplicationWithConfigureStartup
{
public class RazorRewriter : CSharpSyntaxRewriter
{
public override SyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node)
{
if (node.Token.IsKind(SyntaxKind.StringLiteralToken))
{
return node.WithToken(SyntaxFactory.Literal(
node.Token.ValueText.Replace(Environment.NewLine, Environment.NewLine + "<br />")));
}
return node;
}
}
}

View File

@ -1,48 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ApplicationWithConfigureStartup
{
public class Startup : IDesignTimeMvcBuilderConfiguration
{
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
var builder = services.AddMvc();
ConfigureMvc(builder);
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
public void ConfigureMvc(IMvcBuilder builder)
{
builder.AddRazorOptions(options =>
{
#pragma warning disable CS0618 // Type or member is obsolete
var callback = options.CompilationCallback;
options.CompilationCallback = context =>
#pragma warning restore CS0618 // Type or member is obsolete
{
callback(context);
foreach (var tree in context.Compilation.SyntaxTrees)
{
var rewrittenRoot = new RazorRewriter().Visit(tree.GetRoot());
var rewrittenTree = tree.WithRootAndOptions(rewrittenRoot, tree.Options);
context.Compilation = context.Compilation.ReplaceSyntaxTree(tree, rewrittenTree);
}
};
});
}
}
}

View File

@ -1,2 +0,0 @@
@GetType().Assembly.FullName
Hello world!

View File

@ -1,7 +0,0 @@
@{
var message = "Hello world message";
#if TEST123
message = "Hello from Test123";
#endif
}
@message

View File

@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<MvcRazorEmbedViewSources>true</MvcRazorEmbedViewSources>
</PropertyGroup>
<ItemGroup>
<MvcRazorFilesToCompile Include="Views/Home/Index.cshtml;Views/Home/About.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,24 +0,0 @@
using System;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
namespace ApplicationWithCustomInputFiles.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public string GetPrecompiledResourceNames([FromServices] ApplicationPartManager applicationManager)
{
var feature = new ViewsFeature();
applicationManager.PopulateFeature(feature);
return string.Join(Environment.NewLine, feature.ViewDescriptors.Select(v => v.RelativePath));
}
}
}

View File

@ -1,26 +0,0 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithCustomInputFiles
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ApplicationWithCustomInputFiles
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}

View File

@ -1 +0,0 @@
This file is not included in compilation.

View File

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,26 +0,0 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithParseErrors
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

View File

@ -1,20 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ApplicationWithParseErrors
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseMvcWithDefaultRoute();
}
}
}

View File

@ -1,2 +0,0 @@
@using ApplicationWithParseErrors
@

Some files were not shown because too many files have changed in this diff Show More