Merge remote-tracking branch 'MvcPrecompilation/rybrande/release21ToSrc' into rybrande/Mondo2.1

This commit is contained in:
Ryan Brandenburg 2018-11-27 10:57:37 -08:00
commit 54e9e55535
158 changed files with 4288 additions and 0 deletions

43
src/MvcPrecompilation/.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
[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

@ -0,0 +1,20 @@
<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/MvcPrecompilation</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,21 @@
{
"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

@ -0,0 +1,55 @@
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

@ -0,0 +1,327 @@
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}") = "ApplicationUsingRelativePaths", "testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj", "{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "testapps\ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{196EF313-71CB-47A9-A77D-AACAF62881A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x86.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.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}
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{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

@ -0,0 +1,39 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<!-- These package versions may be overridden or updated by automation. -->
<PropertyGroup Label="Package Versions: Auto">
<InternalAspNetCoreSdkPackageVersion>2.1.3-rtm-15802</InternalAspNetCoreSdkPackageVersion>
<MicrosoftBuildTasksCorePackageVersion>15.6.82</MicrosoftBuildTasksCorePackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.2</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup>
<!-- This may import a generated file which may override the variables above. -->
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
<!-- These are package versions that should not be overridden or updated by automation. -->
<PropertyGroup Label="Package Versions: Pinned">
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.1</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.1.1</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.1</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreMvcRazorPagesPackageVersion>2.1.1</MicrosoftAspNetCoreMvcRazorPagesPackageVersion>
<MicrosoftAspNetCoreRazorDesignPackageVersion>2.1.1</MicrosoftAspNetCoreRazorDesignPackageVersion>
<MicrosoftAspNetCoreRazorRuntimePackageVersion>2.1.1</MicrosoftAspNetCoreRazorRuntimePackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.1</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.2</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.1</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.1</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.1</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.1</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>2.1.1</MicrosoftNETSdkRazorPackageVersion>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,15 @@
<Project>
<Import Project="dependencies.props" />
<PropertyGroup>
<!-- These properties are use by the automation that updates dependencies.props -->
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
<LineupPackageVersion>2.1.0-rc1-*</LineupPackageVersion>
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
</PropertyGroup>
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
<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

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

View File

@ -0,0 +1,21 @@
// 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

@ -0,0 +1,15 @@
<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

@ -0,0 +1,46 @@
// 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

@ -0,0 +1,105 @@
// 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

@ -0,0 +1,25 @@
// 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

@ -0,0 +1,124 @@
// 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

@ -0,0 +1,80 @@
// 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

@ -0,0 +1,262 @@
// 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);
MvcServiceProvider.ViewEngineOptions.CompilationCallback(compilationContext);
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

@ -0,0 +1,88 @@
// 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

@ -0,0 +1,22 @@
// 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

@ -0,0 +1,34 @@
// 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

@ -0,0 +1,78 @@
<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>
<PropertyGroup Condition="'$(TargetFramework)'=='net461'">
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<PlatformTarget Condition="'$(Platform)'=='AnyCPU'">x86</PlatformTarget>
<AssemblyName>$(AssemblyName)-$(PlatformTarget)</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>bin\$(Configuration)\net461\win7-$(PlatformTarget)</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\net461\win7-$(PlatformTarget)</IntermediateOutputPath>
</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>
<Target Name="BuildX64" AfterTargets="Build" Condition="'$(TargetFramework)'=='net461' AND '$(PlatformTarget)'!='x64'">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="Build"
Properties="
Configuration=$(Configuration);
TargetFramework=net461;
Platform=x64;" />
</Target>
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="BuildX64;">
<PropertyGroup>
<!-- Make sure we create a symbols.nupkg. -->
<IncludeSymbols>true</IncludeSymbols>
<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\win7-x86\$(AssemblyName)-x86.exe;
OutputExeSymbolX86=$(OutputPath)net461\win7-x86\$(AssemblyName)-x86.pdb;
OutputExeX64=$(OutputPath)net461\win7-x64\$(AssemblyName)-x64.exe;
OutputExeSymbolX64=$(OutputPath)net461\win7-x64\$(AssemblyName)-x64.pdb;
</NuspecProperties>
</PropertyGroup>
</Target>
</Project>

View File

@ -0,0 +1,38 @@
<?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\$AssemblyName$.dll" />
<file src="$OutputSymbol$" target="build\netstandard2.0\$AssemblyName$.pdb" />
<file src="$TaskBinary$" target="build\netstandard2.0\$AssemblyName$.Tasks.dll" />
<file src="$TaskSymbol$" target="build\netstandard2.0\$AssemblyName$.Tasks.pdb" />
<file src="$OutputExeX86$" target="build\netstandard2.0\" />
<file src="$OutputExeSymbolX86$" target="build\netstandard2.0\" />
<file src="$OutputExeX64$" target="build\netstandard2.0\" />
<file src="$OutputExeSymbolX64$" target="build\netstandard2.0\" />
</files>
</package>

View File

@ -0,0 +1,24 @@
// 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

@ -0,0 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View File

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

View File

@ -0,0 +1,203 @@
<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>
<_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(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="_AddDesktopReferences"
AfterTargets="ResolveLockFileReferences"
Condition="'$(MvcRazorCompileOnPublish)'=='true' AND '$(_MvcViewCompilationAddDesktopReferences)'!='false' AND '$(TargetFrameworkIdentifier)'=='.NETFramework'">
<PropertyGroup Condition="'$(_MvcViewCompilationBinaryPath)'==''">
<_MvcViewCompilationBinaryPath Condition="'$(PlatformTarget)'=='x86'">$(MSBuildThisFileDirectory)$(MSBuildThisFileName)-x86.exe</_MvcViewCompilationBinaryPath>
<!-- For PlatformTarget = AnyCPU or x64, we will use the x64 binary -->
<_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName)-x64.exe</_MvcViewCompilationBinaryPath>
</PropertyGroup>
<ItemGroup Condition="'$(_MvcViewCompilationBinaryPath)'!=''">
<Reference Include="$(_MvcViewCompilationBinaryPath)" Private="false" Visible="false" />
</ItemGroup>
</Target>
<Target
Name="_RunForDesktop"
DependsOnTargets="_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

@ -0,0 +1,18 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">netcoreapp2.1;netcoreapp2.0</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

@ -0,0 +1,31 @@
// 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_0
"netcoreapp2.0";
#elif NETCOREAPP2_1
"netcoreapp2.1";
#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

@ -0,0 +1,43 @@
// 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
{
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

@ -0,0 +1,22 @@
// 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

@ -0,0 +1,46 @@
// 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

@ -0,0 +1,50 @@
<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>
<PublicSign>false</PublicSign>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\*" />
<Compile Include="Infrastructure\*.cs" />
<Compile Include="DesktopTests\*.cs" Condition="'$(TargetFramework)'=='net461'" />
<Compile Include="CoreCLRTests\*.cs" Condition="'$(TargetFramework)'=='netcoreapp2.0' OR '$(TargetFramework)'=='netcoreapp2.1'" />
</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\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj" />
<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

@ -0,0 +1,39 @@
// 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

@ -0,0 +1,112 @@
// 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.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging;
namespace FunctionalTests
{
public abstract class ApplicationTestFixture : IDisposable
{
private const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
private static readonly SemaphoreSlim _deploymentLock = new SemaphoreSlim(initialCount: 1);
private Task<DeploymentResult> _deploymentTask;
private IApplicationDeployer _deployer;
protected ApplicationTestFixture(string applicationName, string applicationPath)
{
ApplicationName = applicationName;
ApplicationPath = applicationPath ?? ApplicationPaths.GetTestAppDirectory(applicationName);
}
public string ApplicationName { get; }
public string ApplicationPath { get; }
public bool PublishOnly { get; set; }
protected abstract DeploymentParameters GetDeploymentParameters();
protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor, string targetFramework)
=> GetDeploymentParameters(ApplicationPath, ApplicationName, flavor, targetFramework);
public 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,
PublishApplicationBeforeDeployment = true,
Configuration = "Release",
EnvironmentVariables =
{
new KeyValuePair<string, string>(DotnetCLITelemetryOptOut, "1"),
new KeyValuePair<string, string>("SolutionConfiguration", projectConfiguration),
},
PublishEnvironmentVariables =
{
new KeyValuePair<string, string>(DotnetCLITelemetryOptOut, "1"),
new KeyValuePair<string, string>("SolutionConfiguration", projectConfiguration),
},
TargetFramework = targetFramework,
};
return deploymentParameters;
}
public void Dispose()
{
if (_deploymentTask?.Status == TaskStatus.RanToCompletion)
{
_deploymentTask.Result.HttpClient?.Dispose();
}
_deployer?.Dispose();
}
public async Task<DeploymentResult> CreateDeploymentAsync(ILoggerFactory loggerFactory)
{
try
{
await _deploymentLock.WaitAsync(TimeSpan.FromSeconds(10));
if (_deploymentTask == null)
{
var deploymentParameters = GetDeploymentParameters();
if (PublishOnly)
{
_deployer = new PublishOnlyDeployer(deploymentParameters, loggerFactory);
}
else
{
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory);
}
_deploymentTask = _deployer.DeployAsync();
}
}
finally
{
_deploymentLock.Release();
}
return await _deploymentTask;
}
}
}

View File

@ -0,0 +1,38 @@
// 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

@ -0,0 +1,47 @@
// 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

@ -0,0 +1,58 @@
// 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

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

View File

@ -0,0 +1,165 @@
<!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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,220 @@
// 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

@ -0,0 +1,16 @@
<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

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationUsingRelativePaths.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}

View File

@ -0,0 +1,26 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationUsingRelativePaths
{
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

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

View File

@ -0,0 +1,8 @@
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

View File

@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Home Page";
}
@GetType().Assembly.FullName
Hello from Index!

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>

View File

@ -0,0 +1,2 @@
@using ApplicationUsingRelativePaths
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "Shared/_Layout.cshtml";
}

View File

@ -0,0 +1,17 @@
<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

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

View File

@ -0,0 +1,26 @@
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

@ -0,0 +1,21 @@
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

@ -0,0 +1,46 @@
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 =>
{
var callback = options.CompilationCallback;
options.CompilationCallback = context =>
{
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

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

View File

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

View File

@ -0,0 +1,21 @@
<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

@ -0,0 +1,24 @@
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

@ -0,0 +1,26 @@
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

@ -0,0 +1,26 @@
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

@ -0,0 +1 @@
Hello from About

View File

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

View File

@ -0,0 +1,16 @@
<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

@ -0,0 +1,26 @@
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

@ -0,0 +1,20 @@
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

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

View File

@ -0,0 +1,4 @@
@{
<span>
}
</span>

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<!--
Turning off precompilation on will also turn off Razor SDK.
-->
<MvcRazorCompileOnPublish>false</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)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationWithRazorSdkNeitherUsed.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}

View File

@ -0,0 +1,26 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithRazorSdkNeitherUsed
{
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

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

View File

@ -0,0 +1,8 @@
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

View File

@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Home Page";
}
@GetType().AssemblyQualifiedName
Hello from Index!

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>

View File

@ -0,0 +1,2 @@
@using ApplicationWithRazorSdkNeitherUsed
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "Shared/_Layout.cshtml";
}

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<!--
Turning precompilation on will turn off Razor SDK.
-->
<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)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationWithRazorSdkPrecompilationUsed.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}

View File

@ -0,0 +1,26 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithRazorSdkPrecompilationUsed
{
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

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

View File

@ -0,0 +1,8 @@
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

View File

@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Home Page";
}
@GetType().Assembly.FullName
Hello from Index!

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>

View File

@ -0,0 +1,2 @@
@using ApplicationWithRazorSdkPrecompilationUsed
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "Shared/_Layout.cshtml";
}

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
</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)" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationWithRazorSdkUsed.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}

View File

@ -0,0 +1,26 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationWithRazorSdkUsed
{
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

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

View File

@ -0,0 +1,8 @@
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

View File

@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Home Page";
}
@GetType().Assembly.FullName
Hello from Index!

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>

View File

@ -0,0 +1,2 @@
@using ApplicationWithRazorSdkUsed
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "Shared/_Layout.cshtml";
}

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