From 6f5722366d9124dd39ecae0f13e6b4a09cfc5650 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 16 Aug 2016 15:04:46 -0700 Subject: [PATCH 001/295] Initial commit --- .gitattributes | 52 ++++++++++++++++++++++++++++++++++++++ .gitignore | 38 ++++++++++++++++++++++++++++ .travis.yml | 30 ++++++++++++++++++++++ CONTRIBUTING.md | 4 +++ LICENSE.txt | 12 +++++++++ NuGet.config | 7 ++++++ appveyor.yml | 13 ++++++++++ build.ps1 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 46 +++++++++++++++++++++++++++++++++ global.json | 3 +++ 10 files changed, 272 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.txt create mode 100644 NuGet.config create mode 100644 appveyor.yml create mode 100644 build.ps1 create mode 100644 build.sh create mode 100644 global.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..d4ee1cb7f3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,52 @@ +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +*.jpg binary +*.png binary +*.gif binary + +*.cs text=auto diff=csharp +*.vb text=auto +*.resx text=auto +*.c text=auto +*.cpp text=auto +*.cxx text=auto +*.h text=auto +*.hxx text=auto +*.py text=auto +*.rb text=auto +*.java text=auto +*.html text=auto +*.htm text=auto +*.css text=auto +*.scss text=auto +*.sass text=auto +*.less text=auto +*.js text=auto +*.lisp text=auto +*.clj text=auto +*.sql text=auto +*.php text=auto +*.lua text=auto +*.m text=auto +*.asm text=auto +*.erl text=auto +*.fs text=auto +*.fsx text=auto +*.hs text=auto + +*.csproj text=auto +*.vbproj text=auto +*.fsproj text=auto +*.dbproj text=auto +*.sln text=auto eol=crlf + +*.sh eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..06cfaa0cbe --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +[Oo]bj/ +[Bb]in/ +TestResults/ +.nuget/ +.build/ +.testPublish/ +*.sln.ide/ +_ReSharper.*/ +packages/ +artifacts/ +PublishProfiles/ +.vs/ +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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..57860350a0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: csharp +sudo: required +dist: trusty +addons: + apt: + packages: + - gettext + - libcurl4-openssl-dev + - libicu-dev + - libssl-dev + - libunwind8 + - zlib1g +before_install: + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install icu4c; brew install openssl; brew link --force openssl; fi +mono: + - 4.0.5 +os: + - linux + - osx +osx_image: xcode7.1 +branches: + only: + - master + - release + - dev + - /^(.*\/)?ci-.*$/ +script: + - ./build.sh --quiet verify +env: + - KOREBUILD_TEST_SKIPMONO=1 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..64ff041d5c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,4 @@ +Contributing +====== + +Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000..0bdc1962b6 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) .NET Foundation. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +these files except in compliance with the License. You may obtain a copy of the +License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000000..5500f6d507 --- /dev/null +++ b/NuGet.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..be95b88d6f --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,13 @@ +init: + - git config --global core.autocrlf true +branches: + only: + - master + - release + - dev + - /^(.*\/)?ci-.*$/ +build_script: + - build.cmd --quiet verify +clone_depth: 1 +test: off +deploy: off \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..8f2f99691a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,67 @@ +$ErrorActionPreference = "Stop" + +function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +{ + while($true) + { + try + { + Invoke-WebRequest $url -OutFile $downloadLocation + break + } + catch + { + $exceptionMessage = $_.Exception.Message + Write-Host "Failed to download '$url': $exceptionMessage" + if ($retries -gt 0) { + $retries-- + Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 10 + + } + else + { + $exception = $_.Exception + throw $exception + } + } + } +} + +cd $PSScriptRoot + +$repoFolder = $PSScriptRoot +$env:REPO_FOLDER = $repoFolder + +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if ($env:KOREBUILD_ZIP) +{ + $koreBuildZip=$env:KOREBUILD_ZIP +} + +$buildFolder = ".build" +$buildFile="$buildFolder\KoreBuild.ps1" + +if (!(Test-Path $buildFolder)) { + Write-Host "Downloading KoreBuild from $koreBuildZip" + + $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() + New-Item -Path "$tempFolder" -Type directory | Out-Null + + $localZipFile="$tempFolder\korebuild.zip" + + DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) + + New-Item -Path "$buildFolder" -Type directory | Out-Null + copy-item "$tempFolder\**\build\*" $buildFolder -Recurse + + # Cleanup + if (Test-Path $tempFolder) { + Remove-Item -Recurse -Force $tempFolder + } +} + +&"$buildFile" $args \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..f4208100eb --- /dev/null +++ b/build.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $repoFolder + +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if [ ! -z $KOREBUILD_ZIP ]; then + koreBuildZip=$KOREBUILD_ZIP +fi + +buildFolder=".build" +buildFile="$buildFolder/KoreBuild.sh" + +if test ! -d $buildFolder; then + echo "Downloading KoreBuild from $koreBuildZip" + + tempFolder="/tmp/KoreBuild-$(uuidgen)" + mkdir $tempFolder + + localZipFile="$tempFolder/korebuild.zip" + + retries=6 + until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) + do + echo "Failed to download '$koreBuildZip'" + if [ "$retries" -le 0 ]; then + exit 1 + fi + retries=$((retries - 1)) + echo "Waiting 10 seconds before retrying. Retries left: $retries" + sleep 10s + done + + unzip -q -d $tempFolder $localZipFile + + mkdir $buildFolder + cp -r $tempFolder/**/build/** $buildFolder + + chmod +x $buildFile + + # Cleanup + if test ! -d $tempFolder; then + rm -rf $tempFolder + fi +fi + +$buildFile -r $repoFolder "$@" \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000000..fad3dfeab0 --- /dev/null +++ b/global.json @@ -0,0 +1,3 @@ +{ + "projects": ["src", "test/WebSites", "samples"] +} From dbe93ac6b19deb40341e3bef5c35006b62dc83dd Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 16 Aug 2016 15:11:53 -0700 Subject: [PATCH 002/295] Adding Razor Precompilation --- .gitignore | 3 +- MvcPrecompilation.sln | 49 ++++ NuGetPackageVerifier.json | 16 ++ TestApps.sln | 46 ++++ build.cmd | 2 + global.json | 2 +- makefile.shade | 9 + .../Internal/CommonOptions.cs | 39 +++ .../Internal/DebugHelper.cs | 25 ++ .../Internal/MvcServiceProvider.cs | 116 +++++++++ .../Internal/PrecompilationApplication.cs | 61 +++++ .../Internal/PrecompileRunCommand.cs | 244 ++++++++++++++++++ .../Internal/SnkUtils.cs | 88 +++++++ .../Internal/StrongNameOptions.cs | 44 ++++ .../Internal/ViewCompilationInfo.cs | 25 ++ .../ViewInfoContainerCodeGenerator.cs | 85 ++++++ ...Core.Mvc.Razor.Precompilation.Design.xproj | 18 ++ .../Program.cs | 66 +++++ .../Properties/AssemblyInfo.cs | 11 + .../project.json | 41 +++ .../Internal/PrecompileDispatchCommand.cs | 188 ++++++++++++++ ...tCore.Mvc.Razor.Precompilation.Tools.xproj | 18 ++ .../Program.cs | 22 ++ .../Properties/AssemblyInfo.cs | 11 + .../project.json | 49 ++++ .../ApplicationWithConfigureMvcTest.cs | 98 +++++++ .../ApplicationWithTagHelpersTest.cs | 80 ++++++ .../Infrastructure/ApplicationPaths.cs | 40 +++ .../Infrastructure/ApplicationTestFixture.cs | 144 +++++++++++ .../Infrastructure/TestEmbeddedResource.cs | 59 +++++ ...tCore.Mvc.Razor.Precompilation.Tests.xproj | 22 ++ .../Properties/AssemblyInfo.cs | 3 + ...ApplicationWithConfigureMvc.Home.Index.txt | 2 + ...ConfigureMvc.Home.ViewWithPreprocessor.txt | 1 + ...hTagHelpers.Home.ClassLibraryTagHelper.txt | 25 ++ ...tionWithTagHelpers.Home.LocalTagHelper.txt | 25 ++ .../Resources/SimpleAppTest.Home.Index.txt | 165 ++++++++++++ .../SimpleAppTest.cs | 51 ++++ .../project.json | 29 +++ .../ApplicationWithConfigureMvc.xproj | 19 ++ .../Controllers/HomeController.cs | 11 + .../ApplicationWithConfigureMvc/Program.cs | 26 ++ .../RazorRewriter.cs | 19 ++ .../ApplicationWithConfigureMvc/Startup.cs | 47 ++++ .../Views/Home/Index.cshtml | 2 + .../Views/Home/ViewWithPreprocessor.cshtml | 7 + .../ApplicationWithConfigureMvc/project.json | 45 ++++ .../ApplicationWithTagHelpers.xproj | 19 ++ .../Controllers/HomeController.cs | 15 ++ testapps/ApplicationWithTagHelpers/Program.cs | 26 ++ testapps/ApplicationWithTagHelpers/Startup.cs | 26 ++ .../TagHelpers/TestTagHelper.cs | 38 +++ .../Views/Home/ClassLibraryTagHelper.cshtml | 7 + .../Views/Home/LocalTagHelper.cshtml | 7 + .../Views/Home/NuGetPackageTagHelper.cshtml | 12 + .../Views/Shared/_Layout.cshtml | 20 ++ .../Views/_ViewImports.cshtml | 2 + .../Views/_ViewStart.cshtml | 3 + .../ApplicationWithTagHelpers/project.json | 49 ++++ .../ClassLibraryTagHelper/BoldTagHelper.cs | 15 ++ .../ClassLibraryTagHelper.xproj | 21 ++ testapps/ClassLibraryTagHelper/project.json | 9 + testapps/NuGet.config | 8 + .../SimpleApp/Controllers/HomeController.cs | 19 ++ testapps/SimpleApp/Program.cs | 26 ++ testapps/SimpleApp/SimpleApp.xproj | 23 ++ testapps/SimpleApp/Startup.cs | 26 ++ testapps/SimpleApp/Views/Home/About.cshtml | 7 + testapps/SimpleApp/Views/Home/Index.cshtml | 110 ++++++++ .../SimpleApp/Views/Shared/_Layout.cshtml | 68 +++++ testapps/SimpleApp/Views/_ViewImports.cshtml | 2 + testapps/SimpleApp/Views/_ViewStart.cshtml | 3 + testapps/SimpleApp/project.json | 45 ++++ testapps/global.json | 3 + tools/Key.snk | Bin 0 -> 596 bytes 75 files changed, 2805 insertions(+), 2 deletions(-) create mode 100644 MvcPrecompilation.sln create mode 100644 NuGetPackageVerifier.json create mode 100644 TestApps.sln create mode 100644 build.cmd create mode 100644 makefile.shade create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json create mode 100644 testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj create mode 100644 testapps/ApplicationWithConfigureMvc/Controllers/HomeController.cs create mode 100644 testapps/ApplicationWithConfigureMvc/Program.cs create mode 100644 testapps/ApplicationWithConfigureMvc/RazorRewriter.cs create mode 100644 testapps/ApplicationWithConfigureMvc/Startup.cs create mode 100644 testapps/ApplicationWithConfigureMvc/Views/Home/Index.cshtml create mode 100644 testapps/ApplicationWithConfigureMvc/Views/Home/ViewWithPreprocessor.cshtml create mode 100644 testapps/ApplicationWithConfigureMvc/project.json create mode 100644 testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj create mode 100644 testapps/ApplicationWithTagHelpers/Controllers/HomeController.cs create mode 100644 testapps/ApplicationWithTagHelpers/Program.cs create mode 100644 testapps/ApplicationWithTagHelpers/Startup.cs create mode 100644 testapps/ApplicationWithTagHelpers/TagHelpers/TestTagHelper.cs create mode 100644 testapps/ApplicationWithTagHelpers/Views/Home/ClassLibraryTagHelper.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/Views/Home/LocalTagHelper.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/Views/Home/NuGetPackageTagHelper.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/Views/_ViewImports.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/Views/_ViewStart.cshtml create mode 100644 testapps/ApplicationWithTagHelpers/project.json create mode 100644 testapps/ClassLibraryTagHelper/BoldTagHelper.cs create mode 100644 testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj create mode 100644 testapps/ClassLibraryTagHelper/project.json create mode 100644 testapps/NuGet.config create mode 100644 testapps/SimpleApp/Controllers/HomeController.cs create mode 100644 testapps/SimpleApp/Program.cs create mode 100644 testapps/SimpleApp/SimpleApp.xproj create mode 100644 testapps/SimpleApp/Startup.cs create mode 100644 testapps/SimpleApp/Views/Home/About.cshtml create mode 100644 testapps/SimpleApp/Views/Home/Index.cshtml create mode 100644 testapps/SimpleApp/Views/Shared/_Layout.cshtml create mode 100644 testapps/SimpleApp/Views/_ViewImports.cshtml create mode 100644 testapps/SimpleApp/Views/_ViewStart.cshtml create mode 100644 testapps/SimpleApp/project.json create mode 100644 testapps/global.json create mode 100644 tools/Key.snk diff --git a/.gitignore b/.gitignore index 06cfaa0cbe..1b6e30413e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,5 @@ nuget.exe *.sln.ide node_modules *launchSettings.json -*.orig \ No newline at end of file +*.orig +BuildInfo.generated.cs \ No newline at end of file diff --git a/MvcPrecompilation.sln b/MvcPrecompilation.sln new file mode 100644 index 0000000000..91c5e92da2 --- /dev/null +++ b/MvcPrecompilation.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design", "src\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{01707B64-7DC7-4B5A-B0BB-7CD2773AA297}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + NuGet.config = NuGet.config + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02F7AA35-91AF-491E-9F0E-03CFAF86C720}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools", "src\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj", "{F8BF7D95-0633-407F-BB0B-02563F13C068}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-505E-4283-89DA-BBD9D28B53DB}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + 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}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|Any CPU.Build.0 = Release|Any CPU + {F8BF7D95-0633-407F-BB0B-02563F13C068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8BF7D95-0633-407F-BB0B-02563F13C068}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8BF7D95-0633-407F-BB0B-02563F13C068}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8BF7D95-0633-407F-BB0B-02563F13C068}.Release|Any CPU.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}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|Any CPU.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} + {F8BF7D95-0633-407F-BB0B-02563F13C068} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} + {46C9A4B2-8B1C-451B-B670-C194901D66AC} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} + EndGlobalSection +EndGlobal diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json new file mode 100644 index 0000000000..91876a048a --- /dev/null +++ b/NuGetPackageVerifier.json @@ -0,0 +1,16 @@ +{ + "adx": { // Packages written by the ADX team and that ship on NuGet.org + "rules": [ + "AdxVerificationCompositeRule" + ], + "packages": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { }, + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": { } + } + }, + "Default": { // Rules to run for packages not listed in any other set. + "rules": [ + "DefaultCompositeRule" + ] + } +} diff --git a/TestApps.sln b/TestApps.sln new file mode 100644 index 0000000000..cc683f4dd6 --- /dev/null +++ b/TestApps.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleApp", "testapps\SimpleApp\SimpleApp.xproj", "{8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{43488AEE-CCF2-4A90-B890-05320282BE29}" + ProjectSection(SolutionItems) = preProject + testapps\global.json = testapps\global.json + testapps\NuGet.config = testapps\NuGet.config + EndProjectSection +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithTagHelpers", "testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.xproj", "{2079872F-E8F9-4DB1-A340-C0D897807B86}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryTagHelper", "testapps\ClassLibraryTagHelper\ClassLibraryTagHelper.xproj", "{39EFA075-3673-49AB-95F3-AA5E88DF6C30}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.xproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Release|Any CPU.Build.0 = Release|Any CPU + {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.Build.0 = Release|Any CPU + {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.Build.0 = Release|Any CPU + {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000000..7d4894cb4a --- /dev/null +++ b/build.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file diff --git a/global.json b/global.json index fad3dfeab0..feb51cb71d 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,3 @@ { - "projects": ["src", "test/WebSites", "samples"] + "projects": ["src", "samples"] } diff --git a/makefile.shade b/makefile.shade new file mode 100644 index 0000000000..99c11d9c68 --- /dev/null +++ b/makefile.shade @@ -0,0 +1,9 @@ +use namespace="System.IO" + +-BuildQuality = "preview3"; + +use-standard-lifecycle +k-standard-goals + +#repo-initialize target='initialize' + dotnet command='restore src test ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs new file mode 100644 index 0000000000..9540724a97 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs @@ -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 Microsoft.Extensions.CommandLineUtils; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public class CommonOptions + { + public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type"; + public static readonly string ContentRootTemplate = "--content-root"; + + public CommandArgument ProjectArgument { get; private set; } + + public CommandOption ConfigureCompilationType { get; private set; } + + public CommandOption ContentRootOption { get; private set; } + + public void Configure(CommandLineApplication app) + { + app.Description = "Precompiles an application."; + app.HelpOption("-?|-h|--help"); + + ProjectArgument = app.Argument( + "project", + "The path to the project (project folder or project.json) with precompilation."); + + ConfigureCompilationType = app.Option( + ConfigureCompilationTypeTemplate, + "Type with Configure method", + CommandOptionType.SingleValue); + + ContentRootOption = app.Option( + ContentRootTemplate, + "The application's content root.", + CommandOptionType.SingleValue); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs new file mode 100644 index 0000000000..dde371bb33 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs @@ -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.Precompilation.Design.Internal +{ + public 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 \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs new file mode 100644 index 0000000000..7cc105ccc3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs @@ -0,0 +1,116 @@ +// 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.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.ObjectPool; +using Microsoft.Extensions.Options; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public 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); + + Host = serviceProvider.GetRequiredService(); + Compiler = serviceProvider.GetRequiredService(); + ViewEngineOptions = serviceProvider.GetRequiredService>().Value; + FileProvider = serviceProvider.GetRequiredService().FileProvider; + } + + public IMvcRazorHost Host { get; } + + public CSharpCompiler Compiler { get; } + + public IFileProvider FileProvider { 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(hostingEnvironment) + .AddSingleton(diagnosticSource) + .AddLogging() + .AddSingleton(); + + var mvcCoreBuilder = services + .AddMvcCore() + .AddRazorViewEngine(); + + var mvcBuilder = new MvcBuilder(mvcCoreBuilder.Services, mvcCoreBuilder.PartManager); + mvcBuilderConfiguration?.ConfigureMvc(mvcBuilder); + + return mvcBuilder.Services.BuildServiceProvider(); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs new file mode 100644 index 0000000000..72e4861055 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs @@ -0,0 +1,61 @@ +// 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.Reflection; +using Microsoft.Extensions.CommandLineUtils; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public 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(args); + } + catch (Exception ex) + { + Console.Error.WriteLine(ex.Message); +#if DEBUG + Console.Error.WriteLine(ex); +#endif + return 1; + } + } + + private string GetInformationalVersion() + { + var assembly = _callingType.GetTypeInfo().Assembly; + var attributes = assembly.GetCustomAttributes( + typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute[]; + + var versionAttribute = attributes.Length == 0 ? + assembly.GetName().Version.ToString() : + attributes[0].InformationalVersion; + + return versionAttribute; + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs new file mode 100644 index 0000000000..1e599b1a81 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs @@ -0,0 +1,244 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.AspNetCore.Mvc.Razor.Compilation; +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Text; +using Microsoft.Extensions.CommandLineUtils; +using Microsoft.Extensions.FileProviders; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public class PrecompileRunCommand + { + public static readonly string ApplicationNameTemplate = "--applicationName"; + public static readonly string OutputPathTemplate = "--output-path"; + private static readonly ParallelOptions ParalellOptions = new ParallelOptions + { + MaxDegreeOfParallelism = 4 + }; + + private CommandOption OutputPathOption { get; set; } + + private CommandOption ApplicationNameOption { get; set; } + + private MvcServiceProvider MvcServiceProvider { get; set; } + + private CommonOptions Options { get; } = new CommonOptions(); + + private StrongNameOptions StrongNameOptions { get; } = new StrongNameOptions(); + + private string ProjectPath { get; set; } + + public void Configure(CommandLineApplication app) + { + Options.Configure(app); + StrongNameOptions.Configure(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); + + app.OnExecute(() => Execute()); + } + + private int Execute() + { + ParseArguments(); + + MvcServiceProvider = new MvcServiceProvider( + ProjectPath, + ApplicationNameOption.Value(), + Options.ContentRootOption.Value(), + Options.ConfigureCompilationType.Value()); + + Console.WriteLine("Running Razor view precompilation."); + + var stopWatch = Stopwatch.StartNew(); + var results = GenerateCode(); + var success = true; + foreach (var result in results) + { + if (!result.GeneratorResults.Success) + { + success = false; + foreach (var error in result.GeneratorResults.ParserErrors) + { + Console.Error.WriteLine($"{error.Location.FilePath} ({error.Location.LineIndex}): {error.Message}"); + } + } + } + + if (!success) + { + return 1; + } + + var precompileAssemblyName = $"{ApplicationNameOption.Value()}{AssemblyPart.PrecompiledViewsAssemblySuffix}"; + var compilation = CompileViews(results, precompileAssemblyName); + + var assemblyPath = Path.Combine(OutputPathOption.Value(), precompileAssemblyName + ".dll"); + var emitResult = EmitAssembly(compilation, assemblyPath); + + if (!emitResult.Success) + { + foreach (var diagnostic in emitResult.Diagnostics) + { + Console.Error.WriteLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); + } + + return 1; + } + + stopWatch.Stop(); + Console.WriteLine($"Precompiled views emitted to {assemblyPath}."); + Console.WriteLine($"Successfully compiled {results.Length} Razor views in {stopWatch.ElapsedMilliseconds}ms."); + return 0; + } + + private EmitResult EmitAssembly(CSharpCompilation compilation, string assemblyPath) + { + Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath)); + + EmitResult emitResult; + using (var assemblyStream = File.OpenWrite(assemblyPath)) + { + using (var pdbStream = File.OpenWrite(Path.ChangeExtension(assemblyPath, ".pdb"))) + { + emitResult = compilation.Emit( + assemblyStream, + pdbStream, + options: MvcServiceProvider.Compiler.EmitOptions); + } + } + + 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.GeneratorResults.GeneratedCode, Encoding.UTF8); + var fileInfo = result.RelativeFileInfo; + var syntaxTree = compiler.CreateSyntaxTree(sourceText) + .WithFilePath(fileInfo.FileInfo.PhysicalPath ?? fileInfo.RelativePath); + syntaxTrees[i] = syntaxTree; + }); + + compilation = compilation.AddSyntaxTrees(syntaxTrees); + Parallel.For(0, results.Length, ParalellOptions, i => + { + results[i].TypeName = ReadTypeInfo(compilation, syntaxTrees[i]); + }); + + // 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 = compilationContext.Compilation; + + var codeGenerator = new ViewInfoContainerCodeGenerator(compiler, compilation); + codeGenerator.AddViewFactory(results); + + var assemblyName = new AssemblyName(ApplicationNameOption.Value()); + assemblyName = Assembly.Load(assemblyName).GetName(); + codeGenerator.AddAssemblyMetadata(assemblyName, StrongNameOptions); + + return codeGenerator.Compilation; + } + + private void ParseArguments() + { + ProjectPath = Options.ProjectArgument.Value; + if (string.IsNullOrEmpty(ProjectPath)) + { + throw new ArgumentException("Project path not specified."); + } + + if (!OutputPathOption.HasValue()) + { + throw new ArgumentException($"Option {OutputPathTemplate} does not specify a value."); + } + + if (!ApplicationNameOption.HasValue()) + { + throw new ArgumentException($"Option {ApplicationNameTemplate} does not specify a value."); + } + } + + private ViewCompilationInfo[] GenerateCode() + { + var files = new List(); + GetRazorFiles(MvcServiceProvider.FileProvider, files, root: string.Empty); + var results = new ViewCompilationInfo[files.Count]; + Parallel.For(0, results.Length, ParalellOptions, i => + { + var fileInfo = files[i]; + using (var fileStream = fileInfo.FileInfo.CreateReadStream()) + { + var result = MvcServiceProvider.Host.GenerateCode(fileInfo.RelativePath, fileStream); + results[i] = new ViewCompilationInfo(fileInfo, result); + } + }); + + return results; + } + + private static void GetRazorFiles(IFileProvider fileProvider, List razorFiles, string root) + { + foreach (var fileInfo in fileProvider.GetDirectoryContents(root)) + { + var relativePath = Path.Combine(root, fileInfo.Name); + if (fileInfo.IsDirectory) + { + GetRazorFiles(fileProvider, razorFiles, relativePath); + } + else if (fileInfo.Name.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase)) + { + razorFiles.Add(new RelativeFileInfo(fileInfo, relativePath)); + } + } + } + + private string ReadTypeInfo(CSharpCompilation compilation, SyntaxTree syntaxTree) + { + var semanticModel = compilation.GetSemanticModel(syntaxTree, ignoreAccessibility: true); + var classDeclarations = syntaxTree.GetRoot().DescendantNodes().OfType(); + foreach (var declaration in classDeclarations) + { + var typeSymbol = semanticModel.GetDeclaredSymbol(declaration); + if (typeSymbol.ContainingType == null && typeSymbol.DeclaredAccessibility == Accessibility.Public) + { + return typeSymbol.ToDisplayString(); + } + } + + return null; + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs new file mode 100644 index 0000000000..db72ea864c --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs @@ -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.Precompilation.Design.Internal +{ + // Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs + public 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 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 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()); + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs new file mode 100644 index 0000000000..e079707018 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs @@ -0,0 +1,44 @@ +// 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.Extensions.CommandLineUtils; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public class StrongNameOptions + { + public static readonly string StrongNameKeyPath = "--key-file"; + public static readonly string DelaySignTemplate = "--delay-sign"; + public static readonly string PublicSignTemplate = "--public-sign"; + + public CommandOption KeyFileOption { get; set; } + + public CommandOption DelaySignOption { get; private set; } + + public CommandOption PublicSignOption { get; private set; } + + public void Configure(CommandLineApplication app) + { + 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); + } + + public string KeyFile => KeyFileOption.Value(); + + public bool DelaySign => DelaySignOption.HasValue(); + + public bool PublicSign => PublicSignOption.HasValue(); + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs new file mode 100644 index 0000000000..f2ac3b44e3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs @@ -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. + +using Microsoft.AspNetCore.Mvc.Razor.Compilation; +using Microsoft.AspNetCore.Razor.CodeGenerators; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public class ViewCompilationInfo + { + public ViewCompilationInfo( + RelativeFileInfo relativeFileInfo, + GeneratorResults generatorResults) + { + RelativeFileInfo = relativeFileInfo; + GeneratorResults = generatorResults; + } + + public RelativeFileInfo RelativeFileInfo { get; } + + public GeneratorResults GeneratorResults { get; } + + public string TypeName { get; set; } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs new file mode 100644 index 0000000000..00619f6ada --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs @@ -0,0 +1,85 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +{ + public class ViewInfoContainerCodeGenerator + { + public ViewInfoContainerCodeGenerator( + CSharpCompiler compiler, + CSharpCompilation compilation) + { + Compiler = compiler; + Compilation = compilation; + } + + public CSharpCompiler Compiler { get; } + + public CSharpCompilation Compilation { get; private set; } + + public void AddViewFactory(IList result) + { + var precompiledViewsArray = new StringBuilder(); + foreach (var item in result) + { + var path = item.RelativeFileInfo.RelativePath; + precompiledViewsArray.AppendLine( + $"new global::{typeof(ViewInfo).FullName}(@\"{path}\", typeof({item.TypeName})),"); + } + + var factoryContent = $@" +namespace {AssemblyPart.ViewInfoContainerNamespace} +{{ + public class {AssemblyPart.ViewInfoContainerTypeName} : global::{typeof(ViewInfoContainer).FullName} + {{ + public {AssemblyPart.ViewInfoContainerTypeName}() : base(new[] + {{ + {precompiledViewsArray} + }}) + {{ + }} + }} +}}"; + var syntaxTree = Compiler.CreateSyntaxTree(SourceText.From(factoryContent)); + Compilation = Compilation.AddSyntaxTrees(syntaxTree); + } + + public void AddAssemblyMetadata( + AssemblyName applicationAssemblyName, + StrongNameOptions strongNameOptions) + { + if (!string.IsNullOrEmpty(strongNameOptions.KeyFile)) + { + var updatedOptions = Compilation.Options.WithStrongNameProvider(new DesktopStrongNameProvider()); + + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || strongNameOptions.PublicSign) + { + updatedOptions = updatedOptions.WithCryptoPublicKey( + SnkUtils.ExtractPublicKey(File.ReadAllBytes(strongNameOptions.KeyFile))); + } + else + { + updatedOptions = updatedOptions.WithCryptoKeyFile(strongNameOptions.KeyFile) + .WithDelaySign(strongNameOptions.DelaySign); + } + + Compilation = Compilation.WithOptions(updatedOptions); + } + + var assemblyVersionContent = $"[assembly:{typeof(AssemblyVersionAttribute).FullName}(\"{applicationAssemblyName.Version}\")]"; + var syntaxTree = Compiler.CreateSyntaxTree(SourceText.From(assemblyVersionContent)); + Compilation = Compilation.AddSyntaxTrees(syntaxTree); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj new file mode 100644 index 0000000000..253d7491f8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj @@ -0,0 +1,18 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 4339fc9b-aec6-442a-b413-a41555ed76c7 + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs new file mode 100644 index 0000000000..197fcefc7b --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs @@ -0,0 +1,66 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Reflection; +using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design +{ + public class Program + { + private readonly static Type ProgramType = typeof(Program); + + public static int Main(string[] args) + { +#if DEBUG + DebugHelper.HandleDebugSwitch(ref args); +#endif + + EnsureValidDispatchRecipient(ref args); + + var app = new PrecompilationApplication(ProgramType); + new PrecompileRunCommand().Configure(app); + return app.Execute(args); + } + + private static void EnsureValidDispatchRecipient(ref string[] args) + { + const string DispatcherVersionArgumentName = "--dispatcher-version"; + + var dispatcherArgumentIndex = Array.FindIndex( + args, + (value) => string.Equals(value, DispatcherVersionArgumentName, StringComparison.OrdinalIgnoreCase)); + + if (dispatcherArgumentIndex < 0) + { + return; + } + + var dispatcherArgumentValueIndex = dispatcherArgumentIndex + 1; + if (dispatcherArgumentValueIndex < args.Length) + { + var dispatcherVersion = args[dispatcherArgumentValueIndex]; + + var thisAssembly = ProgramType.GetTypeInfo().Assembly; + var version = thisAssembly.GetCustomAttribute() + ?.InformationalVersion + ?? thisAssembly.GetName().Version.ToString(); + + if (string.Equals(dispatcherVersion, version, StringComparison.Ordinal)) + { + // Remove dispatcher arguments from + var preDispatcherArgument = args.Take(dispatcherArgumentIndex); + var postDispatcherArgument = args.Skip(dispatcherArgumentIndex + 2); + var newProgramArguments = preDispatcherArgument.Concat(postDispatcherArgument); + args = newProgramArguments.ToArray(); + return; + } + } + + // Could not validate the dispatcher version. + throw new InvalidOperationException("Could not invoke tool"); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2dc4003a17 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// 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.Reflection; +using System.Resources; + +[assembly: AssemblyMetadata("Serviceable", "True")] +[assembly: NeutralResourcesLanguage("en-us")] +[assembly: AssemblyCompany("Microsoft Corporation.")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json new file mode 100644 index 0000000000..26565cfcec --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json @@ -0,0 +1,41 @@ +{ + "version": "1.0.0-*", + "description": "Razor precompilation", + "packOptions": { + "repository": { + "type": "git", + "url": "git://github.com/AspNet/Mvc" + }, + "tags": [ + "cshtml", + "razor", + "precompilation", + "aspnetcore" + ] + }, + "buildOptions": { + "keyFile": "../../tools/Key.snk", + "warningsAsErrors": true, + "emitEntryPoint": true, + "nowarn": [ + "CS1591" + ], + "xmlDoc": true + }, + "dependencies": { + "Microsoft.AspNetCore.Hosting": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor": "1.1.0-*", + "Microsoft.Extensions.CommandLineUtils": "1.1.0-*" + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + } + } + }, + "net451": {} + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs new file mode 100644 index 0000000000..7a95538c45 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -0,0 +1,188 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; +using Microsoft.DotNet.InternalAbstractions; +using Microsoft.DotNet.ProjectModel; +using Microsoft.Extensions.CommandLineUtils; +using Microsoft.Extensions.Internal; +using NuGet.Frameworks; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal +{ + public class PrecompileDispatchCommand + { + private CommonOptions Options { get; } = new CommonOptions(); + + private CommandOption FrameworkOption { get; set; } + + private CommandOption ConfigurationOption { get; set; } + + private CommandOption OutputPathOption { get; set; } + + private NuGetFramework TargetFramework { get; set; } + + private CommandOption BuildBasePathOption { get; set; } + + private string ProjectPath { get; set; } + + private string Configuration { get; set; } + + private string OutputPath { get; set; } + + public void Configure(CommandLineApplication app) + { + Options.Configure(app); + FrameworkOption = app.Option( + "-f|--framework", + "Target Framework", + CommandOptionType.SingleValue); + + ConfigurationOption = app.Option( + "-c|--configuration", + "Configuration", + CommandOptionType.SingleValue); + + OutputPathOption = app.Option( + "-o|--output-path", + "Published path of the application.", + CommandOptionType.SingleValue); + + app.OnExecute(() => Execute()); + } + + private int Execute() + { + ParseArguments(); + + var runtimeContext = GetRuntimeContext(); + + var outputPaths = runtimeContext.GetOutputPaths(Configuration); + var applicationName = Path.GetFileNameWithoutExtension(outputPaths.CompilationFiles.Assembly); + var dispatchArgs = new List + { + ProjectPath, + PrecompileRunCommand.ApplicationNameTemplate, + applicationName, + PrecompileRunCommand.OutputPathTemplate, + OutputPath, + CommonOptions.ContentRootTemplate, + Options.ContentRootOption.Value() ?? Directory.GetCurrentDirectory(), + }; + + if (Options.ConfigureCompilationType.HasValue()) + { + dispatchArgs.Add(CommonOptions.ConfigureCompilationTypeTemplate); + dispatchArgs.Add(Options.ConfigureCompilationType.Value()); + } + + var compilerOptions = runtimeContext.ProjectFile.GetCompilerOptions(TargetFramework, Configuration); + if (!string.IsNullOrEmpty(compilerOptions.KeyFile)) + { + dispatchArgs.Add(StrongNameOptions.StrongNameKeyPath); + var keyFilePath = Path.GetFullPath(Path.Combine(runtimeContext.ProjectDirectory, compilerOptions.KeyFile)); + dispatchArgs.Add(keyFilePath); + + if (compilerOptions.DelaySign ?? false) + { + dispatchArgs.Add(StrongNameOptions.DelaySignTemplate); + } + + if (compilerOptions.PublicSign ?? false) + { + dispatchArgs.Add(StrongNameOptions.PublicSignTemplate); + } + } + +#if DEBUG + var commandLineArgs = Environment.GetCommandLineArgs(); + if (commandLineArgs.Length > 0 && commandLineArgs[0] == "--debug") + { + dispatchArgs.Insert(0, commandLineArgs[0]); + } +#endif + + var toolName = typeof(Design.Program).GetTypeInfo().Assembly.GetName().Name; + var dispatchCommand = DotnetToolDispatcher.CreateDispatchCommand( + dispatchArgs, + TargetFramework, + Configuration, + outputPath: outputPaths.RuntimeOutputPath, + buildBasePath: null, + projectDirectory: ProjectPath, + toolName: toolName); + + var commandExitCode = dispatchCommand + .ForwardStdErr(Console.Error) + .ForwardStdOut(Console.Out) + .Execute() + .ExitCode; + + return commandExitCode; + } + + private void ParseArguments() + { + ProjectPath = GetProjectPath(); + Configuration = ConfigurationOption.Value() ?? DotNet.Cli.Utils.Constants.DefaultConfiguration; + + if (!FrameworkOption.HasValue()) + { + throw new Exception($"Option {FrameworkOption.Template} does not have a value."); + } + TargetFramework = NuGetFramework.Parse(FrameworkOption.Value()); + + if (!OutputPathOption.HasValue()) + { + throw new Exception($"Option {OutputPathOption.Template} does not have a value."); + } + OutputPath = OutputPathOption.Value(); + } + + private string GetProjectPath() + { + string projectPath; + if (!string.IsNullOrEmpty(Options.ProjectArgument.Value)) + { + projectPath = Path.GetFullPath(Options.ProjectArgument.Value); + if (string.Equals(Path.GetFileName(ProjectPath), "project.json", StringComparison.OrdinalIgnoreCase)) + { + projectPath = Path.GetDirectoryName(ProjectPath); + } + + if (!Directory.Exists(projectPath)) + { + throw new InvalidOperationException($"Could not find directory {projectPath}."); + } + } + else + { + projectPath = Directory.GetCurrentDirectory(); + } + + return projectPath; + } + + private ProjectContext GetRuntimeContext() + { + var workspace = new BuildWorkspace(ProjectReaderSettings.ReadFromEnvironment()); + + var projectContext = workspace.GetProjectContext(ProjectPath, TargetFramework); + if (projectContext == null) + { + Debug.Assert(FrameworkOption.HasValue()); + throw new InvalidOperationException($"Project '{ProjectPath}' does not support framework: {FrameworkOption.Value()}"); + } + + var runtimeContext = workspace.GetRuntimeContext( + projectContext, + RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers()); + return runtimeContext; + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj new file mode 100644 index 0000000000..6b5961a59f --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj @@ -0,0 +1,18 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + f8bf7d95-0633-407f-bb0b-02563f13c068 + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs new file mode 100644 index 0000000000..3ca5029d70 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs @@ -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.Mvc.Razor.Precompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +{ + public class Program + { + public static int Main(string[] args) + { +#if DEBUG + DebugHelper.HandleDebugSwitch(ref args); +#endif + + var app = new PrecompilationApplication(typeof(Program)); + new PrecompileDispatchCommand().Configure(app); + return app.Execute(args); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2dc4003a17 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// 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.Reflection; +using System.Resources; + +[assembly: AssemblyMetadata("Serviceable", "True")] +[assembly: NeutralResourcesLanguage("en-us")] +[assembly: AssemblyCompany("Microsoft Corporation.")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json new file mode 100644 index 0000000000..e19f3cf655 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -0,0 +1,49 @@ +{ + "version": "1.0.0-*", + "description": "Razor precompilation", + "packOptions": { + "repository": { + "type": "git", + "url": "git://github.com/AspNet/Mvc" + }, + "tags": [ + "cshtml", + "razor", + "precompilation", + "aspnetcore" + ] + }, + "buildOptions": { + "outputName": "dotnet-razor-precompile", + "keyFile": "../../tools/Key.snk", + "warningsAsErrors": true, + "emitEntryPoint": true, + "nowarn": [ + "CS1591" + ], + + "xmlDoc": true + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { "target": "project" }, + "Microsoft.DotNet.Cli.Utils": "1.0.0-*", + "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", + "Microsoft.Extensions.DotnetToolDispatcher.Sources": { + "type": "build", + "version": "1.1.0-*" + } + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-*" + }, + "System.Runtime.Serialization.Primitives": "4.1.1-*" + } + }, + "net451": {} + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs new file mode 100644 index 0000000000..f19c4d15fd --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs @@ -0,0 +1,98 @@ +// 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.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests +{ + public class ApplicationWithConfigureMvcTest + : IClassFixture + { + public ApplicationWithConfigureMvcTest(ApplicationWithConfigureMvcFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static IEnumerable ApplicationWithTagHelpersData + { + get + { + var runtimeFlavors = new[] + { + RuntimeFlavor.Clr, + RuntimeFlavor.CoreClr, + }; + + var urls = new[] + { + "Index", + "ViewWithPreprocessor", + }; + + return Enumerable.Zip(urls, runtimeFlavors, (a, b) => new object[] { a, b }); + } + } + + [Theory] + [InlineData(RuntimeFlavor.Clr)] + [InlineData(RuntimeFlavor.CoreClr)] + public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var httpClient = new HttpClient() + { + BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) + }; + + // Act + var response = await httpClient.GetStringAsync(""); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); + } + } + + [Theory] + [InlineData(RuntimeFlavor.Clr)] + [InlineData(RuntimeFlavor.CoreClr)] + public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var httpClient = new HttpClient() + { + BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) + }; + + // Act + var response = await httpClient.GetStringAsync("Home/ViewWithPreprocessor"); + + // Assert + TestEmbeddedResource.AssertContent( + "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", + response); + } + } + + public class ApplicationWithConfigureMvcFixture : ApplicationTestFixture + { + public ApplicationWithConfigureMvcFixture() + : base("ApplicationWithConfigureMvc") + { + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs new file mode 100644 index 0000000000..b2fddca721 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs @@ -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.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public class TagHelperTest : IClassFixture + { + public TagHelperTest(ApplicationWithTagHelpersFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static IEnumerable ApplicationWithTagHelpersData + { + get + { + var runtimeFlavors = new[] + { + RuntimeFlavor.Clr, + RuntimeFlavor.CoreClr, + }; + + var urls = new[] + { + "ClassLibraryTagHelper", + "LocalTagHelper", + "NuGetPackageTagHelper", + }; + + return Enumerable.Zip(urls, runtimeFlavors, (a, b) => new object[] { a, b }); + } + } + + [Theory] + [MemberData(nameof(ApplicationWithTagHelpersData))] + public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var httpClient = new HttpClient() + { + BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) + }; + + // Act + var response = await httpClient.GetStringAsync($"Home/{url}"); + + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); + } + } + + public class ApplicationWithTagHelpersFixture : ApplicationTestFixture + { + public ApplicationWithTagHelpersFixture() + : base("ApplicationWithTagHelpers") + { + } + + protected override void Restore() + { + RestoreProject(Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryTagHelper"))); + base.Restore(); + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs new file mode 100644 index 0000000000..d56cb498cd --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs @@ -0,0 +1,40 @@ +// 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 Microsoft.Extensions.PlatformAbstractions; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public static class ApplicationPaths + { + private const string SolutionName = "MvcPrecompilation.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 = PlatformServices.Default.Application.ApplicationBasePath; + + 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}."); + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs new file mode 100644 index 0000000000..0223bc9e5b --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs @@ -0,0 +1,144 @@ +// 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.Runtime.InteropServices; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.Extensions.Logging; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public abstract class ApplicationTestFixture : IDisposable + { + public const string NuGetPackagesEnvironmentKey = "NUGET_PACKAGES"; + private readonly string _oldRestoreDirectory; + private bool _isRestored; + + protected ApplicationTestFixture(string applicationName) + { + ApplicationName = applicationName; + _oldRestoreDirectory = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey); + } + + public string ApplicationName { get; } + + public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName); + + public string TempRestoreDirectory { get; } = CreateTempRestoreDirectory(); + + public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor) + { + if (!_isRestored) + { + Restore(); + _isRestored = true; + } + + var tempRestoreDirectoryEnvironment = new KeyValuePair( + NuGetPackagesEnvironmentKey, + TempRestoreDirectory); + + var deploymentParameters = new DeploymentParameters( + ApplicationPath, + ServerType.Kestrel, + flavor, + RuntimeArchitecture.x64) + { + PublishApplicationBeforeDeployment = true, + TargetFramework = flavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", + Configuration = "Release", + EnvironmentVariables = + { + tempRestoreDirectoryEnvironment + }, + PublishEnvironmentVariables = + { + tempRestoreDirectoryEnvironment + }, + }; + + var logger = new LoggerFactory() + .AddConsole() + .CreateLogger($"{ApplicationName}:{flavor}"); + + return ApplicationDeployerFactory.Create(deploymentParameters, logger); + } + + protected virtual void Restore() + { + RestoreProject(ApplicationPath); + } + + public void Dispose() + { + try + { + Directory.Delete(TempRestoreDirectory, recursive: true); + } + catch (IOException) + { + // Ignore delete failures. + } + } + + protected void RestoreProject(string applicationDirectory) + { + var packagesDirectory = GetNuGetPackagesDirectory(); + var args = new[] + { + Path.Combine(applicationDirectory, "project.json"), + "-s", + packagesDirectory, + "-s", + ApplicationPaths.ArtifactPackagesDirectory, + "--packages", + TempRestoreDirectory, + }; + + var commandResult = Command + .CreateDotNet("restore", args) + .ForwardStdErr(Console.Error) + .ForwardStdOut(Console.Out) + .Execute(); + + Assert.True(commandResult.ExitCode == 0, + string.Join(Environment.NewLine, + $"dotnet {commandResult.StartInfo.Arguments} exited with {commandResult.ExitCode}.", + commandResult.StdOut, + commandResult.StdErr)); + + Console.WriteLine(commandResult.StdOut); + } + + private static string CreateTempRestoreDirectory() + { + var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + return Directory.CreateDirectory(path).FullName; + } + + private static string GetNuGetPackagesDirectory() + { + var nugetFeed = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey); + if (!string.IsNullOrEmpty(nugetFeed)) + { + return nugetFeed; + } + + string basePath; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + basePath = Environment.GetEnvironmentVariable("USERPROFILE"); + } + else + { + basePath = Environment.GetEnvironmentVariable("HOME"); + } + + return Path.Combine(basePath, ".nuget", "packages"); + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs new file mode 100644 index 0000000000..d584528d5f --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs @@ -0,0 +1,59 @@ +// 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 Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + 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"); + } + } + + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj new file mode 100644 index 0000000000..0fc55bc876 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj @@ -0,0 +1,22 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 46c9a4b2-8b1c-451b-b670-c194901d66ac + Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests + .\obj + .\bin\ + v4.6.1 + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..b1fa884228 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Xunit; + +[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt new file mode 100644 index 0000000000..edb2b9073a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt @@ -0,0 +1,2 @@ +AspNetCore.Views_Home_Index_cshtml, ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +
Hello world! \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt new file mode 100644 index 0000000000..8d0df2adff --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt @@ -0,0 +1 @@ +Hello from Test123 \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt new file mode 100644 index 0000000000..38c1e2ea7c --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt @@ -0,0 +1,25 @@ + + + + - ApplicationWithTagHelpers + + + + +
+ +AspNetCore.Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +
To boldy tag that no one has ever tagged before...
+ + + + +
+
+

© 2016 - ApplicationWithTagHelpers

+
+
+ + AspNetCore.Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt new file mode 100644 index 0000000000..c65026eb02 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt @@ -0,0 +1,25 @@ + + + + - ApplicationWithTagHelpers + + + + +
+ +AspNetCore.Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +TestTagHelper content. + + + + +
+
+

© 2016 - ApplicationWithTagHelpers

+
+
+ + AspNetCore.Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt new file mode 100644 index 0000000000..6a085c4be8 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt @@ -0,0 +1,165 @@ + + + + + + Home Page - SimpleApp + + + + + + + + + + +
+ +AspNetCore.Views_Home_Index_cshtml, SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + +
+
+

© 2016 - SimpleApp

+
+
+ + + + + + + + + + + + AspNetCore.Views_Shared__Layout_cshtml, SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs new file mode 100644 index 0000000000..aaa2944ac4 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs @@ -0,0 +1,51 @@ +// 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 Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public class SimpleAppTest : IClassFixture + { + public SimpleAppTest(SimpleAppTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Theory] + [InlineData(RuntimeFlavor.Clr)] + [InlineData(RuntimeFlavor.CoreClr)] + public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var httpClient = new HttpClient() + { + BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) + }; + + // Act + var response = await httpClient.GetStringAsync(""); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); + } + } + + public class SimpleAppTestFixture : ApplicationTestFixture + { + public SimpleAppTestFixture() + : base("SimpleApp") + { + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json new file mode 100644 index 0000000000..3e08ef5540 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json @@ -0,0 +1,29 @@ +{ + "buildOptions": { + "define": [ + "GENERATE_BASELINES" + ], + "embed": "Resources/*" + }, + "dependencies": { + "dotnet-test-xunit": "2.2.0-*", + "Microsoft.AspNetCore.Server.IntegrationTesting": "0.2.0-*", + "Microsoft.Extensions.Logging": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.1.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", + "xunit": "2.2.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + } + } + }, + "testRunner": "xunit" +} diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj new file mode 100644 index 0000000000..9cb473104c --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + e2eaeb85-91d5-478e-9ce2-964f68de20d0 + ApplicationWithConfigureMvc + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/Controllers/HomeController.cs b/testapps/ApplicationWithConfigureMvc/Controllers/HomeController.cs new file mode 100644 index 0000000000..0b6e29e940 --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/Controllers/HomeController.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ApplicationWithConfigureStartup.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() => View(); + + public IActionResult ViewWithPreprocessor() => View(); + } +} diff --git a/testapps/ApplicationWithConfigureMvc/Program.cs b/testapps/ApplicationWithConfigureMvc/Program.cs new file mode 100644 index 0000000000..2adf60f59b --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/Program.cs @@ -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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs new file mode 100644 index 0000000000..71ab2e314e --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs @@ -0,0 +1,19 @@ +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("\r\n", "\r\n
"))); + } + + return node; + } + } +} diff --git a/testapps/ApplicationWithConfigureMvc/Startup.cs b/testapps/ApplicationWithConfigureMvc/Startup.cs new file mode 100644 index 0000000000..124d81b51c --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/Startup.cs @@ -0,0 +1,47 @@ +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 => + { + options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols(new[] { "TEST123" }); + 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); + } + }; + }); + } + } +} diff --git a/testapps/ApplicationWithConfigureMvc/Views/Home/Index.cshtml b/testapps/ApplicationWithConfigureMvc/Views/Home/Index.cshtml new file mode 100644 index 0000000000..ff3fabfb67 --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/Views/Home/Index.cshtml @@ -0,0 +1,2 @@ +@GetType().AssemblyQualifiedName +Hello world! \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/Views/Home/ViewWithPreprocessor.cshtml b/testapps/ApplicationWithConfigureMvc/Views/Home/ViewWithPreprocessor.cshtml new file mode 100644 index 0000000000..6330cc26f5 --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/Views/Home/ViewWithPreprocessor.cshtml @@ -0,0 +1,7 @@ +@{ + var message = "Hello world message"; +#if TEST123 + message = "Hello from Test123"; +#endif +} +@message \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json new file mode 100644 index 0000000000..3a317fecce --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -0,0 +1,45 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj new file mode 100644 index 0000000000..5c14063cb2 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 2079872f-e8f9-4db1-a340-c0d897807b86 + ApplicationWithTagHelpers + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/ApplicationWithTagHelpers/Controllers/HomeController.cs b/testapps/ApplicationWithTagHelpers/Controllers/HomeController.cs new file mode 100644 index 0000000000..0e94a2ea33 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Controllers/HomeController.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ApplicationWithTagHelpers.Controllers +{ + public class HomeController : Controller + { + public IActionResult ClassLibraryTagHelper() => View(); + + public IActionResult LocalTagHelper() => View(); + + public IActionResult NuGetPackageTagHelper() => View(); + + public IActionResult About() => Content("About content"); + } +} diff --git a/testapps/ApplicationWithTagHelpers/Program.cs b/testapps/ApplicationWithTagHelpers/Program.cs new file mode 100644 index 0000000000..ea75f8ccab --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace ApplicationWithTagHelpers +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/ApplicationWithTagHelpers/Startup.cs b/testapps/ApplicationWithTagHelpers/Startup.cs new file mode 100644 index 0000000000..00a0fb6df9 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Startup.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace ApplicationWithTagHelpers +{ + 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?}"); + }); + } + } +} diff --git a/testapps/ApplicationWithTagHelpers/TagHelpers/TestTagHelper.cs b/testapps/ApplicationWithTagHelpers/TagHelpers/TestTagHelper.cs new file mode 100644 index 0000000000..c26d848552 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/TagHelpers/TestTagHelper.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace ApplicationWithTagHelpers.TagHelpers +{ + public class TestTagHelper : TagHelper + { + public TestTagHelper(IUrlHelperFactory urlHelperFactory) + { + UrlHelperFactory = urlHelperFactory; + } + + [HtmlAttributeNotBound] + public IUrlHelperFactory UrlHelperFactory { get; } + + [ViewContext] + [HtmlAttributeNotBound] + public ViewContext ViewContext { get; set; } + + public string Controller { get; set; } + + public string Action { get; set; } + + public override void Process(TagHelperContext context, TagHelperOutput output) + { + var urlHelper = UrlHelperFactory.GetUrlHelper(ViewContext); + output.Attributes.SetAttribute("href", urlHelper.Action(new UrlActionContext + { + Controller = Controller, + Action = Action + })); + + output.PreContent.SetContent($"{nameof(TestTagHelper)} content."); + } + } +} diff --git a/testapps/ApplicationWithTagHelpers/Views/Home/ClassLibraryTagHelper.cshtml b/testapps/ApplicationWithTagHelpers/Views/Home/ClassLibraryTagHelper.cshtml new file mode 100644 index 0000000000..731528bc7e --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/Home/ClassLibraryTagHelper.cshtml @@ -0,0 +1,7 @@ +@addTagHelper *, ClassLibraryTagHelper + +@GetType().AssemblyQualifiedName +
To boldy tag that no one has ever tagged before...
+ + + diff --git a/testapps/ApplicationWithTagHelpers/Views/Home/LocalTagHelper.cshtml b/testapps/ApplicationWithTagHelpers/Views/Home/LocalTagHelper.cshtml new file mode 100644 index 0000000000..11f4e00bc6 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/Home/LocalTagHelper.cshtml @@ -0,0 +1,7 @@ +@addTagHelper *, ApplicationWithTagHelpers + +@GetType().AssemblyQualifiedName + + + + diff --git a/testapps/ApplicationWithTagHelpers/Views/Home/NuGetPackageTagHelper.cshtml b/testapps/ApplicationWithTagHelpers/Views/Home/NuGetPackageTagHelper.cshtml new file mode 100644 index 0000000000..2175afad17 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/Home/NuGetPackageTagHelper.cshtml @@ -0,0 +1,12 @@ +@addTagHelper *, TagHelperSamples.Bootstrap + +@GetType().AssemblyQualifiedName + + +

Something happened

+

Something happened

+
+
+ + diff --git a/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml b/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..d62ae2daab --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml @@ -0,0 +1,20 @@ + + + + @ViewData["Title"] - ApplicationWithTagHelpers + + + +
+ @RenderBody() +
+
+

© 2016 - ApplicationWithTagHelpers

+
+
+ @RenderSection("scripts", required: false) + @GetType().AssemblyQualifiedName + + diff --git a/testapps/ApplicationWithTagHelpers/Views/_ViewImports.cshtml b/testapps/ApplicationWithTagHelpers/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..da4a9da3f1 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using ApplicationWithTagHelpers +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/testapps/ApplicationWithTagHelpers/Views/_ViewStart.cshtml b/testapps/ApplicationWithTagHelpers/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json new file mode 100644 index 0000000000..8c88764d38 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -0,0 +1,49 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "ClassLibraryTagHelper": { + "target": "project" + }, + "TagHelperSamples.Bootstrap": "1.1.1", + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} diff --git a/testapps/ClassLibraryTagHelper/BoldTagHelper.cs b/testapps/ClassLibraryTagHelper/BoldTagHelper.cs new file mode 100644 index 0000000000..1f090f1af1 --- /dev/null +++ b/testapps/ClassLibraryTagHelper/BoldTagHelper.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace ClassLibraryTagHelpers +{ + [HtmlTargetElement(Attributes = "bold")] + public class BoldTagHelper : TagHelper + { + public override void Process(TagHelperContext context, TagHelperOutput output) + { + output.Attributes.RemoveAll("bold"); + output.PreContent.AppendHtml(""); + output.PostContent.AppendHtml(""); + } + } +} \ No newline at end of file diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj new file mode 100644 index 0000000000..80d42837fa --- /dev/null +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 39efa075-3673-49ab-95f3-aa5e88df6c30 + ClassLibraryTagHelpers + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json new file mode 100644 index 0000000000..f18444f3dc --- /dev/null +++ b/testapps/ClassLibraryTagHelper/project.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*" + }, + "frameworks": { + "netstandard1.6": {}, + "net451": {} + } +} diff --git a/testapps/NuGet.config b/testapps/NuGet.config new file mode 100644 index 0000000000..4243f75fa0 --- /dev/null +++ b/testapps/NuGet.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/testapps/SimpleApp/Controllers/HomeController.cs b/testapps/SimpleApp/Controllers/HomeController.cs new file mode 100644 index 0000000000..9798d3cc1b --- /dev/null +++ b/testapps/SimpleApp/Controllers/HomeController.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Mvc; + +namespace SimpleApp.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + } +} diff --git a/testapps/SimpleApp/Program.cs b/testapps/SimpleApp/Program.cs new file mode 100644 index 0000000000..6ed39c5e32 --- /dev/null +++ b/testapps/SimpleApp/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace SimpleApp +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/SimpleApp/SimpleApp.xproj b/testapps/SimpleApp/SimpleApp.xproj new file mode 100644 index 0000000000..0ab0e1618e --- /dev/null +++ b/testapps/SimpleApp/SimpleApp.xproj @@ -0,0 +1,23 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 8fa176ed-c29e-48d6-bc7a-1c3a862cb15f + SimpleApp + .\obj + .\bin\ + v4.6.1 + + + 2.0 + + + + + + + diff --git a/testapps/SimpleApp/Startup.cs b/testapps/SimpleApp/Startup.cs new file mode 100644 index 0000000000..461873a890 --- /dev/null +++ b/testapps/SimpleApp/Startup.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace SimpleApp +{ + 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?}"); + }); + } + } +} diff --git a/testapps/SimpleApp/Views/Home/About.cshtml b/testapps/SimpleApp/Views/Home/About.cshtml new file mode 100644 index 0000000000..50476d1fbd --- /dev/null +++ b/testapps/SimpleApp/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewData["Title"] = "About"; +} +

@ViewData["Title"].

+

@ViewData["Message"]

+ +

Use this area to provide additional information.

diff --git a/testapps/SimpleApp/Views/Home/Index.cshtml b/testapps/SimpleApp/Views/Home/Index.cshtml new file mode 100644 index 0000000000..de297ae049 --- /dev/null +++ b/testapps/SimpleApp/Views/Home/Index.cshtml @@ -0,0 +1,110 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +@GetType().AssemblyQualifiedName + + + diff --git a/testapps/SimpleApp/Views/Shared/_Layout.cshtml b/testapps/SimpleApp/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..4f65b1d219 --- /dev/null +++ b/testapps/SimpleApp/Views/Shared/_Layout.cshtml @@ -0,0 +1,68 @@ + + + + + + @ViewData["Title"] - SimpleApp + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2016 - SimpleApp

+
+
+ + + + + + + + + + + + + @RenderSection("scripts", required: false) + @GetType().AssemblyQualifiedName + + diff --git a/testapps/SimpleApp/Views/_ViewImports.cshtml b/testapps/SimpleApp/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..71413f674c --- /dev/null +++ b/testapps/SimpleApp/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using SimpleApp +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/testapps/SimpleApp/Views/_ViewStart.cshtml b/testapps/SimpleApp/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/testapps/SimpleApp/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json new file mode 100644 index 0000000000..3a317fecce --- /dev/null +++ b/testapps/SimpleApp/project.json @@ -0,0 +1,45 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} diff --git a/testapps/global.json b/testapps/global.json new file mode 100644 index 0000000000..c8de56e20f --- /dev/null +++ b/testapps/global.json @@ -0,0 +1,3 @@ +{ + "projects": [] +} diff --git a/tools/Key.snk b/tools/Key.snk new file mode 100644 index 0000000000000000000000000000000000000000..e10e4889c125d3120cd9e81582243d70f7cbb806 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098=Iw=HCsnz~#iVhm& zj%TU(_THUee?3yHBjk$37ysB?i5#7WD$={H zV4B!OxRPrb|8)HPg~A}8P>^=#y<)56#=E&NzcjOtPK~<4n6GHt=K$ro*T(lhby_@U zEk(hLzk1H)0yXj{A_5>fk-TgNoP|q6(tP2xo8zt8i%212CWM#AeCd?`hS|4~L({h~Moo(~vy&3Z z1uI}`fd^*>o=rwbAGymj6RM^pZm(*Kfhs+Y1#`-2JPWZMK8@;ZWCk2+9bX4YP);~fj-BU*R zQPvWv$89!{Rl9wM+zR>_TSkn^voYxA?2G iKnV#iZ6Ah`K>b=@=IjYJXrxL124zR(38)nxe+&q_$QXwJ literal 0 HcmV?d00001 From 4f766a3fa5211420344ec93421e55f4abb81d338 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 19 Aug 2016 11:01:50 -0700 Subject: [PATCH 003/295] Fix issues with feeds used to restore testapps * Remove duplicated feeds from testapps/NuGet.config * Don't specify feeds as part of restore. Let testapps/NuGet.config dictate this. * Switch to dotnet.myget.org --- NuGet.config | 2 +- .../Infrastructure/ApplicationTestFixture.cs | 4 ---- testapps/NuGet.config | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/NuGet.config b/NuGet.config index 5500f6d507..0fd623ffdd 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@  - + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs index 0223bc9e5b..3e18e43254 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs @@ -91,10 +91,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation var args = new[] { Path.Combine(applicationDirectory, "project.json"), - "-s", - packagesDirectory, - "-s", - ApplicationPaths.ArtifactPackagesDirectory, "--packages", TempRestoreDirectory, }; diff --git a/testapps/NuGet.config b/testapps/NuGet.config index 4243f75fa0..af0ad362e1 100644 --- a/testapps/NuGet.config +++ b/testapps/NuGet.config @@ -1,8 +1,6 @@  - - From 5d82791a5c02d5bbbd2b6bff9f74a470a795efd7 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 19 Aug 2016 00:25:50 -0700 Subject: [PATCH 004/295] Fix build by using volatile feed Also make build.sh executable --- build.sh | 0 makefile.shade | 1 + 2 files changed, 1 insertion(+) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/makefile.shade b/makefile.shade index 99c11d9c68..48d362cc4c 100644 --- a/makefile.shade +++ b/makefile.shade @@ -6,4 +6,5 @@ use-standard-lifecycle k-standard-goals #repo-initialize target='initialize' + use-volatile-feed dotnet command='restore src test ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' From 1cb4b8161bb62641c547eba65e4596dc58091a40 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 22 Aug 2016 10:41:48 -0700 Subject: [PATCH 005/295] Make build work when src directory does not exist \ does not get built. --- makefile.shade | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/makefile.shade b/makefile.shade index 48d362cc4c..718ef178a3 100644 --- a/makefile.shade +++ b/makefile.shade @@ -7,4 +7,12 @@ k-standard-goals #repo-initialize target='initialize' use-volatile-feed - dotnet command='restore src test ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' + @{ + var directoriesToRestore = "test"; + if (Directory.Exists("src")) + { + directoriesToRestore = "src " + directoriesToRestore; + } + } + dotnet command='restore ${directoriesToRestore} ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' + - Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build")); From 4e2ed96392845fa4df73cce42de12512bcdd7791 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 22 Aug 2016 09:36:48 -0700 Subject: [PATCH 006/295] Adding README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..b5f4761d04 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +ASP.NET Core MVC Precompilation +=== + +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. + +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. From dd297b6d09f645ce8b80311a335178b97d854240 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 23 Aug 2016 11:03:04 -0700 Subject: [PATCH 007/295] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b5f4761d04..4aced681dc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ASP.NET Core MVC Precompilation === +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. From 3369bb6e904e01efea3f9d3089d6c7cb38e720a8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 19 Aug 2016 14:39:21 -0700 Subject: [PATCH 008/295] Fix test runs on xplat --- .../ApplicationWithConfigureMvcTest.cs | 26 ++++------------ .../ApplicationWithTagHelpersTest.cs | 10 ++---- .../Infrastructure/ApplicationTestFixture.cs | 13 +++++--- .../Infrastructure/HttpClientExtensions.cs | 31 +++++++++++++++++++ .../Infrastructure/RuntimeFlavors.cs | 24 ++++++++++++++ .../SimpleAppTest.cs | 15 +++++++-- .../project.json | 2 +- .../RazorRewriter.cs | 3 +- 8 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs index f19c4d15fd..63c8225cc4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs @@ -21,29 +21,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests public ApplicationTestFixture Fixture { get; } - public static IEnumerable ApplicationWithTagHelpersData + public static IEnumerable SupportedFlavorsTheoryData { get { - var runtimeFlavors = new[] - { - RuntimeFlavor.Clr, - RuntimeFlavor.CoreClr, - }; - - var urls = new[] - { - "Index", - "ViewWithPreprocessor", - }; - - return Enumerable.Zip(urls, runtimeFlavors, (a, b) => new object[] { a, b }); + return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); } } [Theory] - [InlineData(RuntimeFlavor.Clr)] - [InlineData(RuntimeFlavor.CoreClr)] + [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor) { // Arrange @@ -56,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests }; // Act - var response = await httpClient.GetStringAsync(""); + var response = await httpClient.GetStringWithRetryAsync("", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); @@ -64,8 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests } [Theory] - [InlineData(RuntimeFlavor.Clr)] - [InlineData(RuntimeFlavor.CoreClr)] + [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor) { // Arrange @@ -78,7 +64,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests }; // Act - var response = await httpClient.GetStringAsync("Home/ViewWithPreprocessor"); + var response = await httpClient.GetStringWithRetryAsync("Home/ViewWithPreprocessor", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent( diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs index b2fddca721..dcb6219a8e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs @@ -25,12 +25,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { get { - var runtimeFlavors = new[] - { - RuntimeFlavor.Clr, - RuntimeFlavor.CoreClr, - }; - var urls = new[] { "ClassLibraryTagHelper", @@ -38,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation "NuGetPackageTagHelper", }; - return Enumerable.Zip(urls, runtimeFlavors, (a, b) => new object[] { a, b }); + return Enumerable.Zip(urls, RuntimeFlavors.SupportedFlavors, (a, b) => new object[] { a, b }); } } @@ -56,7 +50,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation }; // Act - var response = await httpClient.GetStringAsync($"Home/{url}"); + var response = await httpClient.GetStringWithRetryAsync($"Home/{url}", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs index 3e18e43254..91e28815a2 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; using Microsoft.Extensions.Logging; @@ -30,8 +31,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public string TempRestoreDirectory { get; } = CreateTempRestoreDirectory(); + public ILogger Logger { get; private set; } + public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor) { + Logger = new LoggerFactory() + .AddConsole() + .CreateLogger($"{ApplicationName}:{flavor}"); + if (!_isRestored) { Restore(); @@ -61,11 +68,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation }, }; - var logger = new LoggerFactory() - .AddConsole() - .CreateLogger($"{ApplicationName}:{flavor}"); - - return ApplicationDeployerFactory.Create(deploymentParameters, logger); + return ApplicationDeployerFactory.Create(deploymentParameters, Logger); } protected virtual void Restore() diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs new file mode 100644 index 0000000000..553608c120 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs @@ -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 System; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public static class HttpClientExtensions + { + public static async Task 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; + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs new file mode 100644 index 0000000000..e4781e38db --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs @@ -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.Collections.Generic; +using System.Runtime.InteropServices; +using Microsoft.AspNetCore.Server.IntegrationTesting; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public static class RuntimeFlavors + { + public static IEnumerable SupportedFlavors + { + get + { + yield return RuntimeFlavor.CoreClr; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + yield return RuntimeFlavor.Clr; + } + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs index aaa2944ac4..d0a89b9bf7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs @@ -2,6 +2,8 @@ // 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.Linq; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; @@ -18,9 +20,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } + public static IEnumerable SupportedFlavorsTheoryData + { + get + { + return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); + } + } + [Theory] - [InlineData(RuntimeFlavor.Clr)] - [InlineData(RuntimeFlavor.CoreClr)] + [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) { // Arrange @@ -33,7 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation }; // Act - var response = await httpClient.GetStringAsync(""); + var response = await httpClient.GetStringWithRetryAsync("", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json index 3e08ef5540..754ecbfe63 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json @@ -1,7 +1,7 @@ { "buildOptions": { "define": [ - "GENERATE_BASELINES" + "__remove_this_to__GENERATE_BASELINES" ], "embed": "Resources/*" }, diff --git a/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs index 71ab2e314e..5c956c8e70 100644 --- a/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs +++ b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs @@ -10,7 +10,8 @@ namespace ApplicationWithConfigureStartup { if (node.Token.IsKind(SyntaxKind.StringLiteralToken)) { - return node.WithToken(SyntaxFactory.Literal(node.Token.ValueText.Replace("\r\n", "\r\n
"))); + return node.WithToken(SyntaxFactory.Literal( + node.Token.ValueText.Replace(Environment.NewLine, Environment.NewLine + "
"))); } return node; From ea461c3b4796f3b0c02dc8a5a982e3e4c35c16b4 Mon Sep 17 00:00:00 2001 From: Derek Gray Date: Wed, 24 Aug 2016 12:03:38 -0500 Subject: [PATCH 009/295] Update CommonOptions.cs The additional `app.HelpOption` here prevents the application from displaying help when that option is passed due to the `CommandLineUtils` choking on the duplicated template; also, `PrecompilationApplication` already defines its own `HelpOption` and `Description`. --- .../Internal/CommonOptions.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs index 9540724a97..60a26335ec 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs @@ -18,9 +18,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal public void Configure(CommandLineApplication app) { - app.Description = "Precompiles an application."; - app.HelpOption("-?|-h|--help"); - ProjectArgument = app.Argument( "project", "The path to the project (project folder or project.json) with precompilation."); From 7d3befc88dabc68390580d96690c9a8c5094d5a3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 25 Aug 2016 14:16:26 -0700 Subject: [PATCH 010/295] Fix build break --- testapps/ApplicationWithConfigureMvc/RazorRewriter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs index 5c956c8e70..4c0e42db4f 100644 --- a/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs +++ b/testapps/ApplicationWithConfigureMvc/RazorRewriter.cs @@ -1,4 +1,5 @@ -using Microsoft.CodeAnalysis; +using System; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; From 21535e5b0d6829a362c073066589f62852a02d94 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 23 Aug 2016 12:37:48 -0700 Subject: [PATCH 011/295] Add a test that demonstrates precompiled class library --- TestApps.sln | 6 + .../Internal/PrecompileDispatchCommand.cs | 4 +- .../ApplicationConsumingPrecompiledViews.cs | 118 ++++++++++++++++++ .../Infrastructure/ApplicationTestFixture.cs | 58 ++++++--- .../Infrastructure/CommandResultExtensions.cs | 25 ++++ ...mingPrecompiledViews.Manage.Home.Index.txt | 13 ++ ...tionUsingPrecompiledViewClassLibrary.xproj | 19 +++ .../Program.cs | 26 ++++ .../Startup.cs | 29 +++++ .../project.json | 36 ++++++ .../Areas/Manage/HomeController.cs | 10 ++ .../Areas/Manage/Views/Home/Index.cshtml | 9 ++ .../Areas/Manage/Views/Shared/_Layout.cshtml | 8 ++ .../ClassLibraryWithPrecompiledViews.xproj | 19 +++ .../Program.cs | 9 ++ .../project.json | 37 ++++++ 16 files changed, 406 insertions(+), 20 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt create mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj create mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs create mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs create mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json create mode 100644 testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/HomeController.cs create mode 100644 testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Home/Index.cshtml create mode 100644 testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml create mode 100644 testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj create mode 100644 testapps/ClassLibraryWithPrecompiledViews/Program.cs create mode 100644 testapps/ClassLibraryWithPrecompiledViews/project.json diff --git a/TestApps.sln b/TestApps.sln index cc683f4dd6..9a5a6ce8ab 100644 --- a/TestApps.sln +++ b/TestApps.sln @@ -17,6 +17,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryTagHelper", "te EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.xproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryWithPrecompiledViews", "testapps\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.xproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.Build.0 = Release|Any CPU + {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs index 7a95538c45..a784cb9231 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -101,9 +101,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal #if DEBUG var commandLineArgs = Environment.GetCommandLineArgs(); - if (commandLineArgs.Length > 0 && commandLineArgs[0] == "--debug") + if (commandLineArgs.Length > 1 && commandLineArgs[1] == "--debug") { - dispatchArgs.Insert(0, commandLineArgs[0]); + dispatchArgs.Insert(0, commandLineArgs[1]); } #endif diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs new file mode 100644 index 0000000000..fe441c70b1 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs @@ -0,0 +1,118 @@ +// 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.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.DotNet.Cli.Utils; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public class ApplicationConsumingPrecompiledViews + : IClassFixture + { + public ApplicationConsumingPrecompiledViews(ApplicationConsumingPrecompiledViewsFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Theory] + [InlineData(RuntimeFlavor.Clr)] + [InlineData(RuntimeFlavor.CoreClr)] + public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var httpClient = new HttpClient() + { + BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) + }; + + // Act + var response = await httpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); + } + } + + public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture + { + private readonly string _packOutputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + + public ApplicationConsumingPrecompiledViewsFixture() + : base("ApplicationUsingPrecompiledViewClassLibrary") + { + ClassLibraryPath = Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryWithPrecompiledViews")); + } + + private string ClassLibraryPath { get; } + + protected override void Restore() + { + CreateClassLibraryPackage(); + RestoreProject(ApplicationPath, new[] { _packOutputDirectory }); + } + + private void CreateClassLibraryPackage() + { + RestoreProject(ClassLibraryPath); + ExecuteForClassLibrary(Command.CreateDotNet("build", new[] { ClassLibraryPath, "-c", "Release" })); + ExecuteForClassLibrary(Command.CreateDotNet( + "razor-precompile", + GetPrecompileArguments("net451"))); + + ExecuteForClassLibrary(Command.CreateDotNet( + "razor-precompile", + GetPrecompileArguments("netcoreapp1.0"))); + + var timestamp = "z" + DateTime.UtcNow.Ticks.ToString().PadLeft(18, '0'); + var packCommand = Command + .CreateDotNet("pack", new[] { "--no-build", "-c", "Release", "-o", _packOutputDirectory }) + .EnvironmentVariable("DOTNET_BUILD_VERSION", timestamp); + + ExecuteForClassLibrary(packCommand); + } + + private void ExecuteForClassLibrary(ICommand command) + { + Console.WriteLine($"Running {command.CommandName} {command.CommandArgs}"); + command + .WorkingDirectory(ClassLibraryPath) + .EnvironmentVariable(NuGetPackagesEnvironmentKey, TempRestoreDirectory) + .EnvironmentVariable(DotnetSkipFirstTimeExperience, "true") + .ForwardStdErr(Console.Error) + .ForwardStdOut(Console.Out) + .Execute() + .EnsureSuccessful(); + } + + private string[] GetPrecompileArguments(string targetFramework) + { + return new[] + { + ClassLibraryPath, + "-c", + "Release", + "-f", + $"{targetFramework}", + "-o", + $"obj/precompiled/{targetFramework}", + }; + } + + public override void Dispose() + { + TryDeleteDirectory(_packOutputDirectory); + base.Dispose(); + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs index 91e28815a2..11b19c616d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs @@ -5,17 +5,18 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; using Microsoft.Extensions.Logging; -using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { public abstract class ApplicationTestFixture : IDisposable { public const string NuGetPackagesEnvironmentKey = "NUGET_PACKAGES"; + public const string DotnetSkipFirstTimeExperience = "DOTNET_SKIP_FIRST_TIME_EXPERIENCE"; + public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; + private readonly string _oldRestoreDirectory; private bool _isRestored; @@ -49,6 +50,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation NuGetPackagesEnvironmentKey, TempRestoreDirectory); + var skipFirstTimeCacheCreation = new KeyValuePair( + DotnetSkipFirstTimeExperience, + "true"); + + var telemetryOptOut = new KeyValuePair( + DotnetCLITelemetryOptOut, + "1"); + var deploymentParameters = new DeploymentParameters( ApplicationPath, ServerType.Kestrel, @@ -57,14 +66,19 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { PublishApplicationBeforeDeployment = true, TargetFramework = flavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", + PreservePublishedApplicationForDebugging = true, Configuration = "Release", EnvironmentVariables = { - tempRestoreDirectoryEnvironment + tempRestoreDirectoryEnvironment, + skipFirstTimeCacheCreation, + telemetryOptOut, }, PublishEnvironmentVariables = { - tempRestoreDirectoryEnvironment + tempRestoreDirectoryEnvironment, + skipFirstTimeCacheCreation, + telemetryOptOut, }, }; @@ -76,11 +90,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation RestoreProject(ApplicationPath); } - public void Dispose() + public virtual void Dispose() + { + TryDeleteDirectory(TempRestoreDirectory); + } + + protected static void TryDeleteDirectory(string directory) { try { - Directory.Delete(TempRestoreDirectory, recursive: true); + Directory.Delete(directory, recursive: true); } catch (IOException) { @@ -88,29 +107,32 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation } } - protected void RestoreProject(string applicationDirectory) + protected void RestoreProject(string applicationDirectory, string[] additionalFeeds = null) { var packagesDirectory = GetNuGetPackagesDirectory(); - var args = new[] + var args = new List { Path.Combine(applicationDirectory, "project.json"), "--packages", TempRestoreDirectory, }; - var commandResult = Command + if (additionalFeeds != null) + { + foreach (var feed in additionalFeeds) + { + args.Add("-f"); + args.Add(feed); + } + } + + Command .CreateDotNet("restore", args) + .EnvironmentVariable(DotnetSkipFirstTimeExperience, "true") .ForwardStdErr(Console.Error) .ForwardStdOut(Console.Out) - .Execute(); - - Assert.True(commandResult.ExitCode == 0, - string.Join(Environment.NewLine, - $"dotnet {commandResult.StartInfo.Arguments} exited with {commandResult.ExitCode}.", - commandResult.StdOut, - commandResult.StdErr)); - - Console.WriteLine(commandResult.StdOut); + .Execute() + .EnsureSuccessful(); } private static string CreateTempRestoreDirectory() diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs new file mode 100644 index 0000000000..fae4b2a74b --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs @@ -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. + +using System; +using Microsoft.DotNet.Cli.Utils; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public static class CommandResultExtensions + { + public static CommandResult EnsureSuccessful(this CommandResult commandResult) + { + var startInfo = commandResult.StartInfo; + + Assert.True(commandResult.ExitCode == 0, + string.Join(Environment.NewLine, + $"{startInfo.FileName} {startInfo.Arguments} exited with {commandResult.ExitCode}.", + commandResult.StdOut, + commandResult.StdErr)); + + return commandResult; + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt new file mode 100644 index 0000000000..de01ff4f89 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt @@ -0,0 +1,13 @@ + + + + AspNetCore.Areas_Manage_Views_Shared__Layout_cshtml, ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + +

Admin home page

+ + + + Test section + + + diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj new file mode 100644 index 0000000000..0559856e9a --- /dev/null +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + cef718e4-4556-422f-b64f-9d9671218e67 + ApplicationUsingPrecompiledViewClassLibrary + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs new file mode 100644 index 0000000000..ea75f8ccab --- /dev/null +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace ApplicationWithTagHelpers +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs new file mode 100644 index 0000000000..85f98e4a67 --- /dev/null +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace ApplicationWithTagHelpers +{ + 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: "areaRoute", + template: "{area:exists}/{controller=Home}/{action=Index}"); + + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json new file mode 100644 index 0000000000..4ecb593c54 --- /dev/null +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -0,0 +1,36 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "ClassLibraryWithPrecompiledViews": { + "target": "package", + "version": "1.0.0-*" + }, + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + } +} diff --git a/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/HomeController.cs b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/HomeController.cs new file mode 100644 index 0000000000..7bb8681f69 --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/HomeController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ClassLibraryWithPrecompiledViews +{ + [Area("Manage")] + public class HomeController : Controller + { + public IActionResult Index() => View(); + } +} diff --git a/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Home/Index.cshtml b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Home/Index.cshtml new file mode 100644 index 0000000000..51a348bbea --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Home/Index.cshtml @@ -0,0 +1,9 @@ +@{ + Layout = "_Layout"; +} + +

Admin home page

+ +@section TestSection { + Test section +} \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..6578e0e81c --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml @@ -0,0 +1,8 @@ + + + + @GetType().AssemblyQualifiedName + @RenderBody() + @RenderSection("TestSection") + + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj new file mode 100644 index 0000000000..217dde2a8b --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 4684de8b-3fbe-421b-8798-56c3d6698b76 + ClassLibraryWithPrecompiledViews + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/Program.cs b/testapps/ClassLibraryWithPrecompiledViews/Program.cs new file mode 100644 index 0000000000..50d50a8c81 --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/Program.cs @@ -0,0 +1,9 @@ +namespace ClassLibraryWithPrecompiledViews +{ + public class Program + { + public static void Main() + { + } + } +} \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json new file mode 100644 index 0000000000..edc9e94031 --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -0,0 +1,37 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "preserveCompilationContext": true, + "emitEntryPoint": true + }, + "packOptions": { + "files": { + "mappings": { + "lib/": "obj/precompiled/" + } + } + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + } + }, + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + } +} From 021ceb71be2a7e2e121dcb29d8bb4cdcbdff2fd9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 26 Aug 2016 09:58:33 -0700 Subject: [PATCH 012/295] Don't run desktop tests on xplat --- .../ApplicationConsumingPrecompiledViews.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs index fe441c70b1..eeb2a49861 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs @@ -2,7 +2,9 @@ // 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.Linq; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; @@ -21,9 +23,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } + public static IEnumerable SupportedFlavorsTheoryData + { + get + { + return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); + } + } + [Theory] - [InlineData(RuntimeFlavor.Clr)] - [InlineData(RuntimeFlavor.CoreClr)] + [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor) { // Arrange From 6c7f621d5dc01057cbb1f4b9f4cca51434a2b0c0 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 26 Aug 2016 09:58:33 -0700 Subject: [PATCH 013/295] Don't run desktop tests on xplat --- .../ApplicationConsumingPrecompiledViews.cs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs index fe441c70b1..5f28a88d91 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs @@ -2,8 +2,11 @@ // 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.Linq; using System.Net.Http; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; @@ -21,9 +24,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } + public static IEnumerable SupportedFlavorsTheoryData + { + get + { + return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); + } + } + [Theory] - [InlineData(RuntimeFlavor.Clr)] - [InlineData(RuntimeFlavor.CoreClr)] + [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor) { // Arrange @@ -65,9 +75,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { RestoreProject(ClassLibraryPath); ExecuteForClassLibrary(Command.CreateDotNet("build", new[] { ClassLibraryPath, "-c", "Release" })); - ExecuteForClassLibrary(Command.CreateDotNet( - "razor-precompile", - GetPrecompileArguments("net451"))); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // Don't run precompile tool for net451 on xplat. + ExecuteForClassLibrary(Command.CreateDotNet( + "razor-precompile", + GetPrecompileArguments("net451"))); + } ExecuteForClassLibrary(Command.CreateDotNet( "razor-precompile", From daf4843fb3d62d63155c12ffa171948404b3df87 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 26 Aug 2016 11:14:38 -0700 Subject: [PATCH 014/295] Move Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests -> Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests --- MvcPrecompilation.sln | 2 +- .../ApplicationConsumingPrecompiledViews.cs | 0 .../ApplicationWithConfigureMvcTest.cs | 2 +- .../ApplicationWithTagHelpersTest.cs | 0 .../Infrastructure/ApplicationPaths.cs | 0 .../Infrastructure/ApplicationTestFixture.cs | 0 .../Infrastructure/CommandResultExtensions.cs | 0 .../Infrastructure/HttpClientExtensions.cs | 0 .../Infrastructure/RuntimeFlavors.cs | 0 .../Infrastructure/TestEmbeddedResource.cs | 0 ...t.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj} | 1 - .../Properties/AssemblyInfo.cs | 0 .../ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt | 0 .../Resources/ApplicationWithConfigureMvc.Home.Index.txt | 0 .../ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt | 0 .../ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt | 0 .../Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt | 0 .../Resources/SimpleAppTest.Home.Index.txt | 0 .../SimpleAppTest.cs | 0 .../project.json | 0 20 files changed, 2 insertions(+), 3 deletions(-) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/ApplicationConsumingPrecompiledViews.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/ApplicationWithConfigureMvcTest.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/ApplicationWithTagHelpersTest.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/ApplicationPaths.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/ApplicationTestFixture.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/CommandResultExtensions.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/HttpClientExtensions.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/RuntimeFlavors.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Infrastructure/TestEmbeddedResource.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj} (92%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Properties/AssemblyInfo.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/ApplicationWithConfigureMvc.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/Resources/SimpleAppTest.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/SimpleAppTest.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests => Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests}/project.json (100%) diff --git a/MvcPrecompilation.sln b/MvcPrecompilation.sln index 91c5e92da2..0ee22293f9 100644 --- a/MvcPrecompilation.sln +++ b/MvcPrecompilation.sln @@ -17,7 +17,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Ra EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-505E-4283-89DA-BBD9D28B53DB}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationConsumingPrecompiledViews.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index 63c8225cc4..5378c97dd6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { public class ApplicationWithConfigureMvcTest : IClassFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/ApplicationWithTagHelpersTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationPaths.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/ApplicationTestFixture.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/CommandResultExtensions.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/HttpClientExtensions.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/RuntimeFlavors.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Infrastructure/TestEmbeddedResource.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj similarity index 92% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj index 0fc55bc876..9299b84636 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests.xproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj @@ -7,7 +7,6 @@ 46c9a4b2-8b1c-451b-b670-c194901d66ac - Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests .\obj .\bin\ v4.6.1 diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Properties/AssemblyInfo.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Properties/AssemblyInfo.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Properties/AssemblyInfo.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/Resources/SimpleAppTest.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/SimpleAppTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tests/project.json rename to test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json From b4b35138c5932d2708e86b9a557b335a1141c3c8 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sun, 4 Sep 2016 16:12:13 -0700 Subject: [PATCH 015/295] Increase .travis.yml consistency between repos - aspnet/Universe#349 - minimize `dotnet` setup time; no need for caching - `KOREBUILD_TEST_DNXCORE` env variable isn't used anymore - no need for icu4c w/ current `dotnet` builds --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57860350a0..d7636fa329 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,10 @@ addons: - libssl-dev - libunwind8 - zlib1g -before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install icu4c; brew install openssl; brew link --force openssl; fi +env: + global: + - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + - DOTNET_CLI_TELEMETRY_OPTOUT: 1 mono: - 4.0.5 os: @@ -24,7 +26,7 @@ branches: - release - dev - /^(.*\/)?ci-.*$/ +before_install: + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi script: - ./build.sh --quiet verify -env: - - KOREBUILD_TEST_SKIPMONO=1 \ No newline at end of file From d046091727bbd9a0bef4cb1bb213c41ccb0f964a Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 1 Sep 2016 17:05:46 -0700 Subject: [PATCH 016/295] Add an option to embed sources for compiled views (cshtml content) in the generated assembly Fixes #2 --- TestApps.sln | 6 ++ .../Internal/CommonOptions.cs | 8 ++ .../Internal/PrecompileRunCommand.cs | 30 ++++++- .../Internal/PrecompileDispatchCommand.cs | 7 ++ .../Infrastructure/ApplicationTestFixture.cs | 5 +- .../PublishWithEmbedViewSourcesTest.cs | 81 +++++++++++++++++++ .../Areas/TestArea/Views/Home/Index.cshtml | 1 + .../Controllers/HomeController.cs | 23 ++++++ .../PublishWithEmbedViewSources/Program.cs | 26 ++++++ .../PublishWithEmbedViewSources.xproj | 18 +++++ .../PublishWithEmbedViewSources/Startup.cs | 26 ++++++ .../Views/Home/About.cshtml | 1 + .../Views/Home/Index.cshtml | 1 + .../PublishWithEmbedViewSources/project.json | 45 +++++++++++ 14 files changed, 275 insertions(+), 3 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs create mode 100644 testapps/PublishWithEmbedViewSources/Areas/TestArea/Views/Home/Index.cshtml create mode 100644 testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs create mode 100644 testapps/PublishWithEmbedViewSources/Program.cs create mode 100644 testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj create mode 100644 testapps/PublishWithEmbedViewSources/Startup.cs create mode 100644 testapps/PublishWithEmbedViewSources/Views/Home/About.cshtml create mode 100644 testapps/PublishWithEmbedViewSources/Views/Home/Index.cshtml create mode 100644 testapps/PublishWithEmbedViewSources/project.json diff --git a/TestApps.sln b/TestApps.sln index 9a5a6ce8ab..9cfeb8f1b1 100644 --- a/TestApps.sln +++ b/TestApps.sln @@ -19,6 +19,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithConfigureMvc EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryWithPrecompiledViews", "testapps\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.xproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PublishWIthEmbedViewSources", "testapps\PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.xproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.Build.0 = Debug|Any CPU {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.ActiveCfg = Release|Any CPU {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.Build.0 = Release|Any CPU + {E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs index 60a26335ec..71d8e7b3f6 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs @@ -9,6 +9,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal { public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type"; public static readonly string ContentRootTemplate = "--content-root"; + public static readonly string EmbedViewSourceTemplate = "--embed-view-sources"; public CommandArgument ProjectArgument { get; private set; } @@ -16,6 +17,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal public CommandOption ContentRootOption { get; private set; } + public CommandOption EmbedViewSourcesOption { get; private set; } + public void Configure(CommandLineApplication app) { ProjectArgument = app.Argument( @@ -31,6 +34,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal ContentRootTemplate, "The application's content root.", CommandOptionType.SingleValue); + + EmbedViewSourcesOption = app.Option( + EmbedViewSourceTemplate, + "Embed view sources as resources in the generated assembly.", + CommandOptionType.NoValue); } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs index 1e599b1a81..f223a0f6d4 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs @@ -95,9 +95,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal var precompileAssemblyName = $"{ApplicationNameOption.Value()}{AssemblyPart.PrecompiledViewsAssemblySuffix}"; var compilation = CompileViews(results, precompileAssemblyName); + var resources = GetResources(results); var assemblyPath = Path.Combine(OutputPathOption.Value(), precompileAssemblyName + ".dll"); - var emitResult = EmitAssembly(compilation, assemblyPath); + var emitResult = EmitAssembly(compilation, assemblyPath, resources); if (!emitResult.Success) { @@ -115,7 +116,31 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal return 0; } - private EmitResult EmitAssembly(CSharpCompilation compilation, string assemblyPath) + 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].RelativeFileInfo; + + resources[i] = new ResourceDescription( + fileInfo.RelativePath.Replace('\\', '/'), + fileInfo.FileInfo.CreateReadStream, + isPublic: true); + } + + return resources; + } + + private EmitResult EmitAssembly( + CSharpCompilation compilation, + string assemblyPath, + ResourceDescription[] resources) { Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath)); @@ -127,6 +152,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal emitResult = compilation.Emit( assemblyStream, pdbStream, + manifestResources: resources, options: MvcServiceProvider.Compiler.EmitOptions); } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs index a784cb9231..c8bb5185cf 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -29,6 +29,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal private CommandOption BuildBasePathOption { get; set; } + private CommandOption DumpFilesOption { get; set; } + private string ProjectPath { get; set; } private string Configuration { get; set; } @@ -81,6 +83,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal dispatchArgs.Add(Options.ConfigureCompilationType.Value()); } + if (Options.EmbedViewSourcesOption.HasValue()) + { + dispatchArgs.Add(CommonOptions.EmbedViewSourceTemplate); + } + var compilerOptions = runtimeContext.ProjectFile.GetCompilerOptions(TargetFramework, Configuration); if (!string.IsNullOrEmpty(compilerOptions.KeyFile)) { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 11b19c616d..a688632a81 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Net.Http; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; @@ -32,6 +33,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public string TempRestoreDirectory { get; } = CreateTempRestoreDirectory(); + public HttpClient HttpClient { get; } = new HttpClient(); + public ILogger Logger { get; private set; } public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor) @@ -66,7 +69,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { PublishApplicationBeforeDeployment = true, TargetFramework = flavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", - PreservePublishedApplicationForDebugging = true, Configuration = "Release", EnvironmentVariables = { @@ -93,6 +95,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public virtual void Dispose() { TryDeleteDirectory(TempRestoreDirectory); + HttpClient.Dispose(); } protected static void TryDeleteDirectory(string directory) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs new file mode 100644 index 0000000000..609be6da99 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -0,0 +1,81 @@ +// 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.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests +{ + public class PublishWithEmbedViewSourcesTest + : IClassFixture + { + private const string ApplicationName = "PublishWithEmbedViewSources"; + + public PublishWithEmbedViewSourcesTest(PublishWithEmbedViewSourcesTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static IEnumerable SupportedFlavorsTheoryData + { + get + { + return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); + } + } + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor) + { + // Arrange + var expectedViews = new[] + { + "Areas/TestArea/Views/Home/Index.cshtml", + "Views/Home/About.cshtml", + "Views/Home/Index.cshtml", + }; + var expectedText = "Hello Index!"; + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var assemblyPath = Path.Combine( + deploymentResult.DeploymentParameters.PublishedApplicationRootPath, + $"{ApplicationName}.PrecompiledViews.dll"); + + // Act - 1 + var response1 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/Index", + Fixture.Logger); + + // Assert - 1 + Assert.Equal(expectedText, response1.Trim()); + + // Act - 2 + var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + Fixture.Logger); + + // Assert - 2 + Assert.Equal( + expectedViews, + response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); + } + } + + public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture + { + public PublishWithEmbedViewSourcesTestFixture() + : base(PublishWithEmbedViewSourcesTest.ApplicationName) + { + } + } + } +} diff --git a/testapps/PublishWithEmbedViewSources/Areas/TestArea/Views/Home/Index.cshtml b/testapps/PublishWithEmbedViewSources/Areas/TestArea/Views/Home/Index.cshtml new file mode 100644 index 0000000000..a2ab94af53 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Areas/TestArea/Views/Home/Index.cshtml @@ -0,0 +1 @@ +Hello Index! \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs b/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs new file mode 100644 index 0000000000..8d93240d44 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs @@ -0,0 +1,23 @@ +using System; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; + +namespace PublishWithEmbedViewSources.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public string GetPrecompiledResourceNames() + { + var precompiledAssembly = Assembly.Load( + new AssemblyName("PublishWithEmbedViewSources.PrecompiledViews")); + return string.Join( + Environment.NewLine, + precompiledAssembly.GetManifestResourceNames()); + } + } +} diff --git a/testapps/PublishWithEmbedViewSources/Program.cs b/testapps/PublishWithEmbedViewSources/Program.cs new file mode 100644 index 0000000000..66e30e6cfe --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace PublishWithEmbedViewSources +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj new file mode 100644 index 0000000000..25dace6505 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj @@ -0,0 +1,18 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + e3462190-3068-40f0-9aa5-34779fe252ac + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/Startup.cs b/testapps/PublishWithEmbedViewSources/Startup.cs new file mode 100644 index 0000000000..c1e951b594 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Startup.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace PublishWithEmbedViewSources +{ + 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?}"); + }); + } + } +} diff --git a/testapps/PublishWithEmbedViewSources/Views/Home/About.cshtml b/testapps/PublishWithEmbedViewSources/Views/Home/About.cshtml new file mode 100644 index 0000000000..b35b6196f4 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Views/Home/About.cshtml @@ -0,0 +1 @@ +Hello About! \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/Views/Home/Index.cshtml b/testapps/PublishWithEmbedViewSources/Views/Home/Index.cshtml new file mode 100644 index 0000000000..a2ab94af53 --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/Views/Home/Index.cshtml @@ -0,0 +1 @@ +Hello Index! \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json new file mode 100644 index 0000000000..f70de8c71d --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -0,0 +1,45 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "postpublish": "dotnet razor-precompile --embed-view-sources --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} From 0e54281e8b703236595a733523447c442221f42c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 7 Sep 2016 16:38:38 -0700 Subject: [PATCH 017/295] Adding tests for command line parsing Fixes #10 --- MvcPrecompilation.sln | 14 ++ .../Internal/PrecompilationApplication.cs | 16 +- .../Internal/PrecompileRunCommand.cs | 39 +++- .../Internal/PrecompileDispatchCommand.cs | 40 ++-- .../project.json | 4 +- ...Mvc.Razor.Precompilation.Design.Test.xproj | 20 ++ .../PrecompileRunCommandTest.cs | 193 +++++++++++++++++ .../project.json | 20 ++ .../PublishWithEmbedViewSourcesTest.cs | 6 +- ....Mvc.Razor.Precompilation.Tools.Test.xproj | 20 ++ .../PrecompileDispatchCommandTest.cs | 196 ++++++++++++++++++ .../project.json | 20 ++ 12 files changed, 546 insertions(+), 42 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json diff --git a/MvcPrecompilation.sln b/MvcPrecompilation.sln index 0ee22293f9..d41b701568 100644 --- a/MvcPrecompilation.sln +++ b/MvcPrecompilation.sln @@ -19,6 +19,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-5 EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj", "{B58E3380-D451-4E54-B522-CD21404FCD58}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +41,14 @@ Global {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|Any CPU.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 + {B58E3380-D451-4E54-B522-CD21404FCD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B58E3380-D451-4E54-B522-CD21404FCD58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B58E3380-D451-4E54-B522-CD21404FCD58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B58E3380-D451-4E54-B522-CD21404FCD58}.Release|Any CPU.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}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -45,5 +57,7 @@ Global {4339FC9B-AEC6-442A-B413-A41555ED76C7} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} {F8BF7D95-0633-407F-BB0B-02563F13C068} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} {46C9A4B2-8B1C-451B-B670-C194901D66AC} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} + {B58E3380-D451-4E54-B522-CD21404FCD58} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} EndGlobalSection EndGlobal diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs index 72e4861055..d4a27d4311 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs @@ -37,10 +37,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal } catch (Exception ex) { - Console.Error.WriteLine(ex.Message); -#if DEBUG - Console.Error.WriteLine(ex); -#endif + Error.WriteLine(ex.Message); + Error.WriteLine(ex.StackTrace); return 1; } } @@ -48,14 +46,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal private string GetInformationalVersion() { var assembly = _callingType.GetTypeInfo().Assembly; - var attributes = assembly.GetCustomAttributes( - typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute[]; - - var versionAttribute = attributes.Length == 0 ? - assembly.GetName().Version.ToString() : - attributes[0].InformationalVersion; - - return versionAttribute; + var attribute = assembly.GetCustomAttribute(); + return attribute.InformationalVersion; } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs index f223a0f6d4..2f776d041c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs @@ -24,13 +24,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal { public class PrecompileRunCommand { - public static readonly string ApplicationNameTemplate = "--applicationName"; + public static readonly string ApplicationNameTemplate = "--application-name"; public static readonly string OutputPathTemplate = "--output-path"; private static readonly ParallelOptions ParalellOptions = new ParallelOptions { MaxDegreeOfParallelism = 4 }; + private CommandLineApplication Application { get; set; } + private CommandOption OutputPathOption { get; set; } private CommandOption ApplicationNameOption { get; set; } @@ -45,6 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal public void Configure(CommandLineApplication app) { + Application = app; Options.Configure(app); StrongNameOptions.Configure(app); @@ -63,7 +66,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal private int Execute() { - ParseArguments(); + if (!ParseArguments()) + { + return 1; + } MvcServiceProvider = new MvcServiceProvider( ProjectPath, @@ -71,7 +77,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal Options.ContentRootOption.Value(), Options.ConfigureCompilationType.Value()); - Console.WriteLine("Running Razor view precompilation."); + Application.Out.WriteLine("Running Razor view precompilation."); var stopWatch = Stopwatch.StartNew(); var results = GenerateCode(); @@ -83,7 +89,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal success = false; foreach (var error in result.GeneratorResults.ParserErrors) { - Console.Error.WriteLine($"{error.Location.FilePath} ({error.Location.LineIndex}): {error.Message}"); + Application.Error.WriteLine($"{error.Location.FilePath} ({error.Location.LineIndex}): {error.Message}"); } } } @@ -104,15 +110,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal { foreach (var diagnostic in emitResult.Diagnostics) { - Console.Error.WriteLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); + Application.Error.WriteLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); } return 1; } stopWatch.Stop(); - Console.WriteLine($"Precompiled views emitted to {assemblyPath}."); - Console.WriteLine($"Successfully compiled {results.Length} Razor views in {stopWatch.ElapsedMilliseconds}ms."); + Application.Out.WriteLine($"Precompiled views emitted to {assemblyPath}."); + Application.Out.WriteLine($"Successfully compiled {results.Length} Razor views in {stopWatch.ElapsedMilliseconds}ms."); return 0; } @@ -198,23 +204,34 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal return codeGenerator.Compilation; } - private void ParseArguments() + private bool ParseArguments() { ProjectPath = Options.ProjectArgument.Value; if (string.IsNullOrEmpty(ProjectPath)) { - throw new ArgumentException("Project path not specified."); + Application.Error.WriteLine("Project path not specified."); + return false; } if (!OutputPathOption.HasValue()) { - throw new ArgumentException($"Option {OutputPathTemplate} does not specify a value."); + Application.Error.WriteLine($"Option {OutputPathTemplate} does not specify a value."); + return false; } if (!ApplicationNameOption.HasValue()) { - throw new ArgumentException($"Option {ApplicationNameTemplate} does not specify a value."); + Application.Error.WriteLine($"Option {ApplicationNameTemplate} does not specify a value."); + return false; } + + if (!Options.ContentRootOption.HasValue()) + { + Application.Error.WriteLine($"Option {CommonOptions.ContentRootTemplate} does not specify a value."); + return false; + } + + return true; } private ViewCompilationInfo[] GenerateCode() diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs index c8bb5185cf..4db727a086 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -17,6 +17,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal { public class PrecompileDispatchCommand { + private CommandLineApplication Application { get; set; } + private CommonOptions Options { get; } = new CommonOptions(); private CommandOption FrameworkOption { get; set; } @@ -25,10 +27,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal private CommandOption OutputPathOption { get; set; } - private NuGetFramework TargetFramework { get; set; } - private CommandOption BuildBasePathOption { get; set; } + private NuGetFramework TargetFramework { get; set; } + private CommandOption DumpFilesOption { get; set; } private string ProjectPath { get; set; } @@ -39,6 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal public void Configure(CommandLineApplication app) { + Application = app; Options.Configure(app); FrameworkOption = app.Option( "-f|--framework", @@ -52,7 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal OutputPathOption = app.Option( "-o|--output-path", - "Published path of the application.", + "Output path.", CommandOptionType.SingleValue); app.OnExecute(() => Execute()); @@ -60,7 +63,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal private int Execute() { - ParseArguments(); + if (!ParseArguments()) + { + return 1; + } var runtimeContext = GetRuntimeContext(); @@ -125,41 +131,45 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal toolName: toolName); var commandExitCode = dispatchCommand - .ForwardStdErr(Console.Error) - .ForwardStdOut(Console.Out) + .ForwardStdErr(Application.Error) + .ForwardStdOut(Application.Out) .Execute() .ExitCode; return commandExitCode; } - private void ParseArguments() + private bool ParseArguments() { - ProjectPath = GetProjectPath(); + ProjectPath = GetProjectPath(Options.ProjectArgument.Value); Configuration = ConfigurationOption.Value() ?? DotNet.Cli.Utils.Constants.DefaultConfiguration; if (!FrameworkOption.HasValue()) { - throw new Exception($"Option {FrameworkOption.Template} does not have a value."); + Application.Error.WriteLine($"Option {FrameworkOption.Template} does not have a value."); + return false; } TargetFramework = NuGetFramework.Parse(FrameworkOption.Value()); if (!OutputPathOption.HasValue()) { - throw new Exception($"Option {OutputPathOption.Template} does not have a value."); + Application.Error.WriteLine($"Option {OutputPathOption.Template} does not have a value."); + return false; } OutputPath = OutputPathOption.Value(); + + return true; } - private string GetProjectPath() + public static string GetProjectPath(string projectArgument) { string projectPath; - if (!string.IsNullOrEmpty(Options.ProjectArgument.Value)) + if (!string.IsNullOrEmpty(projectArgument)) { - projectPath = Path.GetFullPath(Options.ProjectArgument.Value); - if (string.Equals(Path.GetFileName(ProjectPath), "project.json", StringComparison.OrdinalIgnoreCase)) + projectPath = Path.GetFullPath(projectArgument); + if (string.Equals(Path.GetFileName(projectPath), "project.json", StringComparison.OrdinalIgnoreCase)) { - projectPath = Path.GetDirectoryName(ProjectPath); + projectPath = Path.GetDirectoryName(projectPath); } if (!Directory.Exists(projectPath)) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index e19f3cf655..681230ea57 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -25,7 +25,9 @@ "xmlDoc": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { "target": "project" }, + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "target": "project" + }, "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", "Microsoft.Extensions.DotnetToolDispatcher.Sources": { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj new file mode 100644 index 0000000000..8edf50470d --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj @@ -0,0 +1,20 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + e0d75b4e-839f-4f80-9b1f-b33f616bcc5f + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs new file mode 100644 index 0000000000..222d4c937a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs @@ -0,0 +1,193 @@ +// 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.Precompilation.Design.Internal; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +{ + 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 (project folder or project.json) with precompilation. + +Options: + -?|-h|--help Show help information + --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. + --output-path Path to the emit the precompiled assembly to. + --application-name Name of the application to produce precompiled assembly for."; + + 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()); + } + + private static string GetToolVersion() + { + return typeof(Program) + .GetTypeInfo() + .Assembly + .GetCustomAttribute() + .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(), + }; + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json new file mode 100644 index 0000000000..b40a97d94f --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json @@ -0,0 +1,20 @@ +{ + "dependencies": { + "dotnet-test-xunit": "2.2.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", + "xunit": "2.2.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "net451": {} + } + }, + "testRunner": "xunit" +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index 609be6da99..a408edaefa 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -64,9 +64,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests Fixture.Logger); // Assert - 2 - Assert.Equal( - expectedViews, - response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj new file mode 100644 index 0000000000..c5140ed5fd --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj @@ -0,0 +1,20 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + b58e3380-d451-4e54-b522-cd21404fcd58 + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs new file mode 100644 index 0000000000..cdaeca1c0c --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs @@ -0,0 +1,196 @@ +// 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.Precompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +{ + public class PrecompileDispatchCommandTest + { + [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 (project folder or project.json) with precompilation. + +Options: + -?|-h|--help Show help information + --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. + -f|--framework Target Framework + -c|--configuration Configuration + -o|--output-path Output path."; + 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 RunPrintsHelp_WhenInvalidOptionsAreSpecified() + { + // 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 RunPrintsError_IfFrameworkIfNotSpecified() + { + // Arrange + var expected = "Option -f|--framework does not have a value."; + var args = new string[0]; + + // Act + var result = Execute(args); + + // Assert + Assert.Equal(1, result.ExitCode); + Assert.Empty(result.Out); + Assert.Equal(expected, result.Error.Trim()); + } + + [Fact] + public void RunPrintsError_IfOutputPathIfNotSpecified() + { + // Arrange + var expected = "Option -o|--output-path does not have a value."; + var args = new[] + { + "-f", + "framework" + }; + + // Act + var result = Execute(args); + + // Assert + Assert.Equal(1, result.ExitCode); + Assert.Empty(result.Out); + Assert.Equal(expected, result.Error.Trim()); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + public void GetProjectPath_ReturnsCurrentDirectoryIfArgumentIsNullOrEmpty(string projectPath) + { + // Act + var actual = PrecompileDispatchCommand.GetProjectPath(projectPath); + + // Assert + Assert.Equal(Directory.GetCurrentDirectory(), actual); + } + + public static TheoryData GetProjectPath_ReturnsArgumentIfNotNullOrEmptyData + { + get + { + return new TheoryData + { + { "", Directory.GetCurrentDirectory() }, + { "project.json", Directory.GetCurrentDirectory() }, + { Path.GetTempPath(), Path.GetTempPath() }, + }; + } + } + + [Theory] + [MemberData(nameof(GetProjectPath_ReturnsArgumentIfNotNullOrEmptyData))] + public void GetProjectPath_ReturnsArgumentIfNotNullOrEmpty(string projectPath, string expected) + { + // Act + var actual = PrecompileDispatchCommand.GetProjectPath(projectPath); + + // Assert + Assert.Equal(expected, actual); + } + + [Fact] + public void GetProjectPath_ThrowsIfDirectoryDoesNotExist() + { + // Arrange + var nonExistent = Path.GetRandomFileName(); + + // Act & Assert + var ex = Assert.Throws( + () => PrecompileDispatchCommand.GetProjectPath(nonExistent)); + Assert.Equal($"Could not find directory {Path.GetFullPath(nonExistent)}.", ex.Message); + } + + private static string GetToolVersion() + { + return typeof(Program) + .GetTypeInfo() + .Assembly + .GetCustomAttribute() + .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 PrecompileDispatchCommand().Configure(app); + var exitCode = app.Execute(args); + + return new ExecuteResult + { + ExitCode = exitCode, + Out = outputWriter.ToString(), + Error = errorWriter.ToString(), + }; + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json new file mode 100644 index 0000000000..b40a97d94f --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json @@ -0,0 +1,20 @@ +{ + "dependencies": { + "dotnet-test-xunit": "2.2.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", + "xunit": "2.2.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "net451": {} + } + }, + "testRunner": "xunit" +} From 755957b694f38f393735314d17a7dde242df940d Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 12 Sep 2016 15:18:18 -0700 Subject: [PATCH 018/295] Use HttpClient from Fixture instrad of creating a new one per test --- .../ApplicationConsumingPrecompiledViews.cs | 9 +++------ .../ApplicationWithConfigureMvcTest.cs | 18 ++++++------------ .../ApplicationWithTagHelpersTest.cs | 10 +++------- .../SimpleAppTest.cs | 10 +++------- 4 files changed, 15 insertions(+), 32 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index 5f28a88d91..cd589745cc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Net.Http; using System.Runtime.InteropServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; @@ -40,13 +39,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); - var httpClient = new HttpClient() - { - BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) - }; // Act - var response = await httpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri + "Manage/Home", + Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index 5378c97dd6..4265905f6a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -1,10 +1,8 @@ // 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.Linq; -using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; @@ -37,13 +35,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); - var httpClient = new HttpClient() - { - BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) - }; // Act - var response = await httpClient.GetStringWithRetryAsync("", Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); @@ -58,13 +54,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); - var httpClient = new HttpClient() - { - BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) - }; // Act - var response = await httpClient.GetStringWithRetryAsync("Home/ViewWithPreprocessor", Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor", + Fixture.Logger); // Assert TestEmbeddedResource.AssertContent( diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs index dcb6219a8e..d515c00d45 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs @@ -1,11 +1,9 @@ // 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.Linq; -using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; @@ -44,13 +42,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); - var httpClient = new HttpClient() - { - BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) - }; // Act - var response = await httpClient.GetStringWithRetryAsync($"Home/{url}", Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/{url}", + Fixture.Logger); // Assert TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs index d0a89b9bf7..f6b97c2ce3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs @@ -1,10 +1,8 @@ // 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.Linq; -using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; @@ -36,13 +34,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); - var httpClient = new HttpClient() - { - BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) - }; // Act - var response = await httpClient.GetStringWithRetryAsync("", Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); From 3b45ea5c270a23a19fa4a9bb9b35ffbdb8f7a91c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 12 Sep 2016 14:56:09 -0700 Subject: [PATCH 019/295] Add a test that verifies strong name signing works for precompiled views Fixes #16 --- TestApps.sln | 6 +++ .../ApplicationConsumingPrecompiledViews.cs | 8 +-- .../ApplicationWithConfigureMvcTest.cs | 8 +-- .../Infrastructure/RuntimeFlavors.cs | 15 ++++++ .../PublishWithEmbedViewSourcesTest.cs | 8 +-- .../Resources/StrongNamedApp.Home.Index.txt | 1 + .../SimpleAppTest.cs | 8 +-- .../StrongNamedAppTest.cs | 50 +++++++++++++++++++ .../Controllers/HomeController.cs | 9 ++++ testapps/StrongNamedApp/Program.cs | 26 ++++++++++ testapps/StrongNamedApp/Startup.cs | 26 ++++++++++ testapps/StrongNamedApp/StrongNamedApp.xproj | 18 +++++++ .../StrongNamedApp/Views/Home/Index.cshtml | 1 + testapps/StrongNamedApp/project.json | 46 +++++++++++++++++ 14 files changed, 202 insertions(+), 28 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs create mode 100644 testapps/StrongNamedApp/Controllers/HomeController.cs create mode 100644 testapps/StrongNamedApp/Program.cs create mode 100644 testapps/StrongNamedApp/Startup.cs create mode 100644 testapps/StrongNamedApp/StrongNamedApp.xproj create mode 100644 testapps/StrongNamedApp/Views/Home/Index.cshtml create mode 100644 testapps/StrongNamedApp/project.json diff --git a/TestApps.sln b/TestApps.sln index 9cfeb8f1b1..7b40d9f475 100644 --- a/TestApps.sln +++ b/TestApps.sln @@ -21,6 +21,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryWithPrecompiled EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PublishWIthEmbedViewSources", "testapps\PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.xproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StrongNamedApp", "testapps\StrongNamedApp\StrongNamedApp.xproj", "{88903BE5-0676-4667-8160-B24646E0B76E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,6 +53,10 @@ Global {E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.Build.0 = Release|Any CPU + {88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index cd589745cc..db0b63a017 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -23,13 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } - public static IEnumerable SupportedFlavorsTheoryData - { - get - { - return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); - } - } + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; [Theory] [MemberData(nameof(SupportedFlavorsTheoryData))] diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index 4265905f6a..762faba4f1 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -19,13 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } - public static IEnumerable SupportedFlavorsTheoryData - { - get - { - return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); - } - } + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; [Theory] [MemberData(nameof(SupportedFlavorsTheoryData))] diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs index e4781e38db..f75324015f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.IntegrationTesting; +using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { @@ -20,5 +21,19 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation } } } + + public static TheoryData SupportedFlavorsTheoryData + { + get + { + var theory = new TheoryData(); + foreach (var item in SupportedFlavors) + { + theory.Add(item); + } + + return theory; + } + } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index a408edaefa..b945947a54 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -23,13 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests public ApplicationTestFixture Fixture { get; } - public static IEnumerable SupportedFlavorsTheoryData - { - get - { - return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); - } - } + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; [Theory] [MemberData(nameof(SupportedFlavorsTheoryData))] diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt new file mode 100644 index 0000000000..6ae2a2651a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt @@ -0,0 +1 @@ +Hello from view in AspNetCore.Views_Home_Index_cshtml, StrongNamedApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs index f6b97c2ce3..b1a7a8120d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs @@ -18,13 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } - public static IEnumerable SupportedFlavorsTheoryData - { - get - { - return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); - } - } + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; [Theory] [MemberData(nameof(SupportedFlavorsTheoryData))] diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs new file mode 100644 index 0000000000..3c9b5629ae --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs @@ -0,0 +1,50 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public class StrongNamedAppTest : IClassFixture + { + public StrongNamedAppTest(StrongNamedAppFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); + + // Assert + TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); + } + } + + public class StrongNamedAppFixture : ApplicationTestFixture + { + public StrongNamedAppFixture() + : base("StrongNamedApp") + { + } + } + } +} diff --git a/testapps/StrongNamedApp/Controllers/HomeController.cs b/testapps/StrongNamedApp/Controllers/HomeController.cs new file mode 100644 index 0000000000..8877a4cc81 --- /dev/null +++ b/testapps/StrongNamedApp/Controllers/HomeController.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Mvc; + +namespace StrongNamedApp.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() => View(); + } +} diff --git a/testapps/StrongNamedApp/Program.cs b/testapps/StrongNamedApp/Program.cs new file mode 100644 index 0000000000..52868ba38a --- /dev/null +++ b/testapps/StrongNamedApp/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace StrongNamedApp +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/StrongNamedApp/Startup.cs b/testapps/StrongNamedApp/Startup.cs new file mode 100644 index 0000000000..a75f450846 --- /dev/null +++ b/testapps/StrongNamedApp/Startup.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace StrongNamedApp +{ + 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?}"); + }); + } + } +} diff --git a/testapps/StrongNamedApp/StrongNamedApp.xproj b/testapps/StrongNamedApp/StrongNamedApp.xproj new file mode 100644 index 0000000000..3cc9e35815 --- /dev/null +++ b/testapps/StrongNamedApp/StrongNamedApp.xproj @@ -0,0 +1,18 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 88903be5-0676-4667-8160-b24646e0b76e + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/StrongNamedApp/Views/Home/Index.cshtml b/testapps/StrongNamedApp/Views/Home/Index.cshtml new file mode 100644 index 0000000000..ac68ee5f45 --- /dev/null +++ b/testapps/StrongNamedApp/Views/Home/Index.cshtml @@ -0,0 +1 @@ +Hello from view in @GetType().AssemblyQualifiedName diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json new file mode 100644 index 0000000000..4ab5dcc974 --- /dev/null +++ b/testapps/StrongNamedApp/project.json @@ -0,0 +1,46 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true, + "keyFile": "../../tools/Key.snk", + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + }, + "net451": {} + }, + + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} From 88fa650138a775b9dfa101c419d638586fb600d3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 14 Sep 2016 15:30:23 -0700 Subject: [PATCH 020/295] Reacting to Mvc changes --- .../Internal/PrecompileRunCommand.cs | 2 +- .../Internal/ViewInfoContainerCodeGenerator.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs index 2f776d041c..03922fd1af 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs @@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal return 1; } - var precompileAssemblyName = $"{ApplicationNameOption.Value()}{AssemblyPart.PrecompiledViewsAssemblySuffix}"; + var precompileAssemblyName = $"{ApplicationNameOption.Value()}{ViewsFeatureProvider.PrecompiledViewsAssemblySuffix}"; var compilation = CompileViews(results, precompileAssemblyName); var resources = GetResources(results); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs index 00619f6ada..2e1973d7fc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Mvc.Razor.Internal; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -39,11 +40,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal } var factoryContent = $@" -namespace {AssemblyPart.ViewInfoContainerNamespace} +namespace {ViewsFeatureProvider.ViewInfoContainerNamespace} {{ - public class {AssemblyPart.ViewInfoContainerTypeName} : global::{typeof(ViewInfoContainer).FullName} + public class {ViewsFeatureProvider.ViewInfoContainerTypeName} : global::{typeof(ViewInfoContainer).FullName} {{ - public {AssemblyPart.ViewInfoContainerTypeName}() : base(new[] + public {ViewsFeatureProvider.ViewInfoContainerTypeName}() : base(new[] {{ {precompiledViewsArray} }}) From 1f8d3c6bf1eda8e44a95aacf06834b0fc5dda5fa Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 28 Sep 2016 11:51:39 -0700 Subject: [PATCH 021/295] Updating partner package versions --- .../project.json | 4 ++-- .../project.json | 5 ++--- .../project.json | 7 +++---- .../project.json | 9 ++++----- .../project.json | 7 +++---- .../project.json | 8 +++----- testapps/ApplicationWithConfigureMvc/project.json | 10 +++------- testapps/ApplicationWithTagHelpers/project.json | 14 +++++--------- testapps/ClassLibraryTagHelper/project.json | 7 ++++--- .../ClassLibraryWithPrecompiledViews/project.json | 9 ++++----- testapps/PublishWithEmbedViewSources/project.json | 10 +++------- testapps/SimpleApp/project.json | 10 +++------- testapps/StrongNamedApp/project.json | 12 ++++-------- 13 files changed, 43 insertions(+), 69 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json index 26565cfcec..7f4b5e15dd 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json @@ -1,4 +1,4 @@ -{ +{ "version": "1.0.0-*", "description": "Razor precompilation", "packOptions": { @@ -32,7 +32,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-*" + "version": "1.1.0-*" } } }, diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index 681230ea57..d223786d14 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -21,7 +21,6 @@ "nowarn": [ "CS1591" ], - "xmlDoc": true }, "dependencies": { @@ -41,9 +40,9 @@ "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-*" + "version": "1.1.0-*" }, - "System.Runtime.Serialization.Primitives": "4.1.1-*" + "System.Runtime.Serialization.Primitives": "4.3.0-*" } }, "net451": {} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json index b40a97d94f..b9ccb755ee 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json @@ -1,20 +1,19 @@ -{ +{ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", "xunit": "2.2.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0" + "version": "1.1.0-*" } }, "net451": {} } }, "testRunner": "xunit" -} +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json index 754ecbfe63..f2c685fab7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "define": [ "__remove_this_to__GENERATE_BASELINES" @@ -8,22 +8,21 @@ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Server.IntegrationTesting": "0.2.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.Logging": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.1.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", "xunit": "2.2.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0" + "version": "1.1.0-*" } } } }, "testRunner": "xunit" -} +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json index b40a97d94f..b9ccb755ee 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json @@ -1,20 +1,19 @@ -{ +{ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", "xunit": "2.2.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0" + "version": "1.1.0-*" } }, "net451": {} } }, "testRunner": "xunit" -} +} \ No newline at end of file diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 4ecb593c54..4585bd9e74 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true @@ -13,19 +13,17 @@ "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -33,4 +31,4 @@ "web.config" ] } -} +} \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 3a317fecce..901275d263 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true @@ -14,23 +14,20 @@ "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, - "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -38,8 +35,7 @@ "web.config" ] }, - "scripts": { "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" } -} +} \ No newline at end of file diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index 8c88764d38..a6b90dc1b0 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true @@ -7,7 +7,6 @@ "ClassLibraryTagHelper": { "target": "project" }, - "TagHelperSamples.Bootstrap": "1.1.1", "Microsoft.AspNetCore.Mvc": "1.1.0-*", "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { "version": "1.0.0-*", @@ -16,25 +15,23 @@ }, "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.Extensions.Logging.Console": "1.1.0-*", + "TagHelperSamples.Bootstrap": "1.1.1" }, - "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -42,8 +39,7 @@ "web.config" ] }, - "scripts": { "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" } -} +} \ No newline at end of file diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json index f18444f3dc..6c2e8ed290 100644 --- a/testapps/ClassLibraryTagHelper/project.json +++ b/testapps/ClassLibraryTagHelper/project.json @@ -1,9 +1,10 @@ -{ +{ "dependencies": { - "Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*" + "Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*", + "NETStandard.Library": "1.6.1-*" }, "frameworks": { "netstandard1.6": {}, "net451": {} } -} +} \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index edc9e94031..5f7fd859e7 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -1,4 +1,4 @@ -{ +{ "version": "1.0.0-*", "buildOptions": { "preserveCompilationContext": true, @@ -7,7 +7,7 @@ "packOptions": { "files": { "mappings": { - "lib/": "obj/precompiled/" + "lib/": "obj/precompiled/" } } }, @@ -22,16 +22,15 @@ "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} } -} +} \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index f70de8c71d..7bb2c8b933 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true @@ -14,23 +14,20 @@ "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, - "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -38,8 +35,7 @@ "web.config" ] }, - "scripts": { "postpublish": "dotnet razor-precompile --embed-view-sources --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" } -} +} \ No newline at end of file diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 3a317fecce..901275d263 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -1,4 +1,4 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true @@ -14,23 +14,20 @@ "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, - "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -38,8 +35,7 @@ "web.config" ] }, - "scripts": { "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" } -} +} \ No newline at end of file diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index 4ab5dcc974..78ed09942e 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -1,8 +1,8 @@ -{ +{ "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true, - "keyFile": "../../tools/Key.snk", + "keyFile": "../../tools/Key.snk" }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", @@ -15,23 +15,20 @@ "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, - "tools": { "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, - "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.1.0-*", "type": "platform" } } }, "net451": {} }, - "publishOptions": { "include": [ "wwwroot", @@ -39,8 +36,7 @@ "web.config" ] }, - "scripts": { "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" } -} +} \ No newline at end of file From 2f4316b24f1285f2db4247ca5d2f8c7efc7e86ab Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 6 Oct 2016 11:11:44 -0700 Subject: [PATCH 022/295] Add Microsoft.DotNet.InternalAbstractions to resolve runtime failure. Pin the version of ProjectModel.Loader and Cli.Utils --- .../project.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index d223786d14..333b2f9356 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -27,7 +27,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { "target": "project" }, - "Microsoft.DotNet.Cli.Utils": "1.0.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", "Microsoft.Extensions.DotnetToolDispatcher.Sources": { "type": "build", @@ -37,7 +37,8 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-*", + "Microsoft.DotNet.InternalAbstractions": "1.0.0", + "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", "Microsoft.NETCore.App": { "type": "platform", "version": "1.1.0-*" From 3c6ad8fc64177f11eaeda2ba65e0c642179ad96f Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 12 Oct 2016 13:46:12 -0700 Subject: [PATCH 023/295] Updating to netcoreapp1.1 --- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../ApplicationUsingPrecompiledViewClassLibrary/project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json index 7f4b5e15dd..62c7e60d38 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json @@ -28,7 +28,7 @@ "Microsoft.Extensions.CommandLineUtils": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index 333b2f9356..4b2d4162f8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -35,7 +35,7 @@ } }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.DotNet.InternalAbstractions": "1.0.0", "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json index b9ccb755ee..6578892574 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json @@ -5,7 +5,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json index f2c685fab7..a655962ab9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json @@ -15,7 +15,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json index b9ccb755ee..6578892574 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json @@ -5,7 +5,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 4585bd9e74..9a3adb72a6 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -14,7 +14,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 901275d263..79217edf29 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index a6b90dc1b0..de8fae38e1 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -22,7 +22,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 5f7fd859e7..8ed318fc45 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -23,7 +23,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index 7bb2c8b933..fe60497b72 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 901275d263..79217edf29 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index 78ed09942e..f2a6c9e53b 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -19,7 +19,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From ef4ba21bbe6bc035ad49beab11869e2f4abc6c45 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 12 Oct 2016 16:09:18 -0700 Subject: [PATCH 024/295] Revert "Updating to netcoreapp1.1" This reverts commit 3c6ad8fc64177f11eaeda2ba65e0c642179ad96f. --- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../ApplicationUsingPrecompiledViewClassLibrary/project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json index 62c7e60d38..7f4b5e15dd 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json @@ -28,7 +28,7 @@ "Microsoft.Extensions.CommandLineUtils": "1.1.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index 4b2d4162f8..333b2f9356 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -35,7 +35,7 @@ } }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.DotNet.InternalAbstractions": "1.0.0", "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json index 6578892574..b9ccb755ee 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json @@ -5,7 +5,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json index a655962ab9..f2c685fab7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json @@ -15,7 +15,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json index 6578892574..b9ccb755ee 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json @@ -5,7 +5,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 9a3adb72a6..4585bd9e74 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -14,7 +14,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 79217edf29..901275d263 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index de8fae38e1..a6b90dc1b0 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -22,7 +22,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 8ed318fc45..5f7fd859e7 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -23,7 +23,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index fe60497b72..7bb2c8b933 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 79217edf29..901275d263 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index f2a6c9e53b..78ed09942e 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -19,7 +19,7 @@ "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" }, "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From 4b9d37e8521252fef8907848ecdb8d682e5e1774 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 17 Oct 2016 09:49:30 -0700 Subject: [PATCH 025/295] Branching for 1.1.0-preview1 --- NuGet.config | 4 ++-- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 0fd623ffdd..ad973186eb 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + - + diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..787f63ac02 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0-preview1.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..355c682856 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0-preview1.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From b2681bb69da8fb93847da8e95dcbdca7b32efc4d Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 17 Oct 2016 09:56:25 -0700 Subject: [PATCH 026/295] Updating to preview4 --- makefile.shade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile.shade b/makefile.shade index 718ef178a3..396bf77f68 100644 --- a/makefile.shade +++ b/makefile.shade @@ -1,6 +1,6 @@ use namespace="System.IO" --BuildQuality = "preview3"; +-BuildQuality = "preview4"; use-standard-lifecycle k-standard-goals From 431548d55a6ee3236b14b92a1a2ac2bbbe0a5d95 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 17 Oct 2016 16:57:27 -0700 Subject: [PATCH 027/295] Downgrading package quality to preview1 --- makefile.shade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile.shade b/makefile.shade index 718ef178a3..fab02d228e 100644 --- a/makefile.shade +++ b/makefile.shade @@ -1,6 +1,6 @@ use namespace="System.IO" --BuildQuality = "preview3"; +-BuildQuality = "preview1"; use-standard-lifecycle k-standard-goals From ccfbec657fdc5eb3fa0bc2aa8b6b2bb2894648dc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 20 Oct 2016 09:12:14 -0700 Subject: [PATCH 028/295] Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools does not need to target desktop Fixes #19 --- .../project.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json index 333b2f9356..214acbf9b5 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json @@ -45,7 +45,6 @@ }, "System.Runtime.Serialization.Primitives": "4.3.0-*" } - }, - "net451": {} + } } } \ No newline at end of file From 3d1caa474ee0cd9f8e2bc72782f3096393b5cd78 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 21 Oct 2016 12:00:57 -0700 Subject: [PATCH 029/295] Adding a functional test for desktop only project --- TestApps.sln | 6 ++ .../SimpleAppDesktopOnly.Home.Index.txt | 59 ++++++++++++++++ .../SimpleAppDesktopOnlyTest.cs | 48 +++++++++++++ .../Controllers/HomeController.cs | 9 +++ testapps/SimpleAppDesktopOnly/Program.cs | 26 +++++++ .../SimpleAppDesktopOnly.xproj | 19 ++++++ testapps/SimpleAppDesktopOnly/Startup.cs | 26 +++++++ .../Views/Home/Index.cshtml | 5 ++ .../Views/Shared/_Layout.cshtml | 68 +++++++++++++++++++ .../Views/_ViewImports.cshtml | 2 + .../Views/_ViewStart.cshtml | 3 + testapps/SimpleAppDesktopOnly/project.json | 33 +++++++++ 12 files changed, 304 insertions(+) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs create mode 100644 testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs create mode 100644 testapps/SimpleAppDesktopOnly/Program.cs create mode 100644 testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj create mode 100644 testapps/SimpleAppDesktopOnly/Startup.cs create mode 100644 testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml create mode 100644 testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml create mode 100644 testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml create mode 100644 testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml create mode 100644 testapps/SimpleAppDesktopOnly/project.json diff --git a/TestApps.sln b/TestApps.sln index 7b40d9f475..718673b08a 100644 --- a/TestApps.sln +++ b/TestApps.sln @@ -23,6 +23,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PublishWIthEmbedViewSources EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StrongNamedApp", "testapps\StrongNamedApp\StrongNamedApp.xproj", "{88903BE5-0676-4667-8160-B24646E0B76E}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleAppDesktopOnly", "testapps\SimpleAppDesktopOnly\SimpleAppDesktopOnly.xproj", "{A0B0A141-A32B-4F33-B85F-5CA8C107105F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,6 +59,10 @@ Global {88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.Build.0 = Debug|Any CPU {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.ActiveCfg = Release|Any CPU {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.Build.0 = Release|Any CPU + {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt new file mode 100644 index 0000000000..e047f6ed3e --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt @@ -0,0 +1,59 @@ + + + + + + Home Page - SimpleApp + + + + + + + + + + +
+ +AspNetCore.Views_Home_Index_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +
+
+

© 2016 - SimpleApp

+
+
+ + + + + + + + + + + + AspNetCore.Views_Shared__Layout_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs new file mode 100644 index 0000000000..e57323bb9a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +{ + public class SimpleAppDesktopOnlyTest : IClassFixture + { + public SimpleAppDesktopOnlyTest(SimpleAppDesktopOnlyTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + [OSSkipConditionAttribute(OperatingSystems.Linux)] + [OSSkipConditionAttribute(OperatingSystems.Windows)] + public async Task Precompilation_WorksForSimpleApps() + { + // Arrange + using (var deployer = Fixture.CreateDeployment(RuntimeFlavor.Clr)) + { + var deploymentResult = deployer.Deploy(); + + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppDesktopOnly.Home.Index.txt", response); + } + } + + public class SimpleAppDesktopOnlyTestFixture : ApplicationTestFixture + { + public SimpleAppDesktopOnlyTestFixture() + : base("SimpleAppDesktopOnly") + { + } + } + } +} diff --git a/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs b/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs new file mode 100644 index 0000000000..0b44851019 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Mvc; + +namespace SimpleApp.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() => View(); + } +} diff --git a/testapps/SimpleAppDesktopOnly/Program.cs b/testapps/SimpleAppDesktopOnly/Program.cs new file mode 100644 index 0000000000..6ed39c5e32 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace SimpleApp +{ + 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() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj new file mode 100644 index 0000000000..c57afbe851 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + a0b0a141-a32b-4f33-b85f-5ca8c107105f + SimpleAppDesktopOnly + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/testapps/SimpleAppDesktopOnly/Startup.cs b/testapps/SimpleAppDesktopOnly/Startup.cs new file mode 100644 index 0000000000..461873a890 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Startup.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace SimpleApp +{ + 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?}"); + }); + } + } +} diff --git a/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml b/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml new file mode 100644 index 0000000000..9c6b7fb5ff --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml @@ -0,0 +1,5 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +@GetType().AssemblyQualifiedName \ No newline at end of file diff --git a/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml b/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..4f65b1d219 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml @@ -0,0 +1,68 @@ + + + + + + @ViewData["Title"] - SimpleApp + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2016 - SimpleApp

+
+
+ + + + + + + + + + + + + @RenderSection("scripts", required: false) + @GetType().AssemblyQualifiedName + + diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..71413f674c --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using SimpleApp +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/testapps/SimpleAppDesktopOnly/project.json b/testapps/SimpleAppDesktopOnly/project.json new file mode 100644 index 0000000000..1dc433a8ff --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/project.json @@ -0,0 +1,33 @@ +{ + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "version": "1.0.0-*", + "target": "package", + "type": "build" + }, + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" + }, + "tools": { + "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + }, + "frameworks": { + "net451": {} + }, + "publishOptions": { + "include": [ + "wwwroot", + "appsettings.json", + "web.config" + ] + }, + "scripts": { + "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" + } +} \ No newline at end of file From 8d45fcd34e5b21cc878c523a623e8aefba8fea30 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 26 Oct 2016 14:32:05 -0700 Subject: [PATCH 030/295] Use ConditionalFact to not run tests on xplat --- .../SimpleAppDesktopOnlyTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs index e57323bb9a..1102fe66ff 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation public ApplicationTestFixture Fixture { get; } - [Fact] + [ConditionalFact] [OSSkipConditionAttribute(OperatingSystems.Linux)] [OSSkipConditionAttribute(OperatingSystems.Windows)] public async Task Precompilation_WorksForSimpleApps() From 3ec608ecb78f30a52fe42ca66654a28808bc524f Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 27 Oct 2016 12:11:31 -0700 Subject: [PATCH 031/295] Skip tests on OSX (not Windows) --- .../SimpleAppDesktopOnlyTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs index 1102fe66ff..49bb77f88d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation [ConditionalFact] [OSSkipConditionAttribute(OperatingSystems.Linux)] - [OSSkipConditionAttribute(OperatingSystems.Windows)] + [OSSkipConditionAttribute(OperatingSystems.MacOSX)] public async Task Precompilation_WorksForSimpleApps() { // Arrange From bfdd939e26db59cc451a099d38514d4a7dd73315 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 4 Nov 2016 14:20:49 -0700 Subject: [PATCH 032/295] Rename project to Razor ViewCompilation * Microsoft.AspNetCore.Razor.Precompilation.* -> Microsoft.AspNetCore.Razor.ViewCompilation.* * Update version number to 1.1.0 --- NuGetPackageVerifier.json | 4 ++-- MvcPrecompilation.sln => RazorViewCompilation.sln | 10 +++++----- .../Internal/CommonOptions.cs | 2 +- .../Internal/DebugHelper.cs | 2 +- .../Internal/MvcServiceProvider.cs | 2 +- .../Internal/PrecompilationApplication.cs | 2 +- .../Internal/PrecompileRunCommand.cs | 2 +- .../Internal/SnkUtils.cs | 2 +- .../Internal/StrongNameOptions.cs | 2 +- .../Internal/ViewCompilationInfo.cs | 2 +- .../Internal/ViewInfoContainerCodeGenerator.cs | 2 +- ....AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj} | 0 .../Program.cs | 4 ++-- .../Properties/AssemblyInfo.cs | 0 .../project.json | 5 +++-- .../Internal/PrecompileDispatchCommand.cs | 4 ++-- ...t.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj} | 0 .../Program.cs | 6 +++--- .../Properties/AssemblyInfo.cs | 0 .../project.json | 7 ++++--- ...etCore.Mvc.Razor.ViewCompilation.Design.Test.xproj} | 0 .../PrecompileRunCommandTest.cs | 4 ++-- .../project.json | 2 +- .../ApplicationConsumingPrecompiledViews.cs | 2 +- .../ApplicationWithConfigureMvcTest.cs | 2 +- .../ApplicationWithTagHelpersTest.cs | 2 +- .../Infrastructure/ApplicationPaths.cs | 4 ++-- .../Infrastructure/ApplicationTestFixture.cs | 2 +- .../Infrastructure/CommandResultExtensions.cs | 2 +- .../Infrastructure/HttpClientExtensions.cs | 2 +- .../Infrastructure/RuntimeFlavors.cs | 2 +- .../Infrastructure/TestEmbeddedResource.cs | 2 +- ...re.Mvc.Razor.ViewCompilation.FunctionalTests.xproj} | 0 .../Properties/AssemblyInfo.cs | 0 .../PublishWithEmbedViewSourcesTest.cs | 2 +- ...tionConsumingPrecompiledViews.Manage.Home.Index.txt | 0 .../ApplicationWithConfigureMvc.Home.Index.txt | 0 ...ationWithConfigureMvc.Home.ViewWithPreprocessor.txt | 0 ...cationWithTagHelpers.Home.ClassLibraryTagHelper.txt | 0 .../ApplicationWithTagHelpers.Home.LocalTagHelper.txt | 0 .../Resources/SimpleAppDesktopOnly.Home.Index.txt | 0 .../Resources/SimpleAppTest.Home.Index.txt | 0 .../Resources/StrongNamedApp.Home.Index.txt | 0 .../SimpleAppDesktopOnlyTest.cs | 2 +- .../SimpleAppTest.cs | 2 +- .../StrongNamedAppTest.cs | 2 +- .../project.json | 0 ...NetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj} | 0 .../PrecompileDispatchCommandTest.cs | 6 +++--- .../project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 6 +++--- testapps/ApplicationWithTagHelpers/project.json | 6 +++--- testapps/ClassLibraryWithPrecompiledViews/project.json | 6 +++--- testapps/PublishWithEmbedViewSources/project.json | 6 +++--- testapps/SimpleApp/project.json | 6 +++--- testapps/SimpleAppDesktopOnly/project.json | 6 +++--- testapps/StrongNamedApp/project.json | 6 +++--- 57 files changed, 72 insertions(+), 70 deletions(-) rename MvcPrecompilation.sln => RazorViewCompilation.sln (76%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/CommonOptions.cs (95%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/DebugHelper.cs (90%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/MvcServiceProvider.cs (98%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/PrecompilationApplication.cs (95%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/PrecompileRunCommand.cs (99%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/SnkUtils.cs (97%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/StrongNameOptions.cs (95%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/ViewCompilationInfo.cs (90%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Internal/ViewInfoContainerCodeGenerator.cs (97%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj} (100%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Program.cs (94%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/Properties/AssemblyInfo.cs (100%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design}/project.json (82%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools}/Internal/PrecompileDispatchCommand.cs (98%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj} (100%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools}/Program.cs (72%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools}/Properties/AssemblyInfo.cs (100%) rename src/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools}/project.json (85%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj} (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test}/PrecompileRunCommandTest.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test}/project.json (81%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/ApplicationConsumingPrecompiledViews.cs (98%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/ApplicationWithConfigureMvcTest.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/ApplicationWithTagHelpersTest.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/ApplicationPaths.cs (91%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/ApplicationTestFixture.cs (98%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/CommandResultExtensions.cs (93%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/HttpClientExtensions.cs (94%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/RuntimeFlavors.cs (94%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Infrastructure/TestEmbeddedResource.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj} (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Properties/AssemblyInfo.cs (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/PublishWithEmbedViewSourcesTest.cs (97%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/ApplicationWithConfigureMvc.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/SimpleAppDesktopOnly.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/SimpleAppTest.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/Resources/StrongNamedApp.Home.Index.txt (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/SimpleAppDesktopOnlyTest.cs (96%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/SimpleAppTest.cs (96%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/StrongNamedAppTest.cs (96%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests}/project.json (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj} (100%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test}/PrecompileDispatchCommandTest.cs (96%) rename test/{Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test}/project.json (81%) diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index 91876a048a..d5665dac0d 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -4,8 +4,8 @@ "AdxVerificationCompositeRule" ], "packages": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { }, - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": { } + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": {}, + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": {} } }, "Default": { // Rules to run for packages not listed in any other set. diff --git a/MvcPrecompilation.sln b/RazorViewCompilation.sln similarity index 76% rename from MvcPrecompilation.sln rename to RazorViewCompilation.sln index d41b701568..5d7269e8ea 100644 --- a/MvcPrecompilation.sln +++ b/RazorViewCompilation.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design", "src\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{01707B64-7DC7-4B5A-B0BB-7CD2773AA297}" ProjectSection(SolutionItems) = preProject @@ -13,15 +13,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFi EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02F7AA35-91AF-491E-9F0E-03CFAF86C720}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools", "src\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj", "{F8BF7D95-0633-407F-BB0B-02563F13C068}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj", "{F8BF7D95-0633-407F-BB0B-02563F13C068}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-505E-4283-89DA-BBD9D28B53DB}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj", "{B58E3380-D451-4E54-B522-CD21404FCD58}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj", "{B58E3380-D451-4E54-B522-CD21404FCD58}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test\Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs similarity index 95% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs index 71d8e7b3f6..6a705c347c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/CommonOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.CommandLineUtils; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class CommonOptions { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs similarity index 90% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs index dde371bb33..fb4f36a0c1 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/DebugHelper.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs @@ -6,7 +6,7 @@ using System; using System.Diagnostics; using System.Linq; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public static class DebugHelper { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs similarity index 98% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs index 7cc105ccc3..a4d33d32dc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/MvcServiceProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs @@ -14,7 +14,7 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class MvcServiceProvider { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs similarity index 95% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs index d4a27d4311..fc62ff1596 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompilationApplication.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs @@ -5,7 +5,7 @@ using System; using System.Reflection; using Microsoft.Extensions.CommandLineUtils; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class PrecompilationApplication : CommandLineApplication { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs similarity index 99% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs index 03922fd1af..9062ca3317 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs @@ -20,7 +20,7 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.FileProviders; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class PrecompileRunCommand { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs similarity index 97% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs index db72ea864c..7f5d052686 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/SnkUtils.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using System.IO; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { // Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs public static class SnkUtils diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs similarity index 95% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs index e079707018..0fac0f178d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/StrongNameOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.CommandLineUtils; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class StrongNameOptions { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs similarity index 90% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs index f2ac3b44e3..56e14123e8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewCompilationInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Razor.CodeGenerators; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class ViewCompilationInfo { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs similarity index 97% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs index 2e1973d7fc..0d7942553b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { public class ViewInfoContainerCodeGenerator { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.xproj rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs similarity index 94% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs index 197fcefc7b..d0d272d07a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Program.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs @@ -4,9 +4,9 @@ using System; using System.Linq; using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design { public class Program { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/Properties/AssemblyInfo.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json similarity index 82% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json index 7f4b5e15dd..07ec32f707 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json @@ -1,6 +1,6 @@ { - "version": "1.0.0-*", - "description": "Razor precompilation", + "version": "1.1.0-*", + "description": "Build-time references required to enable Razor view compilation as part of building the application.", "packOptions": { "repository": { "type": "git", @@ -9,6 +9,7 @@ "tags": [ "cshtml", "razor", + "compilation", "precompilation", "aspnetcore" ] diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs similarity index 98% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs index 4db727a086..2707c2d2aa 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -6,14 +6,14 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; using Microsoft.DotNet.InternalAbstractions; using Microsoft.DotNet.ProjectModel; using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.Internal; using NuGet.Frameworks; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class PrecompileDispatchCommand { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.xproj rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs similarity index 72% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs index 3ca5029d70..5a44ee550d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Program.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs @@ -1,10 +1,10 @@ // 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.Mvc.Razor.Precompilation.Design.Internal; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools { public class Program { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/Properties/AssemblyInfo.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json similarity index 85% rename from src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json index 214acbf9b5..bbd91c9356 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json @@ -1,6 +1,6 @@ { - "version": "1.0.0-*", - "description": "Razor precompilation", + "version": "1.1.0-*", + "description": "Razor view compilation for compiling CSHTML files into DLLs.", "packOptions": { "repository": { "type": "git", @@ -9,6 +9,7 @@ "tags": [ "cshtml", "razor", + "compilation", "precompilation", "aspnetcore" ] @@ -24,7 +25,7 @@ "xmlDoc": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { "target": "project" }, "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test.xproj rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs index 222d4c937a..5a4408e6cd 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/PrecompileRunCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs @@ -5,10 +5,10 @@ using System; using System.IO; using System.Linq; using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools { public class PrecompileRunCommandTest { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json similarity index 81% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json index b9ccb755ee..04baade058 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs similarity index 98% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index db0b63a017..003e171bec 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class ApplicationConsumingPrecompiledViews : IClassFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index 762faba4f1..d4e80d6b8b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class ApplicationWithConfigureMvcTest : IClassFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs index d515c00d45..8b79ace4ed 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class TagHelperTest : IClassFixture { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs similarity index 91% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs index d56cb498cd..2534e3264a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationPaths.cs @@ -5,11 +5,11 @@ using System; using System.IO; using Microsoft.Extensions.PlatformAbstractions; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class ApplicationPaths { - private const string SolutionName = "MvcPrecompilation.sln"; + private const string SolutionName = "RazorViewCompilation.sln"; public static string SolutionDirectory { get; } = GetSolutionDirectory(); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs similarity index 98% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index a688632a81..820ce00a47 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.DotNet.Cli.Utils; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public abstract class ApplicationTestFixture : IDisposable { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs similarity index 93% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs index fae4b2a74b..7ac936f576 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/CommandResultExtensions.cs @@ -5,7 +5,7 @@ using System; using Microsoft.DotNet.Cli.Utils; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class CommandResultExtensions { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs similarity index 94% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs index 553608c120..a110fd3973 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class HttpClientExtensions { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs similarity index 94% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs index f75324015f..baa8087a75 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/RuntimeFlavors.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class RuntimeFlavors { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs index d584528d5f..76062ed913 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/TestEmbeddedResource.cs @@ -5,7 +5,7 @@ using System.IO; using System.Reflection; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class TestEmbeddedResource { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests.xproj rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Properties/AssemblyInfo.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Properties/AssemblyInfo.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Properties/AssemblyInfo.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index b945947a54..de0157ac58 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests { public class PublishWithEmbedViewSourcesTest : IClassFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/StrongNamedApp.Home.Index.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs similarity index 96% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs index 49bb77f88d..191581d4d9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppDesktopOnlyTest.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class SimpleAppDesktopOnlyTest : IClassFixture { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs similarity index 96% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs index b1a7a8120d..3e9e48007d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class SimpleAppTest : IClassFixture { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs similarity index 96% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs index 3c9b5629ae..8b13cf027e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/StrongNamedAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class StrongNamedAppTest : IClassFixture { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.FunctionalTests/project.json rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test.xproj rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs similarity index 96% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs index cdaeca1c0c..3708ba587f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools.Test/PrecompileDispatchCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs @@ -5,11 +5,11 @@ using System; using System.IO; using System.Linq; using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Internal; -using Microsoft.AspNetCore.Mvc.Razor.Precompilation.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; +using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools { public class PrecompileDispatchCommandTest { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json similarity index 81% rename from test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json index b9ccb755ee..04baade058 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 901275d263..0916482943 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -5,8 +5,8 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index a6b90dc1b0..b68a4c9706 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -8,8 +8,8 @@ "target": "project" }, "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -19,7 +19,7 @@ "TagHelperSamples.Bootstrap": "1.1.1" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 5f7fd859e7..3a49d7cf3d 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -13,14 +13,14 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" } }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index 7bb2c8b933..d1b0245b5b 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -5,8 +5,8 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 901275d263..0916482943 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -5,8 +5,8 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/SimpleAppDesktopOnly/project.json b/testapps/SimpleAppDesktopOnly/project.json index 1dc433a8ff..d9055c174b 100644 --- a/testapps/SimpleAppDesktopOnly/project.json +++ b/testapps/SimpleAppDesktopOnly/project.json @@ -5,8 +5,8 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "net451": {} diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index 78ed09942e..d4f61b912e 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -6,8 +6,8 @@ }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Design": { - "version": "1.0.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { + "version": "1.1.0-*", "target": "package", "type": "build" }, @@ -16,7 +16,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.Precompilation.Tools": "1.0.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { "netcoreapp1.0": { From d81cce8a25041fc5e8dde0c6528e1783f5ea1a7e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 4 Nov 2016 14:20:49 -0700 Subject: [PATCH 033/295] Make --framework an optional parameters to the tool Fixes #26 --- .../Internal/PrecompileDispatchCommand.cs | 36 +++++++++++-------- .../PrecompileDispatchCommandTest.cs | 16 --------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs index 2707c2d2aa..59ef9b9e05 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; using Microsoft.DotNet.InternalAbstractions; @@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal dispatchArgs.Add(CommonOptions.EmbedViewSourceTemplate); } - var compilerOptions = runtimeContext.ProjectFile.GetCompilerOptions(TargetFramework, Configuration); + var compilerOptions = runtimeContext.ProjectFile.GetCompilerOptions(runtimeContext.TargetFramework, Configuration); if (!string.IsNullOrEmpty(compilerOptions.KeyFile)) { dispatchArgs.Add(StrongNameOptions.StrongNameKeyPath); @@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal var toolName = typeof(Design.Program).GetTypeInfo().Assembly.GetName().Name; var dispatchCommand = DotnetToolDispatcher.CreateDispatchCommand( dispatchArgs, - TargetFramework, + runtimeContext.TargetFramework, Configuration, outputPath: outputPaths.RuntimeOutputPath, buildBasePath: null, @@ -144,12 +144,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal ProjectPath = GetProjectPath(Options.ProjectArgument.Value); Configuration = ConfigurationOption.Value() ?? DotNet.Cli.Utils.Constants.DefaultConfiguration; - if (!FrameworkOption.HasValue()) + if (FrameworkOption.HasValue()) { - Application.Error.WriteLine($"Option {FrameworkOption.Template} does not have a value."); - return false; + TargetFramework = NuGetFramework.Parse(FrameworkOption.Value()); } - TargetFramework = NuGetFramework.Parse(FrameworkOption.Value()); if (!OutputPathOption.HasValue()) { @@ -188,18 +186,28 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal private ProjectContext GetRuntimeContext() { var workspace = new BuildWorkspace(ProjectReaderSettings.ReadFromEnvironment()); - - var projectContext = workspace.GetProjectContext(ProjectPath, TargetFramework); - if (projectContext == null) + var projectContexts = ProjectContext.CreateContextForEachFramework(ProjectPath).ToArray(); + ProjectContext projectContext; + if (TargetFramework != null) { - Debug.Assert(FrameworkOption.HasValue()); - throw new InvalidOperationException($"Project '{ProjectPath}' does not support framework: {FrameworkOption.Value()}"); + projectContext = projectContexts.FirstOrDefault(context => context.TargetFramework == TargetFramework); + if (projectContext == null) + { + throw new InvalidOperationException($"Project '{ProjectPath}' does not support framework: {FrameworkOption.Value()}"); + } + } + else if (projectContexts.Length == 1) + { + projectContext = projectContexts[0]; + } + else + { + throw new InvalidOperationException($"Project '{ProjectPath}' targets multiple frameworks. Specify one using '{FrameworkOption.Template}."); } - var runtimeContext = workspace.GetRuntimeContext( + return workspace.GetRuntimeContext( projectContext, RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers()); - return runtimeContext; } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs index 3708ba587f..c90c7e17c6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs @@ -69,22 +69,6 @@ Options: result.Error.Split(new[] { Environment.NewLine }, StringSplitOptions.None).First()); } - [Fact] - public void RunPrintsError_IfFrameworkIfNotSpecified() - { - // Arrange - var expected = "Option -f|--framework does not have a value."; - var args = new string[0]; - - // Act - var result = Execute(args); - - // Assert - Assert.Equal(1, result.ExitCode); - Assert.Empty(result.Out); - Assert.Equal(expected, result.Error.Trim()); - } - [Fact] public void RunPrintsError_IfOutputPathIfNotSpecified() { From 8406da8c093bb3a1952e1b26775e6145ac2a1cad Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 9 Nov 2016 11:32:23 -0800 Subject: [PATCH 034/295] Branching for 1.1.0 --- NuGet.config | 4 ++-- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 0fd623ffdd..ad973186eb 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + - + diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..24ca167cf6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..fea9ac64ad 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From e883cb2493fbb2c36a196fefc8372ab67cd7026c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 9 Nov 2016 14:18:51 -0800 Subject: [PATCH 035/295] Updating versions to 1.2.0-* --- .../project.json | 8 ++++---- .../project.json | 6 +++--- .../project.json | 2 +- .../project.json | 6 +++--- .../project.json | 2 +- .../project.json | 8 ++++---- testapps/ApplicationWithConfigureMvc/project.json | 10 +++++----- testapps/ApplicationWithTagHelpers/project.json | 10 +++++----- testapps/ClassLibraryTagHelper/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 4 ++-- testapps/PublishWithEmbedViewSources/project.json | 10 +++++----- testapps/SimpleApp/project.json | 10 +++++----- testapps/SimpleAppDesktopOnly/project.json | 10 +++++----- testapps/StrongNamedApp/project.json | 10 +++++----- 14 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json index 07ec32f707..ffa4e27989 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json @@ -1,5 +1,5 @@ { - "version": "1.1.0-*", + "version": "1.2.0-*", "description": "Build-time references required to enable Razor view compilation as part of building the application.", "packOptions": { "repository": { @@ -24,9 +24,9 @@ "xmlDoc": true }, "dependencies": { - "Microsoft.AspNetCore.Hosting": "1.1.0-*", - "Microsoft.AspNetCore.Mvc.Razor": "1.1.0-*", - "Microsoft.Extensions.CommandLineUtils": "1.1.0-*" + "Microsoft.AspNetCore.Hosting": "1.2.0-*", + "Microsoft.AspNetCore.Mvc.Razor": "1.2.0-*", + "Microsoft.Extensions.CommandLineUtils": "1.2.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json index bbd91c9356..4d33093c28 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json @@ -1,5 +1,5 @@ { - "version": "1.1.0-*", + "version": "1.2.0-*", "description": "Razor view compilation for compiling CSHTML files into DLLs.", "packOptions": { "repository": { @@ -29,10 +29,10 @@ "target": "project" }, "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", - "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", + "Microsoft.Extensions.CommandLineUtils": "1.2.0-*", "Microsoft.Extensions.DotnetToolDispatcher.Sources": { "type": "build", - "version": "1.1.0-*" + "version": "1.2.0-*" } }, "frameworks": { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json index 04baade058..05c8abe762 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index f2c685fab7..fbb1a6a86f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -9,9 +9,9 @@ "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Server.IntegrationTesting": "0.2.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*", - "Microsoft.Extensions.Logging": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*", - "Microsoft.Extensions.PlatformAbstractions": "1.1.0-*", + "Microsoft.Extensions.Logging": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json index 04baade058..05c8abe762 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*", + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 4585bd9e74..1bc87ae81a 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -8,10 +8,10 @@ "target": "package", "version": "1.0.0-*" }, - "Microsoft.AspNetCore.Mvc": "1.1.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Mvc": "1.2.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "frameworks": { "netcoreapp1.0": { diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 0916482943..df30b9b9f6 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -4,15 +4,15 @@ "preserveCompilationContext": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index b68a4c9706..49c02c051f 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -7,15 +7,15 @@ "ClassLibraryTagHelper": { "target": "project" }, - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*", "TagHelperSamples.Bootstrap": "1.1.1" }, "tools": { diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json index 6c2e8ed290..c2217f8c42 100644 --- a/testapps/ClassLibraryTagHelper/project.json +++ b/testapps/ClassLibraryTagHelper/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*", + "Microsoft.AspNetCore.Razor.Runtime": "1.2.0-*", "NETStandard.Library": "1.6.1-*" }, "frameworks": { diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 3a49d7cf3d..7347f7dacc 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -12,9 +12,9 @@ } }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" } diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index d1b0245b5b..321ce578d0 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -4,15 +4,15 @@ "preserveCompilationContext": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 0916482943..df30b9b9f6 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -4,15 +4,15 @@ "preserveCompilationContext": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" diff --git a/testapps/SimpleAppDesktopOnly/project.json b/testapps/SimpleAppDesktopOnly/project.json index d9055c174b..ed110172be 100644 --- a/testapps/SimpleAppDesktopOnly/project.json +++ b/testapps/SimpleAppDesktopOnly/project.json @@ -4,15 +4,15 @@ "preserveCompilationContext": true }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index d4f61b912e..d59af4ef21 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -5,15 +5,15 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0-*", + "Microsoft.AspNetCore.Mvc": "1.2.0-*", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.1.0-*", + "version": "1.2.0-*", "target": "package", "type": "build" }, - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" From a2b29a5ac4fd29c1d18dc1d4a3d53fd60956e7e4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 11 Nov 2016 12:54:24 -0800 Subject: [PATCH 036/295] Bump quality to preview4 --- makefile.shade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile.shade b/makefile.shade index 4905bb11c6..4a6c2f299e 100644 --- a/makefile.shade +++ b/makefile.shade @@ -1,6 +1,6 @@ use namespace="System.IO" --BuildQuality = "preview2"; +-BuildQuality = "preview4"; use-standard-lifecycle k-standard-goals From d9140e97c9dd682e71e4d58affffb509b84ba0ec Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 11 Nov 2016 15:57:58 -0800 Subject: [PATCH 037/295] dotnet-razor-precompile does not work when the application targets netcoreapp1.1 Fixes #30 --- .../Internal/PrecompileDispatchCommand.cs | 2 +- .../project.json | 2 +- .../ApplicationConsumingPrecompiledViews.cs | 2 +- .../Infrastructure/ApplicationTestFixture.cs | 2 +- .../project.json | 2 +- .../ApplicationUsingPrecompiledViewClassLibrary/project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs index 59ef9b9e05..8d73479987 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs @@ -190,7 +190,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal ProjectContext projectContext; if (TargetFramework != null) { - projectContext = projectContexts.FirstOrDefault(context => context.TargetFramework == TargetFramework); + projectContext = projectContexts.FirstOrDefault(context => context.TargetFramework.Equals(TargetFramework)); if (projectContext == null) { throw new InvalidOperationException($"Project '{ProjectPath}' does not support framework: {FrameworkOption.Value()}"); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json index 04baade058..d1209cc40a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json @@ -5,7 +5,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index 003e171bec..05eeb2506b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation ExecuteForClassLibrary(Command.CreateDotNet( "razor-precompile", - GetPrecompileArguments("netcoreapp1.0"))); + GetPrecompileArguments("netcoreapp1.1"))); var timestamp = "z" + DateTime.UtcNow.Ticks.ToString().PadLeft(18, '0'); var packCommand = Command diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 820ce00a47..7bcbb53650 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -68,7 +68,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation RuntimeArchitecture.x64) { PublishApplicationBeforeDeployment = true, - TargetFramework = flavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", + TargetFramework = flavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1", Configuration = "Release", EnvironmentVariables = { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index f2c685fab7..a655962ab9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -15,7 +15,7 @@ "xunit": "2.2.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 4585bd9e74..9a3adb72a6 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -14,7 +14,7 @@ "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 0916482943..2913fe25f7 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index b68a4c9706..776882f261 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -22,7 +22,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 3a49d7cf3d..07bfb771c5 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -23,7 +23,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index d1b0245b5b..79fbf2fba6 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 0916482943..2913fe25f7 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -18,7 +18,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index d4f61b912e..727b9b6716 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -19,7 +19,7 @@ "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" }, "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From 768e5ee4321ef7a69f932bcb301ee462ee17d0fa Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 14 Nov 2016 14:22:43 -0800 Subject: [PATCH 038/295] Fix the version of the tool in testapps --- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/SimpleAppDesktopOnly/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index b0cab26cd6..417b72ff93 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index 0be6b8d214..7ebf0000b2 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -19,7 +19,7 @@ "TagHelperSamples.Bootstrap": "1.1.1" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 5438e93577..de239955d3 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -20,7 +20,7 @@ } }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index 0fd47245d8..685da88d63 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index b0cab26cd6..417b72ff93 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { diff --git a/testapps/SimpleAppDesktopOnly/project.json b/testapps/SimpleAppDesktopOnly/project.json index ed110172be..721d2fdd4a 100644 --- a/testapps/SimpleAppDesktopOnly/project.json +++ b/testapps/SimpleAppDesktopOnly/project.json @@ -15,7 +15,7 @@ "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "net451": {} diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index d44f9b809e..13dbe0afc4 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -16,7 +16,7 @@ "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-*" + "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" }, "frameworks": { "netcoreapp1.1": { From 54234480f5eae29cb5003afb2cf272d24dd127b6 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 18 Nov 2016 10:57:00 -0800 Subject: [PATCH 039/295] Clean tmp folder after unzipping KoreBuild --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f4208100eb..4fd7ede788 100755 --- a/build.sh +++ b/build.sh @@ -38,7 +38,7 @@ if test ! -d $buildFolder; then chmod +x $buildFile # Cleanup - if test ! -d $tempFolder; then + if test -d $tempFolder; then rm -rf $tempFolder fi fi From 172f0579d54e4c2f726643f16a93c65e9c21003a Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 21 Nov 2016 12:33:39 -0800 Subject: [PATCH 040/295] Tool produces a 0-byte binary when compilation fails Fixes #35 --- .../Internal/PrecompileRunCommand.cs | 37 +++++++++++++++---- .../PrecompileRunCommandTest.cs | 26 +++++++++++++ 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs index 9062ca3317..b68ef54157 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Mvc.Razor.Internal; using Microsoft.CodeAnalysis; @@ -104,7 +103,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal var resources = GetResources(results); var assemblyPath = Path.Combine(OutputPathOption.Value(), precompileAssemblyName + ".dll"); - var emitResult = EmitAssembly(compilation, assemblyPath, resources); + var emitResult = EmitAssembly( + compilation, + MvcServiceProvider.Compiler.EmitOptions, + assemblyPath, + resources); if (!emitResult.Success) { @@ -143,23 +146,41 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal return resources; } - private EmitResult EmitAssembly( + public EmitResult EmitAssembly( CSharpCompilation compilation, + EmitOptions emitOptions, string assemblyPath, ResourceDescription[] resources) { - Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath)); - EmitResult emitResult; - using (var assemblyStream = File.OpenWrite(assemblyPath)) + using (var assemblyStream = new MemoryStream()) { - using (var pdbStream = File.OpenWrite(Path.ChangeExtension(assemblyPath, ".pdb"))) + using (var pdbStream = new MemoryStream()) { emitResult = compilation.Emit( assemblyStream, pdbStream, manifestResources: resources, - options: MvcServiceProvider.Compiler.EmitOptions); + 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); + } + } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs index 5a4408e6cd..8493d81934 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs @@ -6,6 +6,9 @@ using System.IO; using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Emit; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools @@ -150,6 +153,29 @@ Options: 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) From 977430668e0d4068dba56c30b89e08e31a5d1516 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 23 Nov 2016 16:01:08 -0800 Subject: [PATCH 041/295] Pin global.json SDK to 1.0.0-preview2-1-003177. --- global.json | 10 ++++++++-- testapps/global.json | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/global.json b/global.json index feb51cb71d..9bf5aae425 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,9 @@ { - "projects": ["src", "samples"] -} + "projects": [ + "src", + "samples" + ], + "sdk": { + "version": "1.0.0-preview2-1-003177" + } +} \ No newline at end of file diff --git a/testapps/global.json b/testapps/global.json index c8de56e20f..dee3f084d4 100644 --- a/testapps/global.json +++ b/testapps/global.json @@ -1,3 +1,6 @@ { - "projects": [] -} + "projects": [], + "sdk": { + "version": "1.0.0-preview2-1-003177" + } +} \ No newline at end of file From 0da2a645095df92b7cc0d89f9061e7f108fa5a8c Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 8 Dec 2016 10:04:49 -0800 Subject: [PATCH 042/295] Update .travis.yml osx image to xcode7.3. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7636fa329..a0be886892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ mono: os: - linux - osx -osx_image: xcode7.1 +osx_image: xcode7.3 branches: only: - master From ec2c38f6c141bec8cb60f75c42a4607ab9f9f226 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 12 Dec 2016 00:40:00 -0800 Subject: [PATCH 043/295] Removed packages list in NuGetPackageVerifier.json --- NuGetPackageVerifier.json | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index d5665dac0d..b153ab1515 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -1,16 +1,7 @@ { - "adx": { // Packages written by the ADX team and that ship on NuGet.org - "rules": [ - "AdxVerificationCompositeRule" - ], - "packages": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": {}, - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": {} + "Default": { + "rules": [ + "DefaultCompositeRule" + ] } - }, - "Default": { // Rules to run for packages not listed in any other set. - "rules": [ - "DefaultCompositeRule" - ] - } -} +} \ No newline at end of file From fe4c23670e400e2bdbcefe2aa8a75a4bf62b8431 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 13 Dec 2016 16:33:08 -0800 Subject: [PATCH 044/295] Fix build: pin dotnet cli utils version need to revert once the package is fixed also updated integration testing package --- .../project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 66da5b248d..4492f0c1fe 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -7,8 +7,8 @@ }, "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Server.IntegrationTesting": "0.2.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-*", + "Microsoft.AspNetCore.Server.IntegrationTesting": "0.3.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-preview3-004056", "Microsoft.Extensions.Logging": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", From e42d58f01f77a5a3a60e22d4f44f038ccca9f59b Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 13 Dec 2016 16:57:59 -0800 Subject: [PATCH 045/295] Revert pinning dotnet cli utils --- .../project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 4492f0c1fe..6d150ac283 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -8,7 +8,7 @@ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Server.IntegrationTesting": "0.3.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-preview3-004056", + "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.Logging": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", From 347c7724902fad7d756c5f71e005b032254ccb78 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 13 Dec 2016 18:56:15 -0800 Subject: [PATCH 046/295] Revert "Revert pinning dotnet cli utils" This reverts commit e42d58f01f77a5a3a60e22d4f44f038ccca9f59b. --- .../project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 6d150ac283..4492f0c1fe 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -8,7 +8,7 @@ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Server.IntegrationTesting": "0.3.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-preview3-004056", "Microsoft.Extensions.Logging": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", From 6cf9e8c2bc4dd2d7f7643c9a76fa22d647016986 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 13 Dec 2016 20:56:50 -0800 Subject: [PATCH 047/295] Revert "Revert "Revert pinning dotnet cli utils"" This reverts commit 347c7724902fad7d756c5f71e005b032254ccb78. --- .../project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 4492f0c1fe..6d150ac283 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -8,7 +8,7 @@ "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Server.IntegrationTesting": "0.3.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-preview3-004056", + "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.Logging": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", From bde6cc40bc6d6096606ff06c76deed0b5f0caa63 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Dec 2016 10:20:40 -0800 Subject: [PATCH 048/295] Fix compile failure --- .../PrecompileRunCommandTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs index 8493d81934..b4da0d6a42 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs @@ -179,7 +179,6 @@ Options: private static string GetToolVersion() { return typeof(Program) - .GetTypeInfo() .Assembly .GetCustomAttribute() .InformationalVersion; From 45dcbac0692c8975b549a9813328f3be739edd22 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Dec 2016 12:48:17 -0800 Subject: [PATCH 049/295] Update to CoreFx 4.4.0-* --- global.json | 2 +- .../project.json | 2 +- .../project.json | 4 ++-- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../ApplicationUsingPrecompiledViewClassLibrary/project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryTagHelper/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/global.json b/global.json index 9bf5aae425..9ecb1c6efa 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "samples" ], "sdk": { - "version": "1.0.0-preview2-1-003177" + "version": "1.0.0-preview2-1-003180" } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json index ffa4e27989..c016a497de 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json @@ -33,7 +33,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.1.0-*" + "version": "1.2.0-*" } } }, diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json index 4d33093c28..fc48d51bde 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json @@ -42,9 +42,9 @@ "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.1.0-*" + "version": "1.2.0-*" }, - "System.Runtime.Serialization.Primitives": "4.3.0-*" + "System.Runtime.Serialization.Primitives": "4.4.0-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json index 56001c8dda..4ca0794fad 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json @@ -9,7 +9,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.1.0-*" + "version": "1.2.0-*" } }, "net451": {} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 6d150ac283..7d61535a10 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -19,7 +19,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.1.0-*" + "version": "1.2.0-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json index 05c8abe762..89b5b4eaaa 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json @@ -9,7 +9,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.1.0-*" + "version": "1.2.0-*" } }, "net451": {} diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 7eaf709b58..8069eb4eb6 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -17,7 +17,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index 417b72ff93..da55bc78e4 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index 7ebf0000b2..8a496dc930 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -25,7 +25,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json index c2217f8c42..cd0d9d76ec 100644 --- a/testapps/ClassLibraryTagHelper/project.json +++ b/testapps/ClassLibraryTagHelper/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.AspNetCore.Razor.Runtime": "1.2.0-*", - "NETStandard.Library": "1.6.1-*" + "NETStandard.Library": "1.6.2-*" }, "frameworks": { "netstandard1.6": {}, diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index de239955d3..868d366c18 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -26,7 +26,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index 685da88d63..6849e2c7d1 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index 417b72ff93..da55bc78e4 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index 13dbe0afc4..85dda5e1ca 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -22,7 +22,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } From 275364463fb5208e63c92e7a8b523a3584babf2e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Dec 2016 13:08:04 -0800 Subject: [PATCH 050/295] Revert "Update to CoreFx 4.4.0-*" This reverts commit 45dcbac0692c8975b549a9813328f3be739edd22. --- global.json | 2 +- .../project.json | 2 +- .../project.json | 4 ++-- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../ApplicationUsingPrecompiledViewClassLibrary/project.json | 2 +- testapps/ApplicationWithConfigureMvc/project.json | 2 +- testapps/ApplicationWithTagHelpers/project.json | 2 +- testapps/ClassLibraryTagHelper/project.json | 2 +- testapps/ClassLibraryWithPrecompiledViews/project.json | 2 +- testapps/PublishWithEmbedViewSources/project.json | 2 +- testapps/SimpleApp/project.json | 2 +- testapps/StrongNamedApp/project.json | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/global.json b/global.json index 9ecb1c6efa..9bf5aae425 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "samples" ], "sdk": { - "version": "1.0.0-preview2-1-003180" + "version": "1.0.0-preview2-1-003177" } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json index c016a497de..ffa4e27989 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json @@ -33,7 +33,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.2.0-*" + "version": "1.1.0-*" } } }, diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json index fc48d51bde..4d33093c28 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json @@ -42,9 +42,9 @@ "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.2.0-*" + "version": "1.1.0-*" }, - "System.Runtime.Serialization.Primitives": "4.4.0-*" + "System.Runtime.Serialization.Primitives": "4.3.0-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json index 4ca0794fad..56001c8dda 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json @@ -9,7 +9,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.2.0-*" + "version": "1.1.0-*" } }, "net451": {} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json index 7d61535a10..6d150ac283 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json @@ -19,7 +19,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.2.0-*" + "version": "1.1.0-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json index 89b5b4eaaa..05c8abe762 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json @@ -9,7 +9,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.2.0-*" + "version": "1.1.0-*" } }, "net451": {} diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json index 8069eb4eb6..7eaf709b58 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json @@ -17,7 +17,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json index da55bc78e4..417b72ff93 100644 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ b/testapps/ApplicationWithConfigureMvc/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json index 8a496dc930..7ebf0000b2 100644 --- a/testapps/ApplicationWithTagHelpers/project.json +++ b/testapps/ApplicationWithTagHelpers/project.json @@ -25,7 +25,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json index cd0d9d76ec..c2217f8c42 100644 --- a/testapps/ClassLibraryTagHelper/project.json +++ b/testapps/ClassLibraryTagHelper/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.AspNetCore.Razor.Runtime": "1.2.0-*", - "NETStandard.Library": "1.6.2-*" + "NETStandard.Library": "1.6.1-*" }, "frameworks": { "netstandard1.6": {}, diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json index 868d366c18..de239955d3 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ b/testapps/ClassLibraryWithPrecompiledViews/project.json @@ -26,7 +26,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json index 6849e2c7d1..685da88d63 100644 --- a/testapps/PublishWithEmbedViewSources/project.json +++ b/testapps/PublishWithEmbedViewSources/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json index da55bc78e4..417b72ff93 100644 --- a/testapps/SimpleApp/project.json +++ b/testapps/SimpleApp/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json index 85dda5e1ca..13dbe0afc4 100644 --- a/testapps/StrongNamedApp/project.json +++ b/testapps/StrongNamedApp/project.json @@ -22,7 +22,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.2.0-*", + "version": "1.1.0-*", "type": "platform" } } From 98109e362d1bd123b4449d598b1045bfaeaba509 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Dec 2016 13:08:58 -0800 Subject: [PATCH 051/295] Revert "Fix compile failure" This reverts commit bde6cc40bc6d6096606ff06c76deed0b5f0caa63. --- global.json | 2 +- .../PrecompileRunCommandTest.cs | 1 + testapps/global.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 9bf5aae425..9ecb1c6efa 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "samples" ], "sdk": { - "version": "1.0.0-preview2-1-003177" + "version": "1.0.0-preview2-1-003180" } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs index b4da0d6a42..8493d81934 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs @@ -179,6 +179,7 @@ Options: private static string GetToolVersion() { return typeof(Program) + .GetTypeInfo() .Assembly .GetCustomAttribute() .InformationalVersion; diff --git a/testapps/global.json b/testapps/global.json index dee3f084d4..77c126f953 100644 --- a/testapps/global.json +++ b/testapps/global.json @@ -1,6 +1,6 @@ { "projects": [], "sdk": { - "version": "1.0.0-preview2-1-003177" + "version": "1.0.0-preview2-1-003180" } } \ No newline at end of file From f9efbf8e78c2e1a37d1de36debcaf9b9ea876aba Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Dec 2016 16:51:56 -0800 Subject: [PATCH 052/295] Temporarily disabling running tests in this repo Workaround for https://github.com/aspnet/MvcPrecompilation/issues/48 --- makefile.shade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefile.shade b/makefile.shade index 4a6c2f299e..84b5ff3c02 100644 --- a/makefile.shade +++ b/makefile.shade @@ -15,3 +15,6 @@ k-standard-goals } dotnet command='restore ${directoriesToRestore} ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' - Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build")); + +#xunit-test + - // Temporarily no-op until we have a resolution for https://github.com/aspnet/MvcPrecompilation/issues/48 \ No newline at end of file From 3f5cce41c1ba11c4e574bd1ccc2464b4285621be Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 28 Dec 2016 17:05:14 -0800 Subject: [PATCH 053/295] Make ViewCompilation a target --- .gitignore | 4 +- RazorViewCompilation.sln | 66 ++++-- build.ps1 | 2 +- build.sh | 2 +- {tools => build}/Key.snk | Bin build/common.props | 21 ++ global.json | 9 - makefile.shade | 20 -- ...ore.Mvc.Razor.ViewCompilation.Design.xproj | 18 -- .../Program.cs | 66 ------ .../Properties/AssemblyInfo.cs | 11 - .../project.json | 42 ---- .../Internal/PrecompileDispatchCommand.cs | 213 ------------------ ...Core.Mvc.Razor.ViewCompilation.Tools.xproj | 18 -- .../Properties/AssemblyInfo.cs | 11 - .../project.json | 51 ----- .../Internal/CommonOptions.cs | 2 +- .../Internal/DebugHelper.cs | 2 +- .../Internal/MvcServiceProvider.cs | 2 +- .../Internal/PrecompilationApplication.cs | 25 +- .../Internal/PrecompileRunCommand.cs | 8 +- .../Internal/SnkUtils.cs | 2 +- .../Internal/StrongNameOptions.cs | 2 +- .../Internal/ViewCompilationInfo.cs | 2 +- .../ViewInfoContainerCodeGenerator.cs | 7 +- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 31 +++ .../Program.cs | 12 +- .../build/common.targets | 57 +++++ ...pNetCore.Mvc.Razor.ViewCompilation.targets | 38 ++++ ...pNetCore.Mvc.Razor.ViewCompilation.targets | 29 +++ ...pNetCore.Mvc.Razor.ViewCompilation.targets | 18 ++ ...vc.Razor.ViewCompilation.Design.Test.xproj | 20 -- .../project.json | 19 -- .../ApplicationConsumingPrecompiledViews.cs | 37 +-- .../Infrastructure/ApplicationTestFixture.cs | 7 +- ...zor.ViewCompilation.FunctionalTests.csproj | 23 ++ ...azor.ViewCompilation.FunctionalTests.xproj | 21 -- .../project.json | 28 --- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 21 ++ .../PrecompileRunCommandTest.cs | 4 +- ...Mvc.Razor.ViewCompilation.Tools.Test.xproj | 20 -- .../PrecompileDispatchCommandTest.cs | 180 --------------- .../project.json | 19 -- ...ionUsingPrecompiledViewClassLibrary.csproj | 22 ++ ...tionUsingPrecompiledViewClassLibrary.xproj | 19 -- .../project.json | 34 --- .../ApplicationWithConfigureMvc.csproj | 25 ++ .../ApplicationWithConfigureMvc.xproj | 19 -- .../ApplicationWithConfigureMvc/project.json | 41 ---- .../ApplicationWithTagHelpers.csproj | 31 +++ .../ApplicationWithTagHelpers.xproj | 19 -- .../Components/CopyrightViewComponent.cs | 22 ++ .../Components/Copyright/Default.cshtml | 2 + .../Views/Shared/_Layout.cshtml | 5 +- .../ApplicationWithTagHelpers/project.json | 45 ---- .../ClassLibraryTagHelper.csproj | 13 ++ .../ClassLibraryTagHelper.xproj | 21 -- testapps/ClassLibraryTagHelper/project.json | 10 - .../ClassLibraryWithPrecompiledViews.csproj | 37 +++ .../ClassLibraryWithPrecompiledViews.xproj | 19 -- .../project.json | 36 --- .../PublishWithEmbedViewSources.csproj | 26 +++ .../PublishWithEmbedViewSources.xproj | 18 -- .../PublishWithEmbedViewSources/project.json | 41 ---- testapps/SimpleApp/SimpleApp.csproj | 22 ++ testapps/SimpleApp/SimpleApp.xproj | 23 -- testapps/SimpleApp/project.json | 41 ---- .../SimpleAppDesktopOnly.csproj | 21 ++ .../SimpleAppDesktopOnly.xproj | 19 -- testapps/SimpleAppDesktopOnly/project.json | 33 --- testapps/StrongNamedApp/StrongNamedApp.csproj | 27 +++ testapps/StrongNamedApp/StrongNamedApp.xproj | 18 -- testapps/StrongNamedApp/project.json | 42 ---- TestApps.sln => testapps/TestApps.sln | 28 +-- testapps/global.json | 6 - version.props | 7 + 76 files changed, 610 insertions(+), 1372 deletions(-) rename {tools => build}/Key.snk (100%) create mode 100644 build/common.props delete mode 100644 global.json delete mode 100644 makefile.shade delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/CommonOptions.cs (95%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/DebugHelper.cs (90%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/MvcServiceProvider.cs (98%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/PrecompilationApplication.cs (65%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/PrecompileRunCommand.cs (96%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/SnkUtils.cs (97%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/StrongNameOptions.cs (95%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/ViewCompilationInfo.cs (90%) rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Internal/ViewInfoContainerCodeGenerator.cs (94%) create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj rename src/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation}/Program.cs (59%) create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj rename test/{Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test => Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test}/PrecompileRunCommandTest.cs (98%) delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json create mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj delete mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj delete mode 100644 testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json create mode 100644 testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj delete mode 100644 testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj delete mode 100644 testapps/ApplicationWithConfigureMvc/project.json create mode 100644 testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj delete mode 100644 testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj create mode 100644 testapps/ApplicationWithTagHelpers/Components/CopyrightViewComponent.cs create mode 100644 testapps/ApplicationWithTagHelpers/Views/Shared/Components/Copyright/Default.cshtml delete mode 100644 testapps/ApplicationWithTagHelpers/project.json create mode 100644 testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj delete mode 100644 testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj delete mode 100644 testapps/ClassLibraryTagHelper/project.json create mode 100644 testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj delete mode 100644 testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj delete mode 100644 testapps/ClassLibraryWithPrecompiledViews/project.json create mode 100644 testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj delete mode 100644 testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj delete mode 100644 testapps/PublishWithEmbedViewSources/project.json create mode 100644 testapps/SimpleApp/SimpleApp.csproj delete mode 100644 testapps/SimpleApp/SimpleApp.xproj delete mode 100644 testapps/SimpleApp/project.json create mode 100644 testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj delete mode 100644 testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj delete mode 100644 testapps/SimpleAppDesktopOnly/project.json create mode 100644 testapps/StrongNamedApp/StrongNamedApp.csproj delete mode 100644 testapps/StrongNamedApp/StrongNamedApp.xproj delete mode 100644 testapps/StrongNamedApp/project.json rename TestApps.sln => testapps/TestApps.sln (60%) delete mode 100644 testapps/global.json create mode 100644 version.props diff --git a/.gitignore b/.gitignore index 1b6e30413e..37e2db660f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ packages/ artifacts/ PublishProfiles/ .vs/ +.vscode/ bower_components/ node_modules/ debugSettings.json @@ -36,4 +37,5 @@ nuget.exe node_modules *launchSettings.json *.orig -BuildInfo.generated.cs \ No newline at end of file +BuildInfo.generated.cs +msbuild.log \ No newline at end of file diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 5d7269e8ea..6b652d4198 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26014.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" +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 @@ -13,51 +13,77 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFi EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02F7AA35-91AF-491E-9F0E-03CFAF86C720}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj", "{F8BF7D95-0633-407F-BB0B-02563F13C068}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-505E-4283-89DA-BBD9D28B53DB}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj", "{B58E3380-D451-4E54-B522-CD21404FCD58}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}" +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 + 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|x64 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x64.Build.0 = Debug|x64 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x86.ActiveCfg = Debug|x86 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Debug|x86.Build.0 = Debug|x86 {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 - {F8BF7D95-0633-407F-BB0B-02563F13C068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8BF7D95-0633-407F-BB0B-02563F13C068}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8BF7D95-0633-407F-BB0B-02563F13C068}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8BF7D95-0633-407F-BB0B-02563F13C068}.Release|Any CPU.Build.0 = Release|Any CPU + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x64.ActiveCfg = Release|x64 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x64.Build.0 = Release|x64 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x86.ActiveCfg = Release|x86 + {4339FC9B-AEC6-442A-B413-A41555ED76C7}.Release|x86.Build.0 = Release|x86 {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|x64 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x64.Build.0 = Debug|x64 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x86.ActiveCfg = Debug|x86 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Debug|x86.Build.0 = Debug|x86 {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 - {B58E3380-D451-4E54-B522-CD21404FCD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B58E3380-D451-4E54-B522-CD21404FCD58}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B58E3380-D451-4E54-B522-CD21404FCD58}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B58E3380-D451-4E54-B522-CD21404FCD58}.Release|Any CPU.Build.0 = Release|Any CPU + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x64.ActiveCfg = Release|x64 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x64.Build.0 = Release|x64 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x86.ActiveCfg = Release|x86 + {46C9A4B2-8B1C-451B-B670-C194901D66AC}.Release|x86.Build.0 = Release|x86 {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|x64 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x64.Build.0 = Debug|x64 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x86.ActiveCfg = Debug|x86 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|x86.Build.0 = Debug|x86 {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|x64 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x64.Build.0 = Release|x64 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.ActiveCfg = Release|x86 + {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.Build.0 = Release|x86 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x64.ActiveCfg = Debug|x64 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x64.Build.0 = Debug|x64 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x86.ActiveCfg = Debug|x86 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x86.Build.0 = Debug|x86 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|Any CPU.Build.0 = Release|Any CPU + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x64.ActiveCfg = Release|x64 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x64.Build.0 = Release|x64 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x86.ActiveCfg = Release|x86 + {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {4339FC9B-AEC6-442A-B413-A41555ED76C7} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} - {F8BF7D95-0633-407F-BB0B-02563F13C068} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} {46C9A4B2-8B1C-451B-B670-C194901D66AC} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} - {B58E3380-D451-4E54-B522-CD21404FCD58} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} EndGlobalSection EndGlobal diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..0605b59c01 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index 4fd7ede788..f986d4f4df 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild/dev.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi diff --git a/tools/Key.snk b/build/Key.snk similarity index 100% rename from tools/Key.snk rename to build/Key.snk diff --git a/build/common.props b/build/common.props new file mode 100644 index 0000000000..95f3fa44d2 --- /dev/null +++ b/build/common.props @@ -0,0 +1,21 @@ + + + + + + Microsoft ASP.NET Core + https://github.com/aspnet/MvcPrecompilation + git + $(MSBuildThisFileDirectory)../build/Key.snk + true + true + + + + + + + \ No newline at end of file diff --git a/global.json b/global.json deleted file mode 100644 index 9ecb1c6efa..0000000000 --- a/global.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "projects": [ - "src", - "samples" - ], - "sdk": { - "version": "1.0.0-preview2-1-003180" - } -} \ No newline at end of file diff --git a/makefile.shade b/makefile.shade deleted file mode 100644 index 84b5ff3c02..0000000000 --- a/makefile.shade +++ /dev/null @@ -1,20 +0,0 @@ -use namespace="System.IO" - --BuildQuality = "preview4"; -use-standard-lifecycle -k-standard-goals - -#repo-initialize target='initialize' - use-volatile-feed - @{ - var directoriesToRestore = "test"; - if (Directory.Exists("src")) - { - directoriesToRestore = "src " + directoriesToRestore; - } - } - dotnet command='restore ${directoriesToRestore} ${E("KOREBUILD_DOTNET_RESTORE_OPTIONS")}' workingDir='${Directory.GetCurrentDirectory()}' if='!NoRestore' - - Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build")); - -#xunit-test - - // Temporarily no-op until we have a resolution for https://github.com/aspnet/MvcPrecompilation/issues/48 \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj deleted file mode 100644 index 253d7491f8..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 4339fc9b-aec6-442a-b413-a41555ed76c7 - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs deleted file mode 100644 index d0d272d07a..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Program.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; - -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design -{ - public class Program - { - private readonly static Type ProgramType = typeof(Program); - - public static int Main(string[] args) - { -#if DEBUG - DebugHelper.HandleDebugSwitch(ref args); -#endif - - EnsureValidDispatchRecipient(ref args); - - var app = new PrecompilationApplication(ProgramType); - new PrecompileRunCommand().Configure(app); - return app.Execute(args); - } - - private static void EnsureValidDispatchRecipient(ref string[] args) - { - const string DispatcherVersionArgumentName = "--dispatcher-version"; - - var dispatcherArgumentIndex = Array.FindIndex( - args, - (value) => string.Equals(value, DispatcherVersionArgumentName, StringComparison.OrdinalIgnoreCase)); - - if (dispatcherArgumentIndex < 0) - { - return; - } - - var dispatcherArgumentValueIndex = dispatcherArgumentIndex + 1; - if (dispatcherArgumentValueIndex < args.Length) - { - var dispatcherVersion = args[dispatcherArgumentValueIndex]; - - var thisAssembly = ProgramType.GetTypeInfo().Assembly; - var version = thisAssembly.GetCustomAttribute() - ?.InformationalVersion - ?? thisAssembly.GetName().Version.ToString(); - - if (string.Equals(dispatcherVersion, version, StringComparison.Ordinal)) - { - // Remove dispatcher arguments from - var preDispatcherArgument = args.Take(dispatcherArgumentIndex); - var postDispatcherArgument = args.Skip(dispatcherArgumentIndex + 2); - var newProgramArguments = preDispatcherArgument.Concat(postDispatcherArgument); - args = newProgramArguments.ToArray(); - return; - } - } - - // Could not validate the dispatcher version. - throw new InvalidOperationException("Could not invoke tool"); - } - } -} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs deleted file mode 100644 index 2dc4003a17..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] -[assembly: AssemblyCompany("Microsoft Corporation.")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json deleted file mode 100644 index ffa4e27989..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "version": "1.2.0-*", - "description": "Build-time references required to enable Razor view compilation as part of building the application.", - "packOptions": { - "repository": { - "type": "git", - "url": "git://github.com/AspNet/Mvc" - }, - "tags": [ - "cshtml", - "razor", - "compilation", - "precompilation", - "aspnetcore" - ] - }, - "buildOptions": { - "keyFile": "../../tools/Key.snk", - "warningsAsErrors": true, - "emitEntryPoint": true, - "nowarn": [ - "CS1591" - ], - "xmlDoc": true - }, - "dependencies": { - "Microsoft.AspNetCore.Hosting": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor": "1.2.0-*", - "Microsoft.Extensions.CommandLineUtils": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.1.0-*" - } - } - }, - "net451": {} - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs deleted file mode 100644 index 8d73479987..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Internal/PrecompileDispatchCommand.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; -using Microsoft.DotNet.InternalAbstractions; -using Microsoft.DotNet.ProjectModel; -using Microsoft.Extensions.CommandLineUtils; -using Microsoft.Extensions.Internal; -using NuGet.Frameworks; - -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal -{ - public class PrecompileDispatchCommand - { - private CommandLineApplication Application { get; set; } - - private CommonOptions Options { get; } = new CommonOptions(); - - private CommandOption FrameworkOption { get; set; } - - private CommandOption ConfigurationOption { get; set; } - - private CommandOption OutputPathOption { get; set; } - - private CommandOption BuildBasePathOption { get; set; } - - private NuGetFramework TargetFramework { get; set; } - - private CommandOption DumpFilesOption { get; set; } - - private string ProjectPath { get; set; } - - private string Configuration { get; set; } - - private string OutputPath { get; set; } - - public void Configure(CommandLineApplication app) - { - Application = app; - Options.Configure(app); - FrameworkOption = app.Option( - "-f|--framework", - "Target Framework", - CommandOptionType.SingleValue); - - ConfigurationOption = app.Option( - "-c|--configuration", - "Configuration", - CommandOptionType.SingleValue); - - OutputPathOption = app.Option( - "-o|--output-path", - "Output path.", - CommandOptionType.SingleValue); - - app.OnExecute(() => Execute()); - } - - private int Execute() - { - if (!ParseArguments()) - { - return 1; - } - - var runtimeContext = GetRuntimeContext(); - - var outputPaths = runtimeContext.GetOutputPaths(Configuration); - var applicationName = Path.GetFileNameWithoutExtension(outputPaths.CompilationFiles.Assembly); - var dispatchArgs = new List - { - ProjectPath, - PrecompileRunCommand.ApplicationNameTemplate, - applicationName, - PrecompileRunCommand.OutputPathTemplate, - OutputPath, - CommonOptions.ContentRootTemplate, - Options.ContentRootOption.Value() ?? Directory.GetCurrentDirectory(), - }; - - if (Options.ConfigureCompilationType.HasValue()) - { - dispatchArgs.Add(CommonOptions.ConfigureCompilationTypeTemplate); - dispatchArgs.Add(Options.ConfigureCompilationType.Value()); - } - - if (Options.EmbedViewSourcesOption.HasValue()) - { - dispatchArgs.Add(CommonOptions.EmbedViewSourceTemplate); - } - - var compilerOptions = runtimeContext.ProjectFile.GetCompilerOptions(runtimeContext.TargetFramework, Configuration); - if (!string.IsNullOrEmpty(compilerOptions.KeyFile)) - { - dispatchArgs.Add(StrongNameOptions.StrongNameKeyPath); - var keyFilePath = Path.GetFullPath(Path.Combine(runtimeContext.ProjectDirectory, compilerOptions.KeyFile)); - dispatchArgs.Add(keyFilePath); - - if (compilerOptions.DelaySign ?? false) - { - dispatchArgs.Add(StrongNameOptions.DelaySignTemplate); - } - - if (compilerOptions.PublicSign ?? false) - { - dispatchArgs.Add(StrongNameOptions.PublicSignTemplate); - } - } - -#if DEBUG - var commandLineArgs = Environment.GetCommandLineArgs(); - if (commandLineArgs.Length > 1 && commandLineArgs[1] == "--debug") - { - dispatchArgs.Insert(0, commandLineArgs[1]); - } -#endif - - var toolName = typeof(Design.Program).GetTypeInfo().Assembly.GetName().Name; - var dispatchCommand = DotnetToolDispatcher.CreateDispatchCommand( - dispatchArgs, - runtimeContext.TargetFramework, - Configuration, - outputPath: outputPaths.RuntimeOutputPath, - buildBasePath: null, - projectDirectory: ProjectPath, - toolName: toolName); - - var commandExitCode = dispatchCommand - .ForwardStdErr(Application.Error) - .ForwardStdOut(Application.Out) - .Execute() - .ExitCode; - - return commandExitCode; - } - - private bool ParseArguments() - { - ProjectPath = GetProjectPath(Options.ProjectArgument.Value); - Configuration = ConfigurationOption.Value() ?? DotNet.Cli.Utils.Constants.DefaultConfiguration; - - if (FrameworkOption.HasValue()) - { - TargetFramework = NuGetFramework.Parse(FrameworkOption.Value()); - } - - if (!OutputPathOption.HasValue()) - { - Application.Error.WriteLine($"Option {OutputPathOption.Template} does not have a value."); - return false; - } - OutputPath = OutputPathOption.Value(); - - return true; - } - - public static string GetProjectPath(string projectArgument) - { - string projectPath; - if (!string.IsNullOrEmpty(projectArgument)) - { - projectPath = Path.GetFullPath(projectArgument); - if (string.Equals(Path.GetFileName(projectPath), "project.json", StringComparison.OrdinalIgnoreCase)) - { - projectPath = Path.GetDirectoryName(projectPath); - } - - if (!Directory.Exists(projectPath)) - { - throw new InvalidOperationException($"Could not find directory {projectPath}."); - } - } - else - { - projectPath = Directory.GetCurrentDirectory(); - } - - return projectPath; - } - - private ProjectContext GetRuntimeContext() - { - var workspace = new BuildWorkspace(ProjectReaderSettings.ReadFromEnvironment()); - var projectContexts = ProjectContext.CreateContextForEachFramework(ProjectPath).ToArray(); - ProjectContext projectContext; - if (TargetFramework != null) - { - projectContext = projectContexts.FirstOrDefault(context => context.TargetFramework.Equals(TargetFramework)); - if (projectContext == null) - { - throw new InvalidOperationException($"Project '{ProjectPath}' does not support framework: {FrameworkOption.Value()}"); - } - } - else if (projectContexts.Length == 1) - { - projectContext = projectContexts[0]; - } - else - { - throw new InvalidOperationException($"Project '{ProjectPath}' targets multiple frameworks. Specify one using '{FrameworkOption.Template}."); - } - - return workspace.GetRuntimeContext( - projectContext, - RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers()); - } - } -} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj deleted file mode 100644 index 6b5961a59f..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - f8bf7d95-0633-407f-bb0b-02563f13c068 - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs deleted file mode 100644 index 2dc4003a17..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] -[assembly: AssemblyCompany("Microsoft Corporation.")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json deleted file mode 100644 index 4d33093c28..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/project.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "version": "1.2.0-*", - "description": "Razor view compilation for compiling CSHTML files into DLLs.", - "packOptions": { - "repository": { - "type": "git", - "url": "git://github.com/AspNet/Mvc" - }, - "tags": [ - "cshtml", - "razor", - "compilation", - "precompilation", - "aspnetcore" - ] - }, - "buildOptions": { - "outputName": "dotnet-razor-precompile", - "keyFile": "../../tools/Key.snk", - "warningsAsErrors": true, - "emitEntryPoint": true, - "nowarn": [ - "CS1591" - ], - "xmlDoc": true - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "target": "project" - }, - "Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121", - "Microsoft.Extensions.CommandLineUtils": "1.2.0-*", - "Microsoft.Extensions.DotnetToolDispatcher.Sources": { - "type": "build", - "version": "1.2.0-*" - } - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Microsoft.DotNet.ProjectModel.Loader": "1.0.0-preview2-003121", - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.1.0-*" - }, - "System.Runtime.Serialization.Primitives": "4.3.0-*" - } - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs similarity index 95% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs index 6a705c347c..5f954cf7b5 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/CommonOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.CommandLineUtils; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class CommonOptions { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/DebugHelper.cs similarity index 90% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/DebugHelper.cs index fb4f36a0c1..1999e85041 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/DebugHelper.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/DebugHelper.cs @@ -6,7 +6,7 @@ using System; using System.Diagnostics; using System.Linq; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public static class DebugHelper { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs similarity index 98% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs index a4d33d32dc..1c9146757b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/MvcServiceProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs @@ -14,7 +14,7 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class MvcServiceProvider { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompilationApplication.cs similarity index 65% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompilationApplication.cs index fc62ff1596..bd1ac8a803 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompilationApplication.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompilationApplication.cs @@ -2,10 +2,12 @@ // 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.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class PrecompilationApplication : CommandLineApplication { @@ -33,7 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal { try { - return base.Execute(args); + return base.Execute(ExpandResponseFiles(args)); } catch (Exception ex) { @@ -49,5 +51,24 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal var attribute = assembly.GetCustomAttribute(); return attribute.InformationalVersion; } + + private static string[] ExpandResponseFiles(string[] args) + { + var expandedArgs = new List(); + 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(); + } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs similarity index 96% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs index b68ef54157..91c6f8ef81 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs @@ -19,7 +19,7 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.FileProviders; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class PrecompileRunCommand { @@ -76,9 +76,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal Options.ContentRootOption.Value(), Options.ConfigureCompilationType.Value()); - Application.Out.WriteLine("Running Razor view precompilation."); - - var stopWatch = Stopwatch.StartNew(); var results = GenerateCode(); var success = true; foreach (var result in results) @@ -119,9 +116,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal return 1; } - stopWatch.Stop(); - Application.Out.WriteLine($"Precompiled views emitted to {assemblyPath}."); - Application.Out.WriteLine($"Successfully compiled {results.Length} Razor views in {stopWatch.ElapsedMilliseconds}ms."); return 0; } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/SnkUtils.cs similarity index 97% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/SnkUtils.cs index 7f5d052686..dfe3edb258 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/SnkUtils.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/SnkUtils.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using System.IO; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { // Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs public static class SnkUtils diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs similarity index 95% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs index 0fac0f178d..d22580bc1e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/StrongNameOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.CommandLineUtils; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class StrongNameOptions { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs similarity index 90% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs index 56e14123e8..8630b3f456 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewCompilationInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Razor.CodeGenerators; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class ViewCompilationInfo { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs similarity index 94% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs index 0d7942553b..4c02f27d0a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design/Internal/ViewInfoContainerCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class ViewInfoContainerCodeGenerator { @@ -63,15 +63,16 @@ namespace {ViewsFeatureProvider.ViewInfoContainerNamespace} if (!string.IsNullOrEmpty(strongNameOptions.KeyFile)) { var updatedOptions = Compilation.Options.WithStrongNameProvider(new DesktopStrongNameProvider()); + var keyFilePath = Path.GetFullPath(strongNameOptions.KeyFile); if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || strongNameOptions.PublicSign) { updatedOptions = updatedOptions.WithCryptoPublicKey( - SnkUtils.ExtractPublicKey(File.ReadAllBytes(strongNameOptions.KeyFile))); + SnkUtils.ExtractPublicKey(File.ReadAllBytes(keyFilePath))); } else { - updatedOptions = updatedOptions.WithCryptoKeyFile(strongNameOptions.KeyFile) + updatedOptions = updatedOptions.WithCryptoKeyFile(keyFilePath) .WithDelaySign(strongNameOptions.DelaySign); } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj new file mode 100644 index 0000000000..ee6ef8451b --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -0,0 +1,31 @@ + + + + Build-time references required to enable Razor view compilation as part of building the application. + netcoreapp1.1;net451 + win7-x64 + cshtml;razor;compilation;precompilation;aspnetcore + true + exe + + + build + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Program.cs similarity index 59% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Program.cs index 5a44ee550d..5a2232444b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools/Program.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Program.cs @@ -1,21 +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. -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; +using System; +using System.Linq; +using System.Reflection; using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal; -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public 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(typeof(Program)); - new PrecompileDispatchCommand().Configure(app); + var app = new PrecompilationApplication(ProgramType); + new PrecompileRunCommand().Configure(app); return app.Execute(args); } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets new file mode 100644 index 0000000000..9eb5b3f030 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -0,0 +1,57 @@ + + + <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) + <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) + <_MvcRazorOutputFullPath>$([System.IO.Path]::Combine($([System.IO.Path]::GetFullPath('$(_MvcRazorOutputPath)')), '$(MSBuildProjectName).PrecompiledViews.dll')) + <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp + + $(MSBuildProjectDirectory) + + + + <_MvcRazorContentFiles Include="$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))**\*.cshtml" /> + + + + + + + + + + + + + + + + + + + + + + + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)')) + + + + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets new file mode 100644 index 0000000000..84f8b9c78b --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -0,0 +1,38 @@ + + + + + + + + + $(OutputPath)$(MSBuildThisFileName).exe.config + + + $(OutputPath)$(MSBuildThisFileName).exe + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets new file mode 100644 index 0000000000..ef0b15f8d0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -0,0 +1,29 @@ + + + + + + + + --runtimeconfig "$(ProjectRuntimeConfigFilePath)" + $(ExecArgs) --depsfile "$(ProjectDepsFilePath)" + $(ExecArgs) "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll" + $(ExecArgs) @"$(_MvcRazorResponseFilePath)" + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets new file mode 100644 index 0000000000..0521e16543 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj deleted file mode 100644 index 8edf50470d..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - e0d75b4e-839f-4f80-9b1f-b33f616bcc5f - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json deleted file mode 100644 index 56001c8dda..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*", - "xunit": "2.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.1.0-*" - } - }, - "net451": {} - } - }, - "testRunner": "xunit" -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index 05eeb2506b..ea26c9ae34 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -59,37 +59,24 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation protected override void Restore() { CreateClassLibraryPackage(); - RestoreProject(ApplicationPath, new[] { _packOutputDirectory }); + RestoreProject(ApplicationPath, new[] { _packOutputDirectory, "https://api.nuget.org/v3/index.json" }); } private void CreateClassLibraryPackage() { RestoreProject(ClassLibraryPath); - ExecuteForClassLibrary(Command.CreateDotNet("build", new[] { ClassLibraryPath, "-c", "Release" })); - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - // Don't run precompile tool for net451 on xplat. - ExecuteForClassLibrary(Command.CreateDotNet( - "razor-precompile", - GetPrecompileArguments("net451"))); - } - ExecuteForClassLibrary(Command.CreateDotNet( - "razor-precompile", - GetPrecompileArguments("netcoreapp1.1"))); - - var timestamp = "z" + DateTime.UtcNow.Ticks.ToString().PadLeft(18, '0'); + "build", + new[] { "-c", "Release" })); var packCommand = Command - .CreateDotNet("pack", new[] { "--no-build", "-c", "Release", "-o", _packOutputDirectory }) - .EnvironmentVariable("DOTNET_BUILD_VERSION", timestamp); + .CreateDotNet("pack", new[] { "-c", "Release", "-o", _packOutputDirectory }); ExecuteForClassLibrary(packCommand); } private void ExecuteForClassLibrary(ICommand command) { - Console.WriteLine($"Running {command.CommandName} {command.CommandArgs}"); + Console.WriteLine($"Running {command.CommandName} {command.CommandArgs} in {ClassLibraryPath}"); command .WorkingDirectory(ClassLibraryPath) .EnvironmentVariable(NuGetPackagesEnvironmentKey, TempRestoreDirectory) @@ -100,20 +87,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation .EnsureSuccessful(); } - private string[] GetPrecompileArguments(string targetFramework) - { - return new[] - { - ClassLibraryPath, - "-c", - "Release", - "-f", - $"{targetFramework}", - "-o", - $"obj/precompiled/{targetFramework}", - }; - } - public override void Dispose() { TryDeleteDirectory(_packOutputDirectory); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 7bcbb53650..c1d27d43e5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -111,11 +111,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation } protected void RestoreProject(string applicationDirectory, string[] additionalFeeds = null) - { - var packagesDirectory = GetNuGetPackagesDirectory(); + { var args = new List { - Path.Combine(applicationDirectory, "project.json"), "--packages", TempRestoreDirectory, }; @@ -124,7 +122,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { foreach (var feed in additionalFeeds) { - args.Add("-f"); + args.Add("-s"); args.Add(feed); } } @@ -134,6 +132,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation .EnvironmentVariable(DotnetSkipFirstTimeExperience, "true") .ForwardStdErr(Console.Error) .ForwardStdOut(Console.Out) + .WorkingDirectory(applicationDirectory) .Execute() .EnsureSuccessful(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj new file mode 100644 index 0000000000..91d58054b2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp1.1 + $(DefineConstants);__remove_this_to__GENERATE_BASELINES + + + + + + + + + + + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj deleted file mode 100644 index 9299b84636..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 46c9a4b2-8b1c-451b-b670-c194901d66ac - .\obj - .\bin\ - v4.6.1 - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json deleted file mode 100644 index 6d150ac283..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/project.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "buildOptions": { - "define": [ - "__remove_this_to__GENERATE_BASELINES" - ], - "embed": "Resources/*" - }, - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Server.IntegrationTesting": "0.3.0-*", - "Microsoft.DotNet.Cli.Utils": "1.0.0-*", - "Microsoft.Extensions.Logging": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*", - "Microsoft.Extensions.PlatformAbstractions": "1.2.0-*", - "xunit": "2.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.1.0-*" - } - } - } - }, - "testRunner": "xunit" -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj new file mode 100644 index 0000000000..d03a5493e9 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp1.1 + + + + + + + + + + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/PrecompileRunCommandTest.cs similarity index 98% rename from test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/PrecompileRunCommandTest.cs index 8493d81934..feae75e96d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test/PrecompileRunCommandTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/PrecompileRunCommandTest.cs @@ -5,13 +5,13 @@ using System; using System.IO; using System.Linq; using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; +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.Tools +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public class PrecompileRunCommandTest { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj deleted file mode 100644 index c5140ed5fd..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - b58e3380-d451-4e54-b522-cd21404fcd58 - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs deleted file mode 100644 index c90c7e17c6..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/PrecompileDispatchCommandTest.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal; -using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal; -using Xunit; - -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools -{ - public class PrecompileDispatchCommandTest - { - [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 (project folder or project.json) with precompilation. - -Options: - -?|-h|--help Show help information - --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. - -f|--framework Target Framework - -c|--configuration Configuration - -o|--output-path Output path."; - 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 RunPrintsHelp_WhenInvalidOptionsAreSpecified() - { - // 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 RunPrintsError_IfOutputPathIfNotSpecified() - { - // Arrange - var expected = "Option -o|--output-path does not have a value."; - var args = new[] - { - "-f", - "framework" - }; - - // Act - var result = Execute(args); - - // Assert - Assert.Equal(1, result.ExitCode); - Assert.Empty(result.Out); - Assert.Equal(expected, result.Error.Trim()); - } - - [Theory] - [InlineData(null)] - [InlineData("")] - public void GetProjectPath_ReturnsCurrentDirectoryIfArgumentIsNullOrEmpty(string projectPath) - { - // Act - var actual = PrecompileDispatchCommand.GetProjectPath(projectPath); - - // Assert - Assert.Equal(Directory.GetCurrentDirectory(), actual); - } - - public static TheoryData GetProjectPath_ReturnsArgumentIfNotNullOrEmptyData - { - get - { - return new TheoryData - { - { "", Directory.GetCurrentDirectory() }, - { "project.json", Directory.GetCurrentDirectory() }, - { Path.GetTempPath(), Path.GetTempPath() }, - }; - } - } - - [Theory] - [MemberData(nameof(GetProjectPath_ReturnsArgumentIfNotNullOrEmptyData))] - public void GetProjectPath_ReturnsArgumentIfNotNullOrEmpty(string projectPath, string expected) - { - // Act - var actual = PrecompileDispatchCommand.GetProjectPath(projectPath); - - // Assert - Assert.Equal(expected, actual); - } - - [Fact] - public void GetProjectPath_ThrowsIfDirectoryDoesNotExist() - { - // Arrange - var nonExistent = Path.GetRandomFileName(); - - // Act & Assert - var ex = Assert.Throws( - () => PrecompileDispatchCommand.GetProjectPath(nonExistent)); - Assert.Equal($"Could not find directory {Path.GetFullPath(nonExistent)}.", ex.Message); - } - - private static string GetToolVersion() - { - return typeof(Program) - .GetTypeInfo() - .Assembly - .GetCustomAttribute() - .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 PrecompileDispatchCommand().Configure(app); - var exitCode = app.Execute(args); - - return new ExecuteResult - { - ExitCode = exitCode, - Out = outputWriter.ToString(), - Error = errorWriter.ToString(), - }; - } - } - } -} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json deleted file mode 100644 index 05c8abe762..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools.Test/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*", - "xunit": "2.2.0-*" - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.1.0-*" - } - }, - "net451": {} - } - }, - "testRunner": "xunit" -} \ No newline at end of file diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj new file mode 100644 index 0000000000..76b9bb0338 --- /dev/null +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -0,0 +1,22 @@ + + + + netcoreapp1.1;net451 + true + Exe + win7-x64 + true + + + + + + + + + + + + + + diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj deleted file mode 100644 index 0559856e9a..0000000000 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - cef718e4-4556-422f-b64f-9d9671218e67 - ApplicationUsingPrecompiledViewClassLibrary - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json b/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json deleted file mode 100644 index 7eaf709b58..0000000000 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/project.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "ClassLibraryWithPrecompiledViews": { - "target": "package", - "version": "1.0.0-*" - }, - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - } -} \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj new file mode 100644 index 0000000000..cf50cd50e2 --- /dev/null +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp1.1;net451 + true + Exe + win7-x64 + true + + + + + 1.1.0-* + All + + + + + + + + + + + diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj deleted file mode 100644 index 9cb473104c..0000000000 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - e2eaeb85-91d5-478e-9ce2-964f68de20d0 - ApplicationWithConfigureMvc - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/ApplicationWithConfigureMvc/project.json b/testapps/ApplicationWithConfigureMvc/project.json deleted file mode 100644 index 417b72ff93..0000000000 --- a/testapps/ApplicationWithConfigureMvc/project.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj new file mode 100644 index 0000000000..831009ac40 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -0,0 +1,31 @@ + + + + netcoreapp1.1;net451 + win7-x64 + true + Exe + win7-x64 + true + + + + + + + + + + 1.1.0-* + All + + + + + + + + + + + diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj deleted file mode 100644 index 5c14063cb2..0000000000 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 2079872f-e8f9-4db1-a340-c0d897807b86 - ApplicationWithTagHelpers - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/ApplicationWithTagHelpers/Components/CopyrightViewComponent.cs b/testapps/ApplicationWithTagHelpers/Components/CopyrightViewComponent.cs new file mode 100644 index 0000000000..a52e8e7436 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Components/CopyrightViewComponent.cs @@ -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 System.Collections.Generic; +using Microsoft.AspNetCore.Mvc; + +namespace ApplicationWithTagHelpers +{ + public class CopyrightViewComponent : ViewComponent + { + public IViewComponentResult Invoke(string website, int year) + { + var dict = new Dictionary + { + ["website"] = website, + ["year"] = year + }; + + return View(dict); + } + } +} diff --git a/testapps/ApplicationWithTagHelpers/Views/Shared/Components/Copyright/Default.cshtml b/testapps/ApplicationWithTagHelpers/Views/Shared/Components/Copyright/Default.cshtml new file mode 100644 index 0000000000..25ef152a39 --- /dev/null +++ b/testapps/ApplicationWithTagHelpers/Views/Shared/Components/Copyright/Default.cshtml @@ -0,0 +1,2 @@ +@model Dictionary +© @Model["year"] - @Model["website"] \ No newline at end of file diff --git a/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml b/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml index d62ae2daab..29b1f0740e 100644 --- a/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml +++ b/testapps/ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml @@ -1,4 +1,5 @@ - +@addTagHelper *, ApplicationWithTagHelpers + @ViewData["Title"] - ApplicationWithTagHelpers @@ -11,7 +12,7 @@ @RenderBody()
-

© 2016 - ApplicationWithTagHelpers

+

@RenderSection("scripts", required: false) diff --git a/testapps/ApplicationWithTagHelpers/project.json b/testapps/ApplicationWithTagHelpers/project.json deleted file mode 100644 index 7ebf0000b2..0000000000 --- a/testapps/ApplicationWithTagHelpers/project.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "ClassLibraryTagHelper": { - "target": "project" - }, - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*", - "TagHelperSamples.Bootstrap": "1.1.1" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj new file mode 100644 index 0000000000..c49d7ee9e6 --- /dev/null +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -0,0 +1,13 @@ + + + + netstandard1.6;net451 + + + + + + + + + \ No newline at end of file diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj deleted file mode 100644 index 80d42837fa..0000000000 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 39efa075-3673-49ab-95f3-aa5e88df6c30 - ClassLibraryTagHelpers - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/testapps/ClassLibraryTagHelper/project.json b/testapps/ClassLibraryTagHelper/project.json deleted file mode 100644 index c2217f8c42..0000000000 --- a/testapps/ClassLibraryTagHelper/project.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dependencies": { - "Microsoft.AspNetCore.Razor.Runtime": "1.2.0-*", - "NETStandard.Library": "1.6.1-*" - }, - "frameworks": { - "netstandard1.6": {}, - "net451": {} - } -} \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj new file mode 100644 index 0000000000..4ee98030b9 --- /dev/null +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -0,0 +1,37 @@ + + + + 1.0.0-z$([System.DateTime]::UtcNow.Ticks) + netcoreapp1.1;net451 + true + Exe + win7-x64 + obj\precompiled\$(TargetFramework) + + + + + + + + + + 1.1.0-* + All + + + + + + + + + + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj deleted file mode 100644 index 217dde2a8b..0000000000 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 4684de8b-3fbe-421b-8798-56c3d6698b76 - ClassLibraryWithPrecompiledViews - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/ClassLibraryWithPrecompiledViews/project.json b/testapps/ClassLibraryWithPrecompiledViews/project.json deleted file mode 100644 index de239955d3..0000000000 --- a/testapps/ClassLibraryWithPrecompiledViews/project.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "preserveCompilationContext": true, - "emitEntryPoint": true - }, - "packOptions": { - "files": { - "mappings": { - "lib/": "obj/precompiled/" - } - } - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - } - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - } -} \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj new file mode 100644 index 0000000000..d1b8e2c03a --- /dev/null +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -0,0 +1,26 @@ + + + + netcoreapp1.1;net451 + true + Exe + win7-x64 + true + true + + + + + + 1.1.0-* + All + + + + + + + + + + diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj deleted file mode 100644 index 25dace6505..0000000000 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - e3462190-3068-40f0-9aa5-34779fe252ac - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/PublishWithEmbedViewSources/project.json b/testapps/PublishWithEmbedViewSources/project.json deleted file mode 100644 index 685da88d63..0000000000 --- a/testapps/PublishWithEmbedViewSources/project.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --embed-view-sources --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj new file mode 100644 index 0000000000..365349be1a --- /dev/null +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -0,0 +1,22 @@ + + + netcoreapp1.1;net451 + true + Exe + win7-x64 + true + + + + 1.1.0-* + All + + + + + + + + + + diff --git a/testapps/SimpleApp/SimpleApp.xproj b/testapps/SimpleApp/SimpleApp.xproj deleted file mode 100644 index 0ab0e1618e..0000000000 --- a/testapps/SimpleApp/SimpleApp.xproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 8fa176ed-c29e-48d6-bc7a-1c3a862cb15f - SimpleApp - .\obj - .\bin\ - v4.6.1 - - - 2.0 - - - - - - - diff --git a/testapps/SimpleApp/project.json b/testapps/SimpleApp/project.json deleted file mode 100644 index 417b72ff93..0000000000 --- a/testapps/SimpleApp/project.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj new file mode 100644 index 0000000000..ff561a4be7 --- /dev/null +++ b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj @@ -0,0 +1,21 @@ + + + + net451 + win7-x64 + true + Exe + true + + + + + + 1.1.0-* + All + + + + + + diff --git a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj deleted file mode 100644 index c57afbe851..0000000000 --- a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a0b0a141-a32b-4f33-b85f-5ca8c107105f - SimpleAppDesktopOnly - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/SimpleAppDesktopOnly/project.json b/testapps/SimpleAppDesktopOnly/project.json deleted file mode 100644 index 721d2fdd4a..0000000000 --- a/testapps/SimpleAppDesktopOnly/project.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj new file mode 100644 index 0000000000..0f10baa02e --- /dev/null +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -0,0 +1,27 @@ + + + + netcoreapp1.1;net451 + true + Exe + ../../build/Key.snk + true + true + win7-x64 + true + + + + + + 1.1.0-* + + + + + + + + + + diff --git a/testapps/StrongNamedApp/StrongNamedApp.xproj b/testapps/StrongNamedApp/StrongNamedApp.xproj deleted file mode 100644 index 3cc9e35815..0000000000 --- a/testapps/StrongNamedApp/StrongNamedApp.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 88903be5-0676-4667-8160-b24646e0b76e - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/testapps/StrongNamedApp/project.json b/testapps/StrongNamedApp/project.json deleted file mode 100644 index 13dbe0afc4..0000000000 --- a/testapps/StrongNamedApp/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true, - "keyFile": "../../tools/Key.snk" - }, - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.2.0-*", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { - "version": "1.2.0-*", - "target": "package", - "type": "build" - }, - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.Extensions.Configuration.CommandLine": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "tools": { - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.1.0-*", - "type": "platform" - } - } - }, - "net451": {} - }, - "publishOptions": { - "include": [ - "wwwroot", - "appsettings.json", - "web.config" - ] - }, - "scripts": { - "postpublish": "dotnet razor-precompile --configuration %publish:Configuration% --framework %publish:TargetFramework% --output-path %publish:OutputPath% %publish:ProjectPath%" - } -} \ No newline at end of file diff --git a/TestApps.sln b/testapps/TestApps.sln similarity index 60% rename from TestApps.sln rename to testapps/TestApps.sln index 718673b08a..c5bd8609a1 100644 --- a/TestApps.sln +++ b/testapps/TestApps.sln @@ -1,29 +1,27 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26014.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleApp", "testapps\SimpleApp\SimpleApp.xproj", "{8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{43488AEE-CCF2-4A90-B890-05320282BE29}" ProjectSection(SolutionItems) = preProject - testapps\global.json = testapps\global.json - testapps\NuGet.config = testapps\NuGet.config + global.json = global.json + NuGet.config = NuGet.config EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithTagHelpers", "testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.xproj", "{2079872F-E8F9-4DB1-A340-C0D897807B86}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", "ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{2079872F-E8F9-4DB1-A340-C0D897807B86}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryTagHelper", "testapps\ClassLibraryTagHelper\ClassLibraryTagHelper.xproj", "{39EFA075-3673-49AB-95F3-AA5E88DF6C30}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{39EFA075-3673-49AB-95F3-AA5E88DF6C30}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.xproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryWithPrecompiledViews", "testapps\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.xproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryWithPrecompiledViews", "ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PublishWIthEmbedViewSources", "testapps\PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.xproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublishWIthEmbedViewSources", "PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.csproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StrongNamedApp", "testapps\StrongNamedApp\StrongNamedApp.xproj", "{88903BE5-0676-4667-8160-B24646E0B76E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "StrongNamedApp\StrongNamedApp.csproj", "{88903BE5-0676-4667-8160-B24646E0B76E}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleAppDesktopOnly", "testapps\SimpleAppDesktopOnly\SimpleAppDesktopOnly.xproj", "{A0B0A141-A32B-4F33-B85F-5CA8C107105F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppDesktopOnly", "SimpleAppDesktopOnly\SimpleAppDesktopOnly.csproj", "{A0B0A141-A32B-4F33-B85F-5CA8C107105F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -31,10 +29,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FA176ED-C29E-48D6-BC7A-1C3A862CB15F}.Release|Any CPU.Build.0 = Release|Any CPU {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.Build.0 = Debug|Any CPU {2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/testapps/global.json b/testapps/global.json deleted file mode 100644 index 77c126f953..0000000000 --- a/testapps/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [], - "sdk": { - "version": "1.0.0-preview2-1-003180" - } -} \ No newline at end of file diff --git a/version.props b/version.props new file mode 100644 index 0000000000..f2d5fa5b07 --- /dev/null +++ b/version.props @@ -0,0 +1,7 @@ + + + + 1.1.0 + msbuild3 + + \ No newline at end of file From 5bf4ec41106160c52a9c01204cb0940af9384836 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 9 Jan 2017 13:02:51 -0800 Subject: [PATCH 054/295] Skipping class library tests on xplat --- .../ApplicationConsumingPrecompiledViews.cs | 9 +++++++-- ...Core.Mvc.Razor.ViewCompilation.FunctionalTests.csproj | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index ea26c9ae34..2c022c5a6d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.DotNet.Cli.Utils; using Xunit; @@ -25,7 +26,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - [Theory] + [ConditionalTheory] + [OSSkipCondition(OperatingSystems.Linux, + SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")] + [OSSkipCondition(OperatingSystems.MacOSX, + SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")] [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor) { @@ -66,7 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { RestoreProject(ClassLibraryPath); ExecuteForClassLibrary(Command.CreateDotNet( - "build", + "build", new[] { "-c", "Release" })); var packCommand = Command .CreateDotNet("pack", new[] { "-c", "Release", "-o", _packOutputDirectory }); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj index 91d58054b2..e473a86882 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj @@ -14,6 +14,7 @@ + From 1ed838fec91f8e3690569f024397c45005f9a3c3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 10 Jan 2017 10:33:44 -0800 Subject: [PATCH 055/295] Don't invoke Path.GetFullPath when calculating MvcRazorOutputPath Add an option that allows specifying the command to invoke --- .../build/common.targets | 2 +- ...Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets | 8 ++++++-- ...Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index 9eb5b3f030..c303e709f5 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -2,7 +2,7 @@ <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) - <_MvcRazorOutputFullPath>$([System.IO.Path]::Combine($([System.IO.Path]::GetFullPath('$(_MvcRazorOutputPath)')), '$(MSBuildProjectName).PrecompiledViews.dll')) + <_MvcRazorOutputFullPath>$([System.IO.Path]::Combine($(_MvcRazorOutputPath), '$(MSBuildProjectName).PrecompiledViews.dll')) <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp $(MSBuildProjectDirectory) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index 84f8b9c78b..131edb069b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -1,5 +1,9 @@ + + $(OutputPath)$(MSBuildThisFileName).exe + + $(OutputPath)$(MSBuildThisFileName).exe.config - $(OutputPath)$(MSBuildThisFileName).exe + $(MvcRazorRunCommand) @@ -25,7 +29,7 @@ Importance="Low" /> + + dotnet + Date: Tue, 10 Jan 2017 11:46:03 -0800 Subject: [PATCH 056/295] Rename buildCrossTargeting/ folder to buildMultiTargeting/ --- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj | 2 +- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/{buildCrossTargeting => buildMultiTargeting}/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets (100%) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index ee6ef8451b..74d0bf101d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildMultiTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets similarity index 100% rename from src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildCrossTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets rename to src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/buildMultiTargeting/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets From ac4a0560a38b2006666681b2fb98a12d4e77d0d8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 10 Jan 2017 17:17:09 -0800 Subject: [PATCH 057/295] Don't publish cshtml files as part of publish --- .../build/common.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index c303e709f5..68c8820beb 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -6,10 +6,12 @@ <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp $(MSBuildProjectDirectory) + true <_MvcRazorContentFiles Include="$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))**\*.cshtml" /> + From 8e4646f25e6c1616d2b8762dea7fdbd38239691e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 12 Jan 2017 17:24:48 -0800 Subject: [PATCH 058/295] React to aspnet/KoreBuild#155 --- NuGet.config | 1 + build/common.props | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NuGet.config b/NuGet.config index 0fd623ffdd..93f1ac47df 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/build/common.props b/build/common.props index 95f3fa44d2..7f26fb6ee4 100644 --- a/build/common.props +++ b/build/common.props @@ -11,11 +11,8 @@ true
- - - + + + \ No newline at end of file From e2117dd6b46b354b40de194d2265adde603c152c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Sat, 14 Jan 2017 17:02:14 -0800 Subject: [PATCH 059/295] Do not disable publishing views if MvcRazorCompileOnPublish is not set. --- .../build/common.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index 68c8820beb..bcd636d882 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -11,7 +11,10 @@ <_MvcRazorContentFiles Include="$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))**\*.cshtml" /> - + From bcd210819a5115a6412ceac467f0e298b0494856 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 18 Jan 2017 14:57:41 -0800 Subject: [PATCH 060/295] Prepare 1.1.0 release and pin floating versions --- build.ps1 | 2 +- build.sh | 2 +- build/common.props | 4 ++-- ...icrosoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj | 2 +- version.props | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build.ps1 b/build.ps1 index 0605b59c01..8bd00b5dd6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.0.0-msbuild-rtm.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f986d4f4df..98568e62af 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.0.0-msbuild-rtm.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi diff --git a/build/common.props b/build/common.props index 7f26fb6ee4..1b111f3342 100644 --- a/build/common.props +++ b/build/common.props @@ -12,7 +12,7 @@ - + - + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index d03a5493e9..1d100cdec0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -14,7 +14,7 @@ - + diff --git a/version.props b/version.props index f2d5fa5b07..a1285c53c6 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,8 @@ - 1.1.0 - msbuild3 + 1.1.0-rtm + $(Version)-$(BuildNumber) + 1.1.0 \ No newline at end of file From c1ef1e533fefa548ad7233d38277dfdefb9cd0ce Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 17 Jan 2017 11:52:49 -0800 Subject: [PATCH 061/295] Consolidate options to a single file --- .../Internal/CommonOptions.cs | 44 --------- .../Internal/CompilationOptions.cs | 94 +++++++++++++++++++ .../Internal/PrecompileRunCommand.cs | 44 +++------ .../Internal/StrongNameOptions.cs | 44 --------- .../ViewInfoContainerCodeGenerator.cs | 10 +- 5 files changed, 111 insertions(+), 125 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs delete mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs deleted file mode 100644 index 5f954cf7b5..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CommonOptions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Extensions.CommandLineUtils; - -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal -{ - public class CommonOptions - { - public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type"; - public static readonly string ContentRootTemplate = "--content-root"; - public static readonly string EmbedViewSourceTemplate = "--embed-view-sources"; - - public CommandArgument ProjectArgument { get; private set; } - - public CommandOption ConfigureCompilationType { get; private set; } - - public CommandOption ContentRootOption { get; private set; } - - public CommandOption EmbedViewSourcesOption { get; private set; } - - public void Configure(CommandLineApplication app) - { - ProjectArgument = app.Argument( - "project", - "The path to the project (project folder or project.json) with precompilation."); - - 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); - } - } -} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs new file mode 100644 index 0000000000..6f65d64421 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs @@ -0,0 +1,94 @@ +// 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.Extensions.CommandLineUtils; + +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal +{ + public 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 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 (project folder or project.json) with precompilation."); + + 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); + } + + 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 string OutputPath => OutputPathOption.Value(); + + public string ApplicationName => ApplicationNameOption.Value(); + + public string KeyFile => KeyFileOption.Value(); + + public bool DelaySign => DelaySignOption.HasValue(); + + public bool PublicSign => PublicSignOption.HasValue(); + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs index 91c6f8ef81..2d494eafe5 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -23,8 +22,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { public class PrecompileRunCommand { - public static readonly string ApplicationNameTemplate = "--application-name"; - public static readonly string OutputPathTemplate = "--output-path"; private static readonly ParallelOptions ParalellOptions = new ParallelOptions { MaxDegreeOfParallelism = 4 @@ -32,33 +29,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal private CommandLineApplication Application { get; set; } - private CommandOption OutputPathOption { get; set; } - - private CommandOption ApplicationNameOption { get; set; } - private MvcServiceProvider MvcServiceProvider { get; set; } - private CommonOptions Options { get; } = new CommonOptions(); - - private StrongNameOptions StrongNameOptions { get; } = new StrongNameOptions(); + private CompilationOptions Options { get; set; } private string ProjectPath { get; set; } public void Configure(CommandLineApplication app) { Application = app; - Options.Configure(app); - StrongNameOptions.Configure(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); + Options = new CompilationOptions(app); app.OnExecute(() => Execute()); } @@ -72,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal MvcServiceProvider = new MvcServiceProvider( ProjectPath, - ApplicationNameOption.Value(), + Options.ApplicationNameOption.Value(), Options.ContentRootOption.Value(), Options.ConfigureCompilationType.Value()); @@ -95,11 +75,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal return 1; } - var precompileAssemblyName = $"{ApplicationNameOption.Value()}{ViewsFeatureProvider.PrecompiledViewsAssemblySuffix}"; + var precompileAssemblyName = $"{Options.ApplicationName}{ViewsFeatureProvider.PrecompiledViewsAssemblySuffix}"; var compilation = CompileViews(results, precompileAssemblyName); var resources = GetResources(results); - var assemblyPath = Path.Combine(OutputPathOption.Value(), precompileAssemblyName + ".dll"); + var assemblyPath = Path.Combine(Options.OutputPath, precompileAssemblyName + ".dll"); var emitResult = EmitAssembly( compilation, MvcServiceProvider.Compiler.EmitOptions, @@ -212,9 +192,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal var codeGenerator = new ViewInfoContainerCodeGenerator(compiler, compilation); codeGenerator.AddViewFactory(results); - var assemblyName = new AssemblyName(ApplicationNameOption.Value()); + var assemblyName = new AssemblyName(Options.ApplicationName); assemblyName = Assembly.Load(assemblyName).GetName(); - codeGenerator.AddAssemblyMetadata(assemblyName, StrongNameOptions); + codeGenerator.AddAssemblyMetadata(assemblyName, Options); return codeGenerator.Compilation; } @@ -228,21 +208,21 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal return false; } - if (!OutputPathOption.HasValue()) + if (!Options.OutputPathOption.HasValue()) { - Application.Error.WriteLine($"Option {OutputPathTemplate} does not specify a value."); + Application.Error.WriteLine($"Option {CompilationOptions.OutputPathTemplate} does not specify a value."); return false; } - if (!ApplicationNameOption.HasValue()) + if (!Options.ApplicationNameOption.HasValue()) { - Application.Error.WriteLine($"Option {ApplicationNameTemplate} does not specify a value."); + Application.Error.WriteLine($"Option {CompilationOptions.ApplicationNameTemplate} does not specify a value."); return false; } if (!Options.ContentRootOption.HasValue()) { - Application.Error.WriteLine($"Option {CommonOptions.ContentRootTemplate} does not specify a value."); + Application.Error.WriteLine($"Option {CompilationOptions.ContentRootTemplate} does not specify a value."); return false; } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs deleted file mode 100644 index d22580bc1e..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/StrongNameOptions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Extensions.CommandLineUtils; - -namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal -{ - public class StrongNameOptions - { - public static readonly string StrongNameKeyPath = "--key-file"; - public static readonly string DelaySignTemplate = "--delay-sign"; - public static readonly string PublicSignTemplate = "--public-sign"; - - public CommandOption KeyFileOption { get; set; } - - public CommandOption DelaySignOption { get; private set; } - - public CommandOption PublicSignOption { get; private set; } - - public void Configure(CommandLineApplication app) - { - 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); - } - - public string KeyFile => KeyFileOption.Value(); - - public bool DelaySign => DelaySignOption.HasValue(); - - public bool PublicSign => PublicSignOption.HasValue(); - } -} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs index 4c02f27d0a..397f2c038e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs @@ -58,14 +58,14 @@ namespace {ViewsFeatureProvider.ViewInfoContainerNamespace} public void AddAssemblyMetadata( AssemblyName applicationAssemblyName, - StrongNameOptions strongNameOptions) + CompilationOptions compilationOptions) { - if (!string.IsNullOrEmpty(strongNameOptions.KeyFile)) + if (!string.IsNullOrEmpty(compilationOptions.KeyFile)) { var updatedOptions = Compilation.Options.WithStrongNameProvider(new DesktopStrongNameProvider()); - var keyFilePath = Path.GetFullPath(strongNameOptions.KeyFile); + var keyFilePath = Path.GetFullPath(compilationOptions.KeyFile); - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || strongNameOptions.PublicSign) + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || compilationOptions.PublicSign) { updatedOptions = updatedOptions.WithCryptoPublicKey( SnkUtils.ExtractPublicKey(File.ReadAllBytes(keyFilePath))); @@ -73,7 +73,7 @@ namespace {ViewsFeatureProvider.ViewInfoContainerNamespace} else { updatedOptions = updatedOptions.WithCryptoKeyFile(keyFilePath) - .WithDelaySign(strongNameOptions.DelaySign); + .WithDelaySign(compilationOptions.DelaySign); } Compilation = Compilation.WithOptions(updatedOptions); From 501540c76e32abb5ae49d1c3e9730b63eb38aa4c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 17 Jan 2017 14:25:04 -0800 Subject: [PATCH 062/295] Use the list of Content files specified in the project as a source Fixes #59 --- RazorViewCompilation.sln | 20 +-- build/common.props | 7 +- .../Internal/CompilationOptions.cs | 15 ++- .../Internal/MvcServiceProvider.cs | 3 - .../Internal/PrecompileRunCommand.cs | 40 +++--- .../Internal/ViewCompilationInfo.cs | 7 +- .../Internal/ViewFileInfo.cs | 34 +++++ .../ViewInfoContainerCodeGenerator.cs | 2 +- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 2 - .../build/common.targets | 54 ++++---- ...pNetCore.Mvc.Razor.ViewCompilation.targets | 9 +- ...pNetCore.Mvc.Razor.ViewCompilation.targets | 5 +- .../ApplicationWithCustomInputFilesTest.cs | 118 ++++++++++++++++++ ...zor.ViewCompilation.FunctionalTests.csproj | 5 +- .../PublishWithEmbedViewSourcesTest.cs | 6 +- ...mingPrecompiledViews.Manage.Home.Index.txt | 2 +- ...ApplicationWithConfigureMvc.Home.Index.txt | 2 +- ...hTagHelpers.Home.ClassLibraryTagHelper.txt | 4 +- ...tionWithTagHelpers.Home.LocalTagHelper.txt | 4 +- .../SimpleAppDesktopOnly.Home.Index.txt | 4 +- .../Resources/SimpleAppTest.Home.Index.txt | 4 +- .../Resources/StrongNamedApp.Home.Index.txt | 2 +- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 4 - .../PrecompileRunCommandTest.cs | 9 +- .../ApplicationWithCustomInputFiles.csproj | 26 ++++ .../Controllers/HomeController.cs | 23 ++++ .../Program.cs | 26 ++++ .../Startup.cs | 26 ++++ .../Views/Home/About.cshtml | 1 + .../Views/Home/Index.cshtml | 1 + .../Views/Home/NotIncluded.cshtml | 1 + 31 files changed, 366 insertions(+), 100 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewFileInfo.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs create mode 100644 testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj create mode 100644 testapps/ApplicationWithCustomInputFiles/Controllers/HomeController.cs create mode 100644 testapps/ApplicationWithCustomInputFiles/Program.cs create mode 100644 testapps/ApplicationWithCustomInputFiles/Startup.cs create mode 100644 testapps/ApplicationWithCustomInputFiles/Views/Home/About.cshtml create mode 100644 testapps/ApplicationWithCustomInputFiles/Views/Home/Index.cshtml create mode 100644 testapps/ApplicationWithCustomInputFiles/Views/Home/NotIncluded.cshtml diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 6b652d4198..73a67c64d4 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26014.0 +VisualStudioVersion = 15.0.26118.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" EndProject @@ -19,7 +19,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra 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\common.props = build\common.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -65,18 +69,6 @@ Global {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x64.Build.0 = Release|x64 {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.ActiveCfg = Release|x86 {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|x86.Build.0 = Release|x86 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x64.ActiveCfg = Debug|x64 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x64.Build.0 = Debug|x64 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x86.ActiveCfg = Debug|x86 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Debug|x86.Build.0 = Debug|x86 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|Any CPU.Build.0 = Release|Any CPU - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x64.ActiveCfg = Release|x64 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x64.Build.0 = Release|x64 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x86.ActiveCfg = Release|x86 - {1140C5E1-1C9A-4895-BB7E-C2AB2C320472}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/common.props b/build/common.props index 1b111f3342..50550ebaf4 100644 --- a/build/common.props +++ b/build/common.props @@ -11,7 +11,12 @@ true - + + + + + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs index 6f65d64421..5e7fc24f43 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/CompilationOptions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.Collections.Generic; using Microsoft.Extensions.CommandLineUtils; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal @@ -15,6 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal 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) { @@ -30,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal ProjectArgument = app.Argument( "project", - "The path to the project (project folder or project.json) with precompilation."); + "The path to the project file."); ConfigureCompilationType = app.Option( ConfigureCompilationTypeTemplate, @@ -49,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal KeyFileOption = app.Option( StrongNameKeyPath, - "Strong name key path", + "Strong name key path.", CommandOptionType.SingleValue); DelaySignOption = app.Option( @@ -61,6 +63,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal 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; } @@ -81,6 +88,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal public CommandOption ApplicationNameOption { get; } + public CommandOption ViewsToCompileOption { get; } + public string OutputPath => OutputPathOption.Value(); public string ApplicationName => ApplicationNameOption.Value(); @@ -90,5 +99,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal public bool DelaySign => DelaySignOption.HasValue(); public bool PublicSign => PublicSignOption.HasValue(); + + public List ViewsToCompile => ViewsToCompileOption.Values; } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs index 1c9146757b..fd26c58907 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/MvcServiceProvider.cs @@ -38,15 +38,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal Host = serviceProvider.GetRequiredService(); Compiler = serviceProvider.GetRequiredService(); ViewEngineOptions = serviceProvider.GetRequiredService>().Value; - FileProvider = serviceProvider.GetRequiredService().FileProvider; } public IMvcRazorHost Host { get; } public CSharpCompiler Compiler { get; } - public IFileProvider FileProvider { get; } - public RazorViewEngineOptions ViewEngineOptions { get; } private IDesignTimeMvcBuilderConfiguration GetConfigureCompilationAction(string configureCompilationType) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs index 2d494eafe5..e5278364a1 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/PrecompileRunCommand.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.CommandLineUtils; -using Microsoft.Extensions.FileProviders; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { @@ -109,11 +108,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal var resources = new ResourceDescription[results.Length]; for (var i = 0; i < results.Length; i++) { - var fileInfo = results[i].RelativeFileInfo; + var fileInfo = results[i].ViewFileInfo; resources[i] = new ResourceDescription( - fileInfo.RelativePath.Replace('\\', '/'), - fileInfo.FileInfo.CreateReadStream, + fileInfo.ViewEnginePath, + fileInfo.CreateReadStream, isPublic: true); } @@ -171,9 +170,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal { var result = results[i]; var sourceText = SourceText.From(result.GeneratorResults.GeneratedCode, Encoding.UTF8); - var fileInfo = result.RelativeFileInfo; + var fileInfo = result.ViewFileInfo; var syntaxTree = compiler.CreateSyntaxTree(sourceText) - .WithFilePath(fileInfo.FileInfo.PhysicalPath ?? fileInfo.RelativePath); + .WithFilePath(fileInfo.FullPath ?? fileInfo.ViewEnginePath); syntaxTrees[i] = syntaxTree; }); @@ -231,15 +230,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal private ViewCompilationInfo[] GenerateCode() { - var files = new List(); - GetRazorFiles(MvcServiceProvider.FileProvider, files, root: string.Empty); + var files = GetRazorFiles(); var results = new ViewCompilationInfo[files.Count]; Parallel.For(0, results.Length, ParalellOptions, i => { var fileInfo = files[i]; - using (var fileStream = fileInfo.FileInfo.CreateReadStream()) + using (var fileStream = fileInfo.CreateReadStream()) { - var result = MvcServiceProvider.Host.GenerateCode(fileInfo.RelativePath, fileStream); + var result = MvcServiceProvider.Host.GenerateCode(fileInfo.ViewEnginePath, fileStream); results[i] = new ViewCompilationInfo(fileInfo, result); } }); @@ -247,20 +245,24 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal return results; } - private static void GetRazorFiles(IFileProvider fileProvider, List razorFiles, string root) + private List GetRazorFiles() { - foreach (var fileInfo in fileProvider.GetDirectoryContents(root)) + var contentRoot = Options.ContentRootOption.Value(); + var viewFiles = Options.ViewsToCompile; + var relativeFiles = new List(viewFiles.Count); + var trimLength = contentRoot.EndsWith("/") ? contentRoot.Length - 1 : contentRoot.Length; + + for (var i = 0; i < viewFiles.Count; i++) { - var relativePath = Path.Combine(root, fileInfo.Name); - if (fileInfo.IsDirectory) + var fullPath = viewFiles[i]; + if (fullPath.StartsWith(contentRoot, StringComparison.OrdinalIgnoreCase)) { - GetRazorFiles(fileProvider, razorFiles, relativePath); - } - else if (fileInfo.Name.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase)) - { - razorFiles.Add(new RelativeFileInfo(fileInfo, relativePath)); + var viewEnginePath = fullPath.Substring(trimLength).Replace('\\', '/'); + relativeFiles.Add(new ViewFileInfo(fullPath, viewEnginePath)); } } + + return relativeFiles; } private string ReadTypeInfo(CSharpCompilation compilation, SyntaxTree syntaxTree) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs index 8630b3f456..8ab014365b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewCompilationInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Razor.CodeGenerators; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal @@ -9,14 +8,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal public class ViewCompilationInfo { public ViewCompilationInfo( - RelativeFileInfo relativeFileInfo, + ViewFileInfo viewFileInfo, GeneratorResults generatorResults) { - RelativeFileInfo = relativeFileInfo; + ViewFileInfo = viewFileInfo; GeneratorResults = generatorResults; } - public RelativeFileInfo RelativeFileInfo { get; } + public ViewFileInfo ViewFileInfo { get; } public GeneratorResults GeneratorResults { get; } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewFileInfo.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewFileInfo.cs new file mode 100644 index 0000000000..fe8f1196fc --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewFileInfo.cs @@ -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 +{ + public 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); + } + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs index 397f2c038e..c00ded2d08 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Internal/ViewInfoContainerCodeGenerator.cs @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal var precompiledViewsArray = new StringBuilder(); foreach (var item in result) { - var path = item.RelativeFileInfo.RelativePath; + var path = item.ViewFileInfo.ViewEnginePath; precompiledViewsArray.AppendLine( $"new global::{typeof(ViewInfo).FullName}(@\"{path}\", typeof({item.TypeName})),"); } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 74d0bf101d..d5d4740ae6 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -13,10 +13,8 @@ - - diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index bcd636d882..7df1e2a00a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -1,21 +1,19 @@ - - <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) - <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) - <_MvcRazorOutputFullPath>$([System.IO.Path]::Combine($(_MvcRazorOutputPath), '$(MSBuildProjectName).PrecompiledViews.dll')) - <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp + + + <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) + <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) + <_MvcRazorOutputFullPath>$(_MvcRazorOutputPath)$(MSBuildProjectName).PrecompiledViews.dll + <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp - $(MSBuildProjectDirectory) - true - + $(MSBuildProjectDirectory) + true + - - <_MvcRazorContentFiles Include="$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))**\*.cshtml" /> - - + + + + @@ -28,13 +26,15 @@ + + - - @@ -42,17 +42,25 @@ - + + + + + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)')) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index 131edb069b..1dc1bbf2b3 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/net451/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -6,7 +6,8 @@ @@ -20,7 +21,7 @@ - @@ -28,7 +29,7 @@ Text="Executing Razor view precompilation." Importance="Low" /> - @@ -37,6 +38,6 @@ Importance="High" /> - + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index 081a517bc9..a64c41b277 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -5,7 +5,8 @@ @@ -21,7 +22,7 @@ Text="Executing Razor view precompilation." Importance="Low" /> - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs new file mode 100644 index 0000000000..8860803e65 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs @@ -0,0 +1,118 @@ +// 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; +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests +{ + public class ApplicationWithCustomInputFilesTest + : IClassFixture + { + private const string ApplicationName = "ApplicationWithCustomInputFiles"; + + public ApplicationWithCustomInputFilesTest(ApplicationWithCustomInputFilesTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task ApplicationWithCustomInputFiles_Works(RuntimeFlavor flavor) + { + var expectedText = "Hello Index!"; + using (var deployer = Fixture.CreateDeployment(flavor)) + { + // Arrange + var deploymentResult = deployer.Deploy(); + + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); + + // Assert + Assert.Equal(expectedText, response.Trim()); + } + } + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled(RuntimeFlavor flavor) + { + // Arrange + var expectedViews = new[] + { + "/Views/Home/About.cshtml", + "/Views/Home/Index.cshtml", + }; + + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + + // Act + var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + Fixture.Logger); + + // Assert + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); + } + } + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public void MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled(RuntimeFlavor flavor) + { + // Arrange + var viewsNotPublished = new[] + { + "Index.cshtml", + "About.cshtml", + }; + + var viewsPublished = new[] + { + "NotIncluded.cshtml", + }; + + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home"); + + // Act & Assert + foreach (var file in viewsPublished) + { + var filePath = Path.Combine(viewsDirectory, file); + Assert.True(File.Exists(filePath), $"{filePath} was not published."); + } + + foreach (var file in viewsNotPublished) + { + var filePath = Path.Combine(viewsDirectory, file); + Assert.False(File.Exists(filePath), $"{filePath} was published."); + } + } + } + + public class ApplicationWithCustomInputFilesTestFixture : ApplicationTestFixture + { + public ApplicationWithCustomInputFilesTestFixture() + : base(ApplicationWithCustomInputFilesTest.ApplicationName) + { + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj index e473a86882..7ccd46bafd 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj @@ -6,10 +6,9 @@ - - + @@ -21,4 +20,4 @@ - + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index de0157ac58..1ae6b77938 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -32,9 +32,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests // Arrange var expectedViews = new[] { - "Areas/TestArea/Views/Home/Index.cshtml", - "Views/Home/About.cshtml", - "Views/Home/Index.cshtml", + "/Areas/TestArea/Views/Home/Index.cshtml", + "/Views/Home/About.cshtml", + "/Views/Home/Index.cshtml", }; var expectedText = "Hello Index!"; using (var deployer = Fixture.CreateDeployment(flavor)) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt index de01ff4f89..a0e0cd1b3b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt @@ -1,7 +1,7 @@ - AspNetCore.Areas_Manage_Views_Shared__Layout_cshtml, ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + AspNetCore._Areas_Manage_Views_Shared__Layout_cshtml, ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Admin home page

diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt index edb2b9073a..8d6a706cbd 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt @@ -1,2 +1,2 @@ -AspNetCore.Views_Home_Index_cshtml, ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AspNetCore._Views_Home_Index_cshtml, ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello world! \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt index 38c1e2ea7c..9e1587d4bb 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt @@ -8,7 +8,7 @@
-AspNetCore.Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AspNetCore._Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
To boldy tag that no one has ever tagged before...
@@ -20,6 +20,6 @@ AspNetCore.Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.Pr
- AspNetCore.Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + AspNetCore._Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt index c65026eb02..cda9d510a9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt @@ -8,7 +8,7 @@
-AspNetCore.Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AspNetCore._Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null TestTagHelper content. @@ -20,6 +20,6 @@ AspNetCore.Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.Precompil
- AspNetCore.Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + AspNetCore._Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt index e047f6ed3e..70675c45a5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppDesktopOnly.Home.Index.txt @@ -35,7 +35,7 @@
-AspNetCore.Views_Home_Index_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AspNetCore._Views_Home_Index_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

© 2016 - SimpleApp

@@ -54,6 +54,6 @@ AspNetCore.Views_Home_Index_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Versi - AspNetCore.Views_Shared__Layout_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + AspNetCore._Views_Shared__Layout_cshtml, SimpleAppDesktopOnly.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt index 6a085c4be8..620d2a25d0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Resources/SimpleAppTest.Home.Index.txt @@ -35,7 +35,7 @@
-AspNetCore.Views_Home_Index_cshtml, SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AspNetCore._Views_Home_Index_cshtml, SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml index 71413f674c..69c47ee16f 100644 --- a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml +++ b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ -@using SimpleApp +@using SimpleAppDesktopOnly @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers From fcabcb23857b1deb1e04c5337e30e3d1c34d3711 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 26 Jun 2017 09:40:12 -0700 Subject: [PATCH 156/295] Adding libunwind8 to .travis.yml [skip appveyor] --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 27c93bcd6f..6c59666f3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,10 @@ os: - linux - osx osx_image: xcode8.2 +addons: + apt: + packages: + - libunwind8 branches: only: - master From 81fa36f0291e7e90be3ef22ebb83637a28d8619f Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Jun 2017 16:35:48 -0700 Subject: [PATCH 157/295] Add a test that always publishes in Debug Fixes #99 Also move some tests over to reduce unnecessary deployment --- .../Infrastructure/ApplicationTestFixture.cs | 4 -- .../PublishWithDebugTest_CoreCLR.cs | 54 ++++++++++++++++++ .../PublishWithDebugTest_Desktop.cs | 57 +++++++++++++++++++ test/FunctionalTests/SimpleAppTest_CoreCLR.cs | 28 +++++++++ test/FunctionalTests/SimpleAppTest_Desktop.cs | 28 +++++++++ .../ViewCompilationOptionsTest_CoreCLR.cs | 41 ------------- .../ViewCompilationOptionsTest_Desktop.cs | 43 -------------- 7 files changed, 167 insertions(+), 88 deletions(-) create mode 100644 test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs create mode 100644 test/FunctionalTests/PublishWithDebugTest_Desktop.cs diff --git a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 83ba729400..fa8631ce02 100644 --- a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -43,11 +43,7 @@ namespace FunctionalTests ApplicationName = ApplicationName, PublishApplicationBeforeDeployment = true, TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0", -#if DEBUG - Configuration = "Debug", -#else Configuration = "Release", -#endif EnvironmentVariables = { telemetryOptOut, diff --git a/test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs b/test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs new file mode 100644 index 0000000000..ca8658e8cf --- /dev/null +++ b/test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs @@ -0,0 +1,54 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class PublishWithDebugTest_CoreCLR : + LoggedTest, IClassFixture + { + public PublishWithDebugTest_CoreCLR( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PublishingInDebugWorks() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); + } + } + + public class TestFixture : CoreCLRApplicationTestFixture + { + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.Configuration = "Debug"; + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/PublishWithDebugTest_Desktop.cs b/test/FunctionalTests/PublishWithDebugTest_Desktop.cs new file mode 100644 index 0000000000..22c940ddbd --- /dev/null +++ b/test/FunctionalTests/PublishWithDebugTest_Desktop.cs @@ -0,0 +1,57 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class PublishWithDebugTest_Desktop : + LoggedTest, IClassFixture + { + public PublishWithDebugTest_Desktop( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PublishingInDebugWorks() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); + } + } + + public class TestFixture : DesktopApplicationTestFixture + { + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.Configuration = "Debug"; + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/SimpleAppTest_CoreCLR.cs b/test/FunctionalTests/SimpleAppTest_CoreCLR.cs index 18e17b588e..da7756d3c9 100644 --- a/test/FunctionalTests/SimpleAppTest_CoreCLR.cs +++ b/test/FunctionalTests/SimpleAppTest_CoreCLR.cs @@ -1,6 +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.IO; using System.Threading.Tasks; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -38,5 +39,32 @@ namespace FunctionalTests TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); } } + + [Fact] + public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + [Fact] + public async Task Precompilation_PublishesPdbsToOutputDirectory() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); + + // Act & Assert + Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); + } + } } } diff --git a/test/FunctionalTests/SimpleAppTest_Desktop.cs b/test/FunctionalTests/SimpleAppTest_Desktop.cs index 45c1731287..2961f5479c 100644 --- a/test/FunctionalTests/SimpleAppTest_Desktop.cs +++ b/test/FunctionalTests/SimpleAppTest_Desktop.cs @@ -1,6 +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.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging.Testing; @@ -41,5 +42,32 @@ namespace FunctionalTests TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); } } + + [ConditionalFact] + public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + [ConditionalFact] + public async Task Precompilation_PublishesPdbsToOutputDirectory() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); + + // Act & Assert + Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); + } + } } } diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs index ab4dc0d6e3..d4fc86f303 100644 --- a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs +++ b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs @@ -11,47 +11,6 @@ using Xunit.Abstractions; namespace FunctionalTests { - public class ViewCompilationOptions_CoreCLR : - LoggedTest, IClassFixture> - { - public ViewCompilationOptions_CoreCLR( - CoreCLRApplicationTestFixture fixture, - ITestOutputHelper output) - : base(output) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - [Fact] - public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() - { - using (StartLog(out var loggerFactory)) - { - // Arrange - var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); - - // Act & Assert - Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); - } - } - - [Fact] - public async Task Precompilation_PublishesPdbsToOutputDirectory() - { - using (StartLog(out var loggerFactory)) - { - // Arrange - var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); - var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); - - // Act & Assert - Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); - } - } - } - public class ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished : LoggedTest, IClassFixture { diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs index e4a80533f1..abd3371446 100644 --- a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs +++ b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs @@ -12,49 +12,6 @@ using Xunit.Abstractions; namespace FunctionalTests { - [OSSkipCondition(OperatingSystems.Linux)] - [OSSkipCondition(OperatingSystems.MacOSX)] - public class ViewCompilationOptions_Desktop : - LoggedTest, IClassFixture> - { - public ViewCompilationOptions_Desktop( - DesktopApplicationTestFixture fixture, - ITestOutputHelper output) - : base(output) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - [ConditionalFact] - public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() - { - using (StartLog(out var loggerFactory)) - { - // Arrange - var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); - - // Act & Assert - Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); - } - } - - [ConditionalFact] - public async Task Precompilation_PublishesPdbsToOutputDirectory() - { - using (StartLog(out var loggerFactory)) - { - // Arrange - var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); - var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); - - // Act & Assert - Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); - } - } - } - [OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.MacOSX)] public class ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished : From d801bdc271cb0559c48f4f8613b8be9d64b3c92b Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 30 Jun 2017 15:00:24 -0700 Subject: [PATCH 158/295] Reacting to https://github.com/aspnet/Mvc/issues/6462 --- testapps/RazorPagesApp/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testapps/RazorPagesApp/Startup.cs b/testapps/RazorPagesApp/Startup.cs index 27852b1733..4fda5bff12 100644 --- a/testapps/RazorPagesApp/Startup.cs +++ b/testapps/RazorPagesApp/Startup.cs @@ -26,7 +26,7 @@ namespace RazorPagesApp builder.AddRazorPagesOptions(options => { options.RootDirectory = "/Pages"; - options.AuthorizeFolder("/Auth"); + options.Conventions.AuthorizeFolder("/Auth"); }); } } From b625ffcad61a7cb2239d90f77ba25fce7a84674e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 30 Jun 2017 14:51:05 -0700 Subject: [PATCH 159/295] Remove SimpleAppDesktopOnly --- RazorViewCompilation.sln | 17 +---- .../Controllers/HomeController.cs | 9 --- testapps/SimpleAppDesktopOnly/Program.cs | 26 ------- .../SimpleAppDesktopOnly.csproj | 14 ---- testapps/SimpleAppDesktopOnly/Startup.cs | 26 ------- .../Views/Home/Index.cshtml | 5 -- .../Views/Shared/_Layout.cshtml | 68 ------------------- .../Views/_ViewImports.cshtml | 2 - .../Views/_ViewStart.cshtml | 3 - 9 files changed, 1 insertion(+), 169 deletions(-) delete mode 100644 testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs delete mode 100644 testapps/SimpleAppDesktopOnly/Program.cs delete mode 100644 testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj delete mode 100644 testapps/SimpleAppDesktopOnly/Startup.cs delete mode 100644 testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml delete mode 100644 testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml delete mode 100644 testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml delete mode 100644 testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 07bf9a8d87..ceb4ae2e07 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" EndProject @@ -52,8 +52,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPagesApp", "testapps\RazorPagesApp\RazorPagesApp.csproj", "{779BACC4-B20E-4F73-A9C7-350443CF1941}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppDesktopOnly", "testapps\SimpleAppDesktopOnly\SimpleAppDesktopOnly.csproj", "{D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{75244EBD-DFBD-4C4B-9543-C135AC142C7F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86", "tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj", "{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}" @@ -262,18 +260,6 @@ Global {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 - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|x64.ActiveCfg = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|x64.Build.0 = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|x86.ActiveCfg = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Debug|x86.Build.0 = Debug|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|Any CPU.Build.0 = Release|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|x64.ActiveCfg = Release|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|x64.Build.0 = Release|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|x86.ActiveCfg = Release|Any CPU - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B}.Release|x86.Build.0 = Release|Any CPU {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -319,7 +305,6 @@ Global {037F4B73-75FB-4570-A38A-9109B580168C} = {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} - {D838D8E1-997A-4053-BB2A-2CBDE9F09A0B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D} = {75244EBD-DFBD-4C4B-9543-C135AC142C7F} {996D4DEB-1701-435E-8048-1E65790C2050} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} EndGlobalSection diff --git a/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs b/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs deleted file mode 100644 index e31a1bc672..0000000000 --- a/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace SimpleAppDesktopOnly.Controllers -{ - public class HomeController : Controller - { - public IActionResult Index() => View(); - } -} diff --git a/testapps/SimpleAppDesktopOnly/Program.cs b/testapps/SimpleAppDesktopOnly/Program.cs deleted file mode 100644 index c080647071..0000000000 --- a/testapps/SimpleAppDesktopOnly/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.IO; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; - -namespace SimpleAppDesktopOnly -{ - 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() - .Build(); - - host.Run(); - } - } -} diff --git a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj b/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj deleted file mode 100644 index 5075621bb5..0000000000 --- a/testapps/SimpleAppDesktopOnly/SimpleAppDesktopOnly.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net461 - win7-x64 - true - - - - - - - - diff --git a/testapps/SimpleAppDesktopOnly/Startup.cs b/testapps/SimpleAppDesktopOnly/Startup.cs deleted file mode 100644 index b372ddc988..0000000000 --- a/testapps/SimpleAppDesktopOnly/Startup.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace SimpleAppDesktopOnly -{ - 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?}"); - }); - } - } -} diff --git a/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml b/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml deleted file mode 100644 index 9c6b7fb5ff..0000000000 --- a/testapps/SimpleAppDesktopOnly/Views/Home/Index.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@{ - ViewData["Title"] = "Home Page"; -} - -@GetType().AssemblyQualifiedName \ No newline at end of file diff --git a/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml b/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml deleted file mode 100644 index dd9f1eb90d..0000000000 --- a/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - @ViewData["Title"] - SimpleAppDesktopOnly - - - - - - - - - - - - -
- @RenderBody() -
-
-

© 2016 - SimpleAppDesktopOnly

-
-
- - - - - - - - - - - - - @RenderSection("scripts", required: false) - @GetType().AssemblyQualifiedName - - diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml deleted file mode 100644 index 69c47ee16f..0000000000 --- a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml +++ /dev/null @@ -1,2 +0,0 @@ -@using SimpleAppDesktopOnly -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml deleted file mode 100644 index a5f10045db..0000000000 --- a/testapps/SimpleAppDesktopOnly/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "_Layout"; -} From edfe5399c36f3d3bafb711fb8a3d230aa5f139fe Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 30 Jun 2017 15:18:09 -0700 Subject: [PATCH 160/295] Add some details about view compilation options (#156) * Add some details about view compilation options --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 4aced681dc..2f3906067e 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,47 @@ Travis: [![Travis](https://travis-ci.org/aspnet/MvcPrecompilation.svg?branch=d 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 + + + +``` + +### 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 + + true + +``` + +Alternatively, you may wire up the `MvcRazorPrecompile` target to a build event: +```xml + +``` + +## 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. From 1f02768ddd5cc9647ffe5180b6942311d532b198 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 3 Jul 2017 09:22:10 -0700 Subject: [PATCH 161/295] Remove dependency on Microsoft.NETCore.App from the generated nuspec (#160) --- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 01f5f11668..9adc0c3d6b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -22,6 +22,7 @@ + From 2a57171ea82b22ccbae0e005ec8b0940aeb46295 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 30 Jun 2017 13:49:29 -0700 Subject: [PATCH 162/295] Use new auth API --- testapps/RazorPagesApp/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testapps/RazorPagesApp/Startup.cs b/testapps/RazorPagesApp/Startup.cs index 4fda5bff12..b0726c7605 100644 --- a/testapps/RazorPagesApp/Startup.cs +++ b/testapps/RazorPagesApp/Startup.cs @@ -10,7 +10,7 @@ namespace RazorPagesApp public void ConfigureServices(IServiceCollection services) { var builder = services.AddMvc(); - services.AddCookieAuthentication(options => options.LoginPath = "/Login"); + services.AddAuthentication().AddCookie(options => options.LoginPath = "/Login"); ConfigureMvc(builder); } From 4694014a2e3545f1834d869b98340618f54900e3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 3 Jul 2017 14:07:18 -0700 Subject: [PATCH 163/295] Update LICENSE.txt text --- LICENSE.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 0bdc1962b6..7b2956ecee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,10 +1,12 @@ -Copyright (c) .NET Foundation. All rights reserved. +Copyright (c) .NET Foundation and Contributors + +All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use -these files except in compliance with the License. You may obtain a copy of the +this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR From 922c120762cbd09dcdf6118cfd802cd7025184f4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 5 Jul 2017 15:35:11 -0700 Subject: [PATCH 164/295] React to https://github.com/aspnet/Mvc/issues/6009 --- .../ApplicationWithConfigureMvc.csproj | 1 + testapps/ApplicationWithConfigureMvc/Startup.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index 632b2e7e05..316518f5f9 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 win7-x64 true + $(DefineConstants);TEST123 diff --git a/testapps/ApplicationWithConfigureMvc/Startup.cs b/testapps/ApplicationWithConfigureMvc/Startup.cs index 124d81b51c..19de8caa76 100644 --- a/testapps/ApplicationWithConfigureMvc/Startup.cs +++ b/testapps/ApplicationWithConfigureMvc/Startup.cs @@ -29,7 +29,6 @@ namespace ApplicationWithConfigureStartup { builder.AddRazorOptions(options => { - options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols(new[] { "TEST123" }); var callback = options.CompilationCallback; options.CompilationCallback = context => { From a19a422cb16245dc1159be170dbed1b3da25f2d9 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 6 Jul 2017 10:38:42 -0700 Subject: [PATCH 165/295] React to aspnet/BuildTools#293 [ci skip] --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index b84c303069..f1b7f6f999 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,7 +2,7 @@ 2.0.0-* 0.4.0-* - 2.1.0-* + 2.0.1-* 15.1.1012 2.0.0-* 2.0.0-* From 36bdecf56f389ec98aabd24373f68156e2caf871 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 6 Jul 2017 12:22:04 -0700 Subject: [PATCH 166/295] Set "TreatWarningsAsErrors" before NuGet restore * Ensures our build stays clean of NuGet warnings --- build/common.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/common.props b/build/common.props index a92a7975b4..cf25ed9849 100644 --- a/build/common.props +++ b/build/common.props @@ -10,6 +10,7 @@ true true $(VersionSuffix)-$(BuildNumber) + true From 73b5e2fd701ce7d25fb64838c2284b173c9d31e9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 6 Jul 2017 15:03:38 -0700 Subject: [PATCH 167/295] Don't invoke GetDotNetHost task from desktop msbuild. (#163) * Don't invoke GetDotNetHost task from desktop msbuild. Fixes https://github.com/aspnet/MvcPrecompilation/issues/161 --- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index 4638085d26..e03a9428b7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -38,11 +38,16 @@ DependsOnTargets="_CreateResponseFileForMvcRazorPrecompile" Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp'"> - + + + dotnet <_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll "$(MvcRazorRunCommand)" exec From 16fc424f9e569dee077bc17f470e3a316c3d83f7 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 6 Jul 2017 15:08:39 -0700 Subject: [PATCH 168/295] Update version suffix for 2.0.0 RTM release --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index 11ac1d7f41..e55a656d79 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,6 @@ 2.0.0 - preview3 + rtm From dc45279082cc0bb19c5ce574f038325db830adf0 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 6 Jul 2017 15:40:13 -0700 Subject: [PATCH 169/295] Remove NETStandard.Library.NETFramework --- build/common-testapps.props | 4 ---- build/common.props | 4 ---- 2 files changed, 8 deletions(-) diff --git a/build/common-testapps.props b/build/common-testapps.props index 40ff4df1b1..e653c1e0ce 100644 --- a/build/common-testapps.props +++ b/build/common-testapps.props @@ -13,10 +13,6 @@ - - - - - - - - From 55d7cd2286e959a3db5b483e00ae6890ecbec2ca Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 7 Jul 2017 14:00:32 -0700 Subject: [PATCH 170/295] React to defaults --- testapps/RazorPagesApp/Startup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testapps/RazorPagesApp/Startup.cs b/testapps/RazorPagesApp/Startup.cs index b0726c7605..33964de1da 100644 --- a/testapps/RazorPagesApp/Startup.cs +++ b/testapps/RazorPagesApp/Startup.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -10,7 +11,7 @@ namespace RazorPagesApp public void ConfigureServices(IServiceCollection services) { var builder = services.AddMvc(); - services.AddAuthentication().AddCookie(options => options.LoginPath = "/Login"); + services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.LoginPath = "/Login"); ConfigureMvc(builder); } From 0cb04e7a9218e9ff5f72d57a76a3471886e48a88 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 10 Jul 2017 11:45:02 -0700 Subject: [PATCH 171/295] Branching for 2.0.0 rtm --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..37f0d27ea0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,7 +2,7 @@ - + From 8d246aab3756643bc5586250014f9f344c461412 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 10 Jul 2017 11:57:59 -0700 Subject: [PATCH 172/295] Updating KoreBuild branch --- build.ps1 | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..1785334385 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index 2875021cbc..08c555e1b8 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From cabc1b885a53bc3ad66ee4688ae48315da887f4a Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 7 Jul 2017 14:57:10 -0700 Subject: [PATCH 173/295] Skip first time experience on Appveyor --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index fc604dafd6..608e234350 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -init: +init: - git config --global core.autocrlf true branches: only: @@ -10,6 +10,10 @@ branches: build_script: - ps: .\build.ps1 clone_depth: 1 +environment: + global: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 test: off deploy: off os: Visual Studio 2017 \ No newline at end of file From 2f3054f66833e0136ad70adf85aae3a6886d01b7 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 11 Jul 2017 17:44:41 -0700 Subject: [PATCH 174/295] Update MSBuild to 15.3.0-* (#169) - Matches version shipping with Visual Studio 15.3 --- build/dependencies.props | 2 +- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index f1b7f6f999..eb24fc508d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,7 +3,7 @@ 2.0.0-* 0.4.0-* 2.0.1-* - 15.1.1012 + 15.3.0-* 2.0.0-* 2.0.0-* 2.0.0-* diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index 21007714ea..c6280404a3 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -9,7 +9,7 @@ - + From b4764b89edd48498e8253f239ec32afe90c788c9 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 12 Jul 2017 16:23:50 -0700 Subject: [PATCH 175/295] Update MSBuild version --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index eb24fc508d..9cbcb05f3d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,7 +3,7 @@ 2.0.0-* 0.4.0-* 2.0.1-* - 15.3.0-* + 15.3.406 2.0.0-* 2.0.0-* 2.0.0-* From 40e149db3039bd540306bf5dd376c630f3a2dce9 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 18 Jul 2017 11:00:56 -0700 Subject: [PATCH 176/295] Raise MSBuild version --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index 9cbcb05f3d..755c0aa647 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,7 +3,7 @@ 2.0.0-* 0.4.0-* 2.0.1-* - 15.3.406 + 15.3.407 2.0.0-* 2.0.0-* 2.0.0-* From 98b9a4bf7f1699d64af88d7db8c327f04e6427ad Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 18 Jul 2017 14:14:56 -0700 Subject: [PATCH 177/295] Don't run the precompilation tool when publishing with a RID --- ...Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index e03a9428b7..0bd06d102f 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -36,7 +36,7 @@ + Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' AND '$(RuntimeIdentifier)'==''"> - 2.0.0 - rtm + 2.1.0 + preview1 From 5b9ae32b05572c8c9ec4fb2ad6d1209a564618d5 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 24 Jul 2017 17:57:50 -0700 Subject: [PATCH 180/295] Set AspNetCoreVersion --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index b5ed54df86..ea8bbf7f74 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,6 @@ - 2.0.0-* + 2.1.0-* 0.4.0-* 2.0.1-* 15.3.409 From ab866388048ea6ce0137e935d0638277bd0ee746 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jul 2017 15:14:20 -0700 Subject: [PATCH 181/295] Updating to InternalAspNetCoreSdkVersion 2.1.1-* --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index ea8bbf7f74..e3925649b7 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,7 +2,7 @@ 2.1.0-* 0.4.0-* - 2.0.1-* + 2.1.1-* 15.3.409 2.0.0-* 2.0.0-* From 48773c5c144b5af1f25c14be12f286ce9a69a784 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 25 Jul 2017 16:33:53 -0700 Subject: [PATCH 182/295] Update bootstrappers to use the compiled version of KoreBuild [ci skip] --- .gitignore | 3 +- build.cmd | 2 +- build.ps1 | 218 ++++++++++++++++++++++++++++++++----------- build.sh | 225 +++++++++++++++++++++++++++++++++++++-------- build/common.props | 2 +- version.props | 7 -- version.xml | 8 ++ 7 files changed, 363 insertions(+), 102 deletions(-) delete mode 100644 version.props create mode 100644 version.xml diff --git a/.gitignore b/.gitignore index 5686dc84ef..d7589900af 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ node_modules *.orig BuildInfo.generated.cs msbuild.log -global.json \ No newline at end of file +global.json +korebuild-lock.txt diff --git a/build.cmd b/build.cmd index 7d4894cb4a..b6c8d24864 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..d5eb4d5cf2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,67 +1,177 @@ -$ErrorActionPreference = "Stop" +#!/usr/bin/env powershell +#requires -version 4 -function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) -{ - while($true) - { - try - { - Invoke-WebRequest $url -OutFile $downloadLocation - break - } - catch - { - $exceptionMessage = $_.Exception.Message - Write-Host "Failed to download '$url': $exceptionMessage" - if ($retries -gt 0) { - $retries-- - Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 10 +<# +.SYNOPSIS +Build this repository +.DESCRIPTION +Downloads korebuild if required. Then builds the repository. + +.PARAMETER Path +The folder to build. Defaults to the folder containing this script. + +.PARAMETER Channel +The channel of KoreBuild to download. Overrides the value from the config file. + +.PARAMETER DotNetHome +The directory where .NET Core tools will be stored. + +.PARAMETER ToolsSource +The base url where build tools can be downloaded. Overrides the value from the config file. + +.PARAMETER Update +Updates KoreBuild to the latest version even if a lock file is present. + +.PARAMETER ConfigFile +The path to the configuration file that stores values. Defaults to version.xml. + +.PARAMETER MSBuildArgs +Arguments to be passed to MSBuild + +.NOTES +This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. +When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. + +The $ConfigFile is expected to be an XML file. It is optional, and the configuration values in it are optional as well. + +.EXAMPLE +Example config file: +```xml + + + + dev + https://aspnetcore.blob.core.windows.net/buildtools + + +``` +#> +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$Path = $PSScriptRoot, + [Alias('c')] + [string]$Channel, + [Alias('d')] + [string]$DotNetHome, + [Alias('s')] + [string]$ToolsSource, + [Alias('u')] + [switch]$Update, + [string]$ConfigFile = (Join-Path $PSScriptRoot 'version.xml'), + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$MSBuildArgs +) + +Set-StrictMode -Version 2 +$ErrorActionPreference = 'Stop' + +# +# Functions +# + +function Get-KoreBuild { + + $lockFile = Join-Path $Path 'korebuild-lock.txt' + + if (!(Test-Path $lockFile) -or $Update) { + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + } + + $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 + if (!$version) { + Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'" + } + $version = $version.TrimStart('version:').Trim() + $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) + + if (!(Test-Path $korebuildPath)) { + Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" + New-Item -ItemType Directory -Path $korebuildPath | Out-Null + $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip" + + try { + $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" + Get-RemoteFile $remotePath $tmpfile + if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { + # Use built-in commands where possible as they are cross-plat compatible + Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath } - else - { - $exception = $_.Exception - throw $exception + else { + # Fallback to old approach for old installations of PowerShell + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath) } } + catch { + Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore + throw + } + finally { + Remove-Item $tmpfile -ErrorAction Ignore + } } + + return $korebuildPath } -cd $PSScriptRoot - -$repoFolder = $PSScriptRoot -$env:REPO_FOLDER = $repoFolder - -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" -if ($env:KOREBUILD_ZIP) -{ - $koreBuildZip=$env:KOREBUILD_ZIP +function Join-Paths([string]$path, [string[]]$childPaths) { + $childPaths | ForEach-Object { $path = Join-Path $path $_ } + return $path } -$buildFolder = ".build" -$buildFile="$buildFolder\KoreBuild.ps1" - -if (!(Test-Path $buildFolder)) { - Write-Host "Downloading KoreBuild from $koreBuildZip" - - $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() - New-Item -Path "$tempFolder" -Type directory | Out-Null - - $localZipFile="$tempFolder\korebuild.zip" - - DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) - - New-Item -Path "$buildFolder" -Type directory | Out-Null - copy-item "$tempFolder\**\build\*" $buildFolder -Recurse - - # Cleanup - if (Test-Path $tempFolder) { - Remove-Item -Recurse -Force $tempFolder +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { + if ($RemotePath -notlike 'http*') { + Copy-Item $RemotePath $LocalPath + return } + + $retries = 10 + while ($retries -gt 0) { + $retries -= 1 + try { + Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + return + } + catch { + Write-Verbose "Request failed. $retries retries remaining" + } + } + + Write-Error "Download failed: '$RemotePath'." } -&"$buildFile" @args +# +# Main +# + +# Load configuration or set defaults + +if (Test-Path $ConfigFile) { + [xml] $config = Get-Content $ConfigFile + if (!($Channel)) { [string] $Channel = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildChannel' } + if (!($ToolsSource)) { [string] $ToolsSource = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildToolsSource' } +} + +if (!$DotNetHome) { + $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } ` + elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} ` + elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}` + else { Join-Path $PSScriptRoot '.dotnet'} +} + +if (!$Channel) { $Channel = 'dev' } +if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } + +# Execute + +$korebuildPath = Get-KoreBuild +Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') + +try { + Install-Tools $ToolsSource $DotNetHome + Invoke-RepositoryBuild $Path @MSBuildArgs +} +finally { + Remove-Module 'KoreBuild' -ErrorAction Ignore +} diff --git a/build.sh b/build.sh index 2875021cbc..ab590e62f1 100755 --- a/build.sh +++ b/build.sh @@ -1,47 +1,196 @@ #!/usr/bin/env bash -repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" -if [ ! -z $KOREBUILD_ZIP ]; then - koreBuildZip=$KOREBUILD_ZIP -fi +set -euo pipefail -buildFolder=".build" -buildFile="$buildFolder/KoreBuild.sh" +# +# variables +# -if test ! -d $buildFolder; then - echo "Downloading KoreBuild from $koreBuildZip" +RESET="\033[0m" +RED="\033[0;31m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +config_file="$DIR/version.xml" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' - tempFolder="/tmp/KoreBuild-$(uuidgen)" - mkdir $tempFolder +# +# Functions +# +__usage() { + echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file TThe path to the configuration file that stores values. Defaults to version.xml." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - localZipFile="$tempFolder/korebuild.zip" - - retries=6 - until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) - do - echo "Failed to download '$koreBuildZip'" - if [ "$retries" -le 0 ]; then - exit 1 - fi - retries=$((retries - 1)) - echo "Waiting 10 seconds before retrying. Retries left: $retries" - sleep 10s - done - - unzip -q -d $tempFolder $localZipFile - - mkdir $buildFolder - cp -r $tempFolder/**/build/** $buildFolder - - chmod +x $buildFile - - # Cleanup - if test -d $tempFolder; then - rm -rf $tempFolder + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 fi +} + +get_korebuild() { + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f $lock_file ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + fi + local version="$(grep 'version:*' -m 1 $lock_file)" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file $remote_path $tmpfile; then + unzip -q -d "$korebuild_path" $tmpfile + fi + rm $tmpfile || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}$@${RESET}" 1>&2 +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp $remote_path $local_path + return 0 + fi + + failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O $local_path $remote_path || failed=true + fi + + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +__read_dom () { local IFS=\> ; read -d \< ENTITY CONTENT ;} + +# +# main +# + +while [[ $# > 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel=${1:-} + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME=${1:-} + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 fi -chmod +x .build/dotnet/dotnet-install.sh -$buildFile -r $repoFolder "$@" +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +if [ -f $config_file ]; then + comment=false + while __read_dom; do + if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi + if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi + if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi + if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi + done < $config_file +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +install_tools "$tools_source" "$DOTNET_HOME" +invoke_repository_build "$repo_path" $@ diff --git a/build/common.props b/build/common.props index 615d54a5f8..764fc11037 100644 --- a/build/common.props +++ b/build/common.props @@ -1,6 +1,6 @@ - + Microsoft ASP.NET Core diff --git a/version.props b/version.props deleted file mode 100644 index 5a5f18889b..0000000000 --- a/version.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - 2.1.0 - preview1 - - diff --git a/version.xml b/version.xml new file mode 100644 index 0000000000..3c05022b7d --- /dev/null +++ b/version.xml @@ -0,0 +1,8 @@ + + + + dev + 2.1.0 + preview1 + + From b44383b4018f445059a643895a9e69b9748fd3b6 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 26 Jul 2017 10:28:34 -0700 Subject: [PATCH 183/295] Fix syntax warning when running build.sh on older versions of bash [ci skip] --- build.sh | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/build.sh b/build.sh index ab590e62f1..5568c6182a 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ RESET="\033[0m" RED="\033[0;31m" MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" config_file="$DIR/version.xml" verbose=false update=false @@ -22,7 +22,7 @@ tools_source='' # Functions # __usage() { - echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" echo "" echo "Arguments:" echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." @@ -46,16 +46,17 @@ __usage() { } get_korebuild() { + local version local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f $lock_file ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" fi - local version="$(grep 'version:*' -m 1 $lock_file)" + version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" return 1 fi - version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" { @@ -64,10 +65,10 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file $remote_path $tmpfile; then - unzip -q -d "$korebuild_path" $tmpfile + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" fi - rm $tmpfile || true + rm "$tmpfile" || true fi source "$korebuild_path/KoreBuild.sh" @@ -81,7 +82,7 @@ get_korebuild() { } __error() { - echo -e "${RED}$@${RESET}" 1>&2 + echo -e "${RED}$*${RESET}" 1>&2 } __machine_has() { @@ -94,18 +95,18 @@ __get_remote_file() { local local_path=$2 if [[ "$remote_path" != 'http'* ]]; then - cp $remote_path $local_path + cp "$remote_path" "$local_path" return 0 fi failed=false if __machine_has wget; then - wget --tries 10 --quiet -O $local_path $remote_path || failed=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true fi if [ "$failed" = true ] && __machine_has curl; then failed=false - curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true fi if [ "$failed" = true ]; then @@ -114,13 +115,13 @@ __get_remote_file() { fi } -__read_dom () { local IFS=\> ; read -d \< ENTITY CONTENT ;} +__read_dom () { local IFS=\> ; read -r -d \< ENTITY CONTENT ;} # # main # -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do case $1 in -\?|-h|--help) __usage --no-exit @@ -128,7 +129,7 @@ while [[ $# > 0 ]]; do ;; -c|--channel|-Channel) shift - channel=${1:-} + channel="${1:-}" [ -z "$channel" ] && __usage ;; --config-file|-ConfigFile) @@ -138,7 +139,7 @@ while [[ $# > 0 ]]; do ;; -d|--dotnet-home|-DotNetHome) shift - DOTNET_HOME=${1:-} + DOTNET_HOME="${1:-}" [ -z "$DOTNET_HOME" ] && __usage ;; --path|-Path) @@ -178,14 +179,14 @@ if ! __machine_has curl && ! __machine_has wget; then exit 1 fi -if [ -f $config_file ]; then +if [ -f "$config_file" ]; then comment=false while __read_dom; do if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi - done < $config_file + done < "$config_file" fi [ -z "$channel" ] && channel='dev' @@ -193,4 +194,4 @@ fi get_korebuild install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" $@ +invoke_repository_build "$repo_path" "$@" From 3816db5e213657a6064f30ec50244dc5e76bab5d Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 2 Aug 2017 12:44:47 -0700 Subject: [PATCH 184/295] Update __get_remote_file logic --- build.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 5568c6182a..8eace4c20d 100755 --- a/build.sh +++ b/build.sh @@ -99,17 +99,16 @@ __get_remote_file() { return 0 fi - failed=false + local succeeded=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" && succeeded=true fi - if [ "$failed" = true ] && __machine_has curl; then - failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + if [ "$succeeded" = false ] && __machine_has curl; then + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" && succeeded=true fi - if [ "$failed" = true ]; then + if [ "$succeeded" = false ]; then __error "Download failed: $remote_path" 1>&2 return 1 fi From 9161e4cb0c7d5a0d754213050b8451973e5e483e Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 2 Aug 2017 14:33:13 -0700 Subject: [PATCH 185/295] Ensure fallback to curl after failed wget --- build.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 8eace4c20d..11cdbe5504 100755 --- a/build.sh +++ b/build.sh @@ -99,16 +99,19 @@ __get_remote_file() { return 0 fi - local succeeded=false + local failed=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" && succeeded=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + else + failed=true fi - if [ "$succeeded" = false ] && __machine_has curl; then - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" && succeeded=true + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true fi - if [ "$succeeded" = false ]; then + if [ "$failed" = true ]; then __error "Download failed: $remote_path" 1>&2 return 1 fi From a62c8484cb1785488b6ac235ddb37da46d6427a9 Mon Sep 17 00:00:00 2001 From: John Luo Date: Mon, 7 Aug 2017 17:15:15 -0700 Subject: [PATCH 186/295] Update Microsoft.AspNetCore.Server.IntegrationTesting package version --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index e3925649b7..729da60626 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,7 @@ 2.1.0-* - 0.4.0-* + 0.5.0-* 2.1.1-* 15.3.409 2.0.0-* From b00c9b4e05c1fb116defb4d0bd7c78ecdfc5e0ef Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 17 Aug 2017 15:00:51 -0700 Subject: [PATCH 187/295] Pinning versions for 2.0.0 --- NuGet.config | 2 +- build/dependencies.props | 19 ++++++++++--------- test/FunctionalTests/FunctionalTests.csproj | 2 +- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 2 +- version.props | 1 - 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index 37f0d27ea0..6a62aeda63 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,7 +2,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index b5ed54df86..c6bc8a028c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,13 +1,14 @@ - + - 2.0.0-* - 0.4.0-* - 2.0.1-* + 2.0.0 + 0.4.0 + 2.0.1-rtm-15400 15.3.409 - 2.0.0-* - 2.0.0-* - 2.0.0-* - 15.3.0-* - 2.3.0-beta2-* + 2.0.0 + 2.0.0 + 2.0.0 + 15.3.0 + 2.3.0-beta2-build3683 + 2.3.0-beta2-build1317 diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 6ff604c642..5a47b97770 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -21,7 +21,7 @@ - + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index 1648de0212..5951ec6470 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -14,7 +14,7 @@ - + diff --git a/version.props b/version.props index e55a656d79..12234eef1c 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,5 @@ 2.0.0 - rtm From efa82ceefe14bd0c1d182c3d22c05123634e93d9 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 22 Aug 2017 17:36:19 -0700 Subject: [PATCH 188/295] Upgrade to xunit 2.3.0-beta4 --- build/dependencies.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 729da60626..986dd11fd7 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -7,7 +7,7 @@ 2.0.0-* 2.0.0-* 2.0.0-* - 15.3.0-* - 2.3.0-beta2-* + 15.3.0 + 2.3.0-beta4-build3742 From 54a5b4734f6ac027c4f36046e46b8646f89121fb Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 29 Aug 2017 14:17:25 -0700 Subject: [PATCH 189/295] Use Directory.Build.props/targets --- appveyor.yml => .appveyor.yml | 0 build/common.props => Directory.Build.props | 13 ++++------- Directory.Build.targets | 2 ++ RazorViewCompilation.sln | 22 ++++++++++++++++--- src/Directory.Build.props | 7 ++++++ ...ore.Mvc.Razor.ViewCompilation.Tasks.csproj | 2 -- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 4 +--- test/Directory.Build.props | 11 ++++++++++ test/FunctionalTests/FunctionalTests.csproj | 6 ----- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 8 ------- ...ionUsingPrecompiledViewClassLibrary.csproj | 2 +- .../ApplicationUsingRelativePaths.csproj | 4 +++- .../ApplicationWithConfigureMvc.csproj | 4 +++- .../ApplicationWithCustomInputFiles.csproj | 5 ++++- .../ApplicationWithParseErrors.csproj | 4 +++- .../ApplicationWithTagHelpers.csproj | 3 ++- .../ClassLibraryTagHelper.csproj | 3 ++- .../ClassLibraryWithPrecompiledViews.csproj | 2 +- testapps/Directory.Build.props | 11 ++++++++++ .../Directory.Build.targets | 3 ++- .../PublishWithEmbedViewSources.csproj | 4 +++- testapps/RazorPagesApp/RazorPagesApp.csproj | 2 -- testapps/SimpleApp/SimpleApp.csproj | 4 +++- .../SimpleAppWithAssemblyRename.csproj | 4 +++- testapps/StrongNamedApp/StrongNamedApp.csproj | 4 ++-- tools/Directory.Build.props | 7 ++++++ ...tCore.Mvc.Razor.ViewCompilation-x86.csproj | 9 +++++--- 27 files changed, 100 insertions(+), 50 deletions(-) rename appveyor.yml => .appveyor.yml (100%) rename build/common.props => Directory.Build.props (59%) create mode 100644 Directory.Build.targets create mode 100644 src/Directory.Build.props create mode 100644 test/Directory.Build.props create mode 100644 testapps/Directory.Build.props rename build/common-testapps.props => testapps/Directory.Build.targets (96%) create mode 100644 tools/Directory.Build.props diff --git a/appveyor.yml b/.appveyor.yml similarity index 100% rename from appveyor.yml rename to .appveyor.yml diff --git a/build/common.props b/Directory.Build.props similarity index 59% rename from build/common.props rename to Directory.Build.props index 764fc11037..c0ccc7c805 100644 --- a/build/common.props +++ b/Directory.Build.props @@ -1,20 +1,15 @@ - - - + + + Microsoft ASP.NET Core https://github.com/aspnet/MvcPrecompilation git - $(MSBuildThisFileDirectory)../build/Key.snk + $(MSBuildThisFileDirectory)build\Key.snk true true $(VersionSuffix)-$(BuildNumber) true - - - - - diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..f75adf7e4d --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index ceb4ae2e07..9e74955590 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,17 +1,25 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.14 +VisualStudioVersion = 15.0.26730.10 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" EndProject 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 @@ -19,12 +27,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{87FEE984-F627-4F1E-8995-E5F969B85A19}" ProjectSection(SolutionItems) = preProject - build\common-testapps.props = build\common-testapps.props - build\common.props = build\common.props build\dependencies.props = build\dependencies.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}" + 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 @@ -53,6 +63,9 @@ 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-x86", "tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj", "{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}" EndProject @@ -308,4 +321,7 @@ Global {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D} = {75244EBD-DFBD-4C4B-9543-C135AC142C7F} {996D4DEB-1701-435E-8048-1E65790C2050} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {177268A1-F5B2-451E-8ABE-BEF0C572481A} + EndGlobalSection EndGlobal diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000000..d704a37df9 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index c6280404a3..9c7fe3d4fa 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -1,7 +1,5 @@  - - Microsoft Build Tasks supporting Razor view compilation. netstandard2.0 diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 9adc0c3d6b..8461a33a5d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -1,7 +1,5 @@  - - Build-time references required to enable Razor view compilation as part of building the application. netcoreapp2.0;net461 @@ -17,7 +15,7 @@ - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props new file mode 100644 index 0000000000..c30afd54ff --- /dev/null +++ b/test/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 6ff604c642..1b7515013e 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -1,7 +1,5 @@  - - netcoreapp2.0 $(DefineConstants);__remove_this_to__GENERATE_BASELINES @@ -16,13 +14,9 @@ - - - - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index 1648de0212..eae45ac67b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -1,7 +1,5 @@  - - netcoreapp2.0;net461 netcoreapp2.0 @@ -12,10 +10,4 @@ - - - - - - diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index fdf2f0ce59..07264b960c 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -1,11 +1,11 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 ..\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj - diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 632b2e7e05..21b11f0ffe 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -1,15 +1,17 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 true - + + diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index 316518f5f9..16379d7f8b 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -1,4 +1,5 @@  + netcoreapp2.0;net461 netcoreapp2.0 @@ -6,11 +7,12 @@ true $(DefineConstants);TEST123 - + + diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index 1f3a5714e1..1c04af1bea 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -1,4 +1,5 @@  + netcoreapp2.0;net461 netcoreapp2.0 @@ -6,14 +7,16 @@ true true + - + + diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 632b2e7e05..21b11f0ffe 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -1,15 +1,17 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 true - + + diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index e2b4bc0a9e..8623ee164c 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -1,11 +1,11 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 true - @@ -17,4 +17,5 @@ + diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index ced9c098b1..4247b34f5f 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -1,11 +1,12 @@  - netstandard2.0;net461 netstandard2.0 + + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index 9d1c257919..1a21de2137 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -1,4 +1,5 @@  + netcoreapp2.0;net461 netcoreapp2.0 @@ -6,7 +7,6 @@ obj\precompiled\$(TargetFramework) true - diff --git a/testapps/Directory.Build.props b/testapps/Directory.Build.props new file mode 100644 index 0000000000..0094c38ae4 --- /dev/null +++ b/testapps/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + + 1.0.0 + false + false + + + diff --git a/build/common-testapps.props b/testapps/Directory.Build.targets similarity index 96% rename from build/common-testapps.props rename to testapps/Directory.Build.targets index e653c1e0ce..cfb86134ad 100644 --- a/build/common-testapps.props +++ b/testapps/Directory.Build.targets @@ -1,5 +1,6 @@ - + + <_MvcViewCompilationAddDesktopReferences>false $(MvcRazorCompileOnPublish) diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index fa1036a806..ce3c6d0df2 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -1,4 +1,5 @@  + netcoreapp2.0;net461 netcoreapp2.0 @@ -6,11 +7,12 @@ true true - + + diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index 796e4ee7c4..c9ab9741b9 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -7,8 +7,6 @@ true - - diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 632b2e7e05..21b11f0ffe 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -1,15 +1,17 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 true - + + diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index 928bb9002a..b0952ca2ab 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -1,4 +1,5 @@  + NewAssemblyName netcoreapp2.0;net461 @@ -6,11 +7,12 @@ win7-x64 true - + + diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 9e43484f7b..972426ad6d 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -1,14 +1,13 @@  + netcoreapp2.0;net461 netcoreapp2.0 win7-x64 - ../../build/Key.snk true true true - @@ -16,4 +15,5 @@ + diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props new file mode 100644 index 0000000000..d704a37df9 --- /dev/null +++ b/tools/Directory.Build.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj index 954058c0a0..cc72df0dd9 100644 --- a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj +++ b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj @@ -1,5 +1,5 @@ - - + + Build-time references required to enable Razor view compilation as part of building the application. net461 @@ -7,14 +7,17 @@ exe ..\..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation + + - \ No newline at end of file + + From 28172a3a3ebcb7d0808d30469b0e3ca7d1bd2175 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 29 Aug 2017 14:25:33 -0700 Subject: [PATCH 190/295] Use PackageLineup to manage PackageReference versions --- Directory.Build.props | 1 - Directory.Build.targets | 14 +++++++++++++- NuGet.config | 1 - build/dependencies.props | 13 ------------- build/repo.props | 6 ++++++ src/Directory.Build.props | 2 +- ...pNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj | 4 ++-- ...oft.AspNetCore.Mvc.Razor.ViewCompilation.csproj | 6 +++--- test/Directory.Build.props | 10 +++++----- test/FunctionalTests/FunctionalTests.csproj | 8 ++++---- ...licationUsingPrecompiledViewClassLibrary.csproj | 13 +++++-------- .../ApplicationUsingRelativePaths.csproj | 8 ++++---- .../ApplicationWithConfigureMvc.csproj | 8 ++++---- .../ApplicationWithCustomInputFiles.csproj | 8 ++++---- .../ApplicationWithParseErrors.csproj | 8 ++++---- .../ApplicationWithTagHelpers.csproj | 8 ++++---- .../ClassLibraryTagHelper.csproj | 2 +- .../ClassLibraryWithPrecompiledViews.csproj | 2 +- .../PublishWithEmbedViewSources.csproj | 8 ++++---- testapps/RazorPagesApp/RazorPagesApp.csproj | 10 +++++----- testapps/SimpleApp/SimpleApp.csproj | 8 ++++---- .../SimpleAppWithAssemblyRename.csproj | 8 ++++---- testapps/StrongNamedApp/StrongNamedApp.csproj | 8 ++++---- tools/Directory.Build.props | 2 +- ...AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj | 6 +++--- 25 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 build/dependencies.props create mode 100644 build/repo.props diff --git a/Directory.Build.props b/Directory.Build.props index c0ccc7c805..d0406aac1b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,4 @@  - diff --git a/Directory.Build.targets b/Directory.Build.targets index f75adf7e4d..bc118fd907 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,2 +1,14 @@ - + + + + <_BootstrapperFile Condition=" $([MSBuild]::IsOSUnixLike()) ">build.sh + <_BootstrapperFile Condition="! $([MSBuild]::IsOSUnixLike()) ">build.cmd + <_BootstrapperError> + Package references have not been pinned. Run './$(_BootstrapperFile) /t:Pin'. + Also, you can run './$(_BootstrapperFile) /t:Restore' which will pin *and* restore packages. '$(_BootstrapperFile)' can be found in '$(MSBuildThisFileDirectory)'. + + + + + diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..20060c934e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,7 +3,6 @@ - diff --git a/build/dependencies.props b/build/dependencies.props deleted file mode 100644 index 986dd11fd7..0000000000 --- a/build/dependencies.props +++ /dev/null @@ -1,13 +0,0 @@ - - - 2.1.0-* - 0.5.0-* - 2.1.1-* - 15.3.409 - 2.0.0-* - 2.0.0-* - 2.0.0-* - 15.3.0 - 2.3.0-beta4-build3742 - - diff --git a/build/repo.props b/build/repo.props new file mode 100644 index 0000000000..13fe1c296a --- /dev/null +++ b/build/repo.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d704a37df9..9d9a3de33a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index 9c7fe3d4fa..de4cc931f7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 8461a33a5d..1caac2da0c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -17,9 +17,9 @@ - - - + + + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index c30afd54ff..82ba457f18 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,10 +2,10 @@ - - - - - + + + + + diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 1b7515013e..93c7cc4c07 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index 07264b960c..fbabf64c87 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -10,17 +10,14 @@ - - - - + + + + - + diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 21b11f0ffe..6df15ec41d 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index 16379d7f8b..efd3e86929 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index 1c04af1bea..e1139def5b 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 21b11f0ffe..6df15ec41d 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index 8623ee164c..074f200bbb 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -12,10 +12,10 @@ - - - - + + + + diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index 4247b34f5f..26c1a257de 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -6,7 +6,7 @@ - + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index 1a21de2137..ad2c187789 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -9,7 +9,7 @@ - + diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index ce3c6d0df2..9c384d6bd5 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index c9ab9741b9..24e2359014 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 21b11f0ffe..6df15ec41d 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index b0952ca2ab..168b8ac137 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 972426ad6d..4ba6ee0a1b 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props index d704a37df9..9d9a3de33a 100644 --- a/tools/Directory.Build.props +++ b/tools/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj index cc72df0dd9..89231458e4 100644 --- a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj +++ b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj @@ -15,9 +15,9 @@ - - - + + + From daec40f2ba69020a9372f40cffc07833c438d74c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 25 Aug 2017 14:26:18 -0700 Subject: [PATCH 191/295] Add support for cross-publishing Fixes #102 --- ...pNetCore.Mvc.Razor.ViewCompilation.targets | 27 +++++-- .../Infrastructure/ApplicationTestFixture.cs | 7 +- .../PublishForRidTest_CoreCLR.cs | 72 +++++++++++++++++++ 3 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 test/FunctionalTests/PublishForRidTest_CoreCLR.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index 0bd06d102f..a67c93c946 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -1,9 +1,8 @@ - <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) - <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) - <_MvcRazorOutputFullPath>$(_MvcRazorOutputPath)$(AssemblyName).PrecompiledViews.dll + $(IntermediateOutputPath) + <_MvcRazorOutputFullPath Condition="'$(_MvcRazorOutputFullPath)'==''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)'))$(AssemblyName).PrecompiledViews.dll <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp $(MSBuildProjectDirectory) @@ -25,7 +24,7 @@ - + <_MvcViewCompilationTasksPath Condition="'$(_MvcViewCompilationTasksPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Tasks.dll @@ -60,6 +59,22 @@ + + + + <_RazorCompilationProject Include="$(MSBuildProjectFullPath)"> + RuntimeIdentifier=;MvcRazorOutputPath=$(MvcRazorOutputPath) + + + + + + <_ResponseFileLines Include=" $(MSBuildProjectDirectory); - --output-path=$(_MvcRazorOutputPath); + --output-path=$(MvcRazorOutputPath); --application-name=$(AssemblyName); --content-root=$(MvcRazorContentRoot);" /> @@ -144,7 +159,7 @@ + Condition="'$(MvcRazorCompileOnPublish)'=='true'"> <_MvcRazorOutputPdbFullPath>$([System.IO.Path]::ChangeExtension('$(_MvcRazorOutputFullPath)', '.pdb')) diff --git a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs index fa8631ce02..7ad4ea355f 100644 --- a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -29,18 +29,21 @@ namespace FunctionalTests protected abstract DeploymentParameters GetDeploymentParameters(); protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) + => GetDeploymentParameters(ApplicationPath, ApplicationName, flavor); + + public static DeploymentParameters GetDeploymentParameters(string applicationPath, string applicationName, RuntimeFlavor flavor) { var telemetryOptOut = new KeyValuePair( DotnetCLITelemetryOptOut, "1"); var deploymentParameters = new DeploymentParameters( - ApplicationPath, + applicationPath, ServerType.Kestrel, flavor, RuntimeArchitecture.x64) { - ApplicationName = ApplicationName, + ApplicationName = applicationName, PublishApplicationBeforeDeployment = true, TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0", Configuration = "Release", diff --git a/test/FunctionalTests/PublishForRidTest_CoreCLR.cs b/test/FunctionalTests/PublishForRidTest_CoreCLR.cs new file mode 100644 index 0000000000..fdbdcc96cd --- /dev/null +++ b/test/FunctionalTests/PublishForRidTest_CoreCLR.cs @@ -0,0 +1,72 @@ +// 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.Runtime.InteropServices; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class PublishWithRidTest_CoreCLR : LoggedTest + { + public PublishWithRidTest_CoreCLR(ITestOutputHelper output) + : base(output) + { + } + + [Fact] + public void CrossPublishingWorks() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var applicationName = nameof(SimpleApp); + var applicationPath = ApplicationPaths.GetTestAppDirectory(applicationName); + var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters( + applicationPath, + applicationName, + RuntimeFlavor.CoreClr); + + // Deploy for a rid that does not exist on the current platform. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + deploymentParameters.AdditionalPublishParameters = "-r debian-x64"; + } + else + { + deploymentParameters.AdditionalPublishParameters = "-r win7-x86"; + } + var deployer = new DotNetPublishDeployer(deploymentParameters, loggerFactory); + + // Act + deployer.DotnetPublish(); + + // Act + var expectedFile = Path.Combine( + deploymentParameters.PublishedApplicationRootPath, + $"{applicationName}.PrecompiledViews.dll"); + Assert.True(File.Exists(expectedFile), $"Expected precompiled file {expectedFile} does not exist."); + } + } + + private class DotNetPublishDeployer : ApplicationDeployer + { + public DotNetPublishDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory) + : base(deploymentParameters, loggerFactory) + { + } + + public void DotnetPublish() => base.DotnetPublish(); + + public override void Dispose() => CleanPublishedOutput(); + + public override Task DeployAsync() => throw new NotSupportedException(); + } + } +} From 50360ddfaa3d2ffe4e03550296f91c2affac11cb Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 15 Sep 2017 17:58:51 -0700 Subject: [PATCH 192/295] Bump version to 2.0.1 --- build/common.props | 1 - version.props | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/common.props b/build/common.props index 615d54a5f8..5eff58a334 100644 --- a/build/common.props +++ b/build/common.props @@ -9,7 +9,6 @@ $(MSBuildThisFileDirectory)../build/Key.snk true true - $(VersionSuffix)-$(BuildNumber) true diff --git a/version.props b/version.props index 12234eef1c..b68865a1af 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,9 @@ - - - 2.0.0 - + + 2.0.1 + rtm + $(VersionPrefix) + $(VersionPrefix)-$(VersionSuffix)-final + $(VersionSuffix)-$(BuildNumber) + From 9b53da73336830ab5121c65af4e02403c8716b4c Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 18 Sep 2017 12:42:44 -0700 Subject: [PATCH 193/295] Update package feeds and dependencies for 2.0.1 (#203) --- .gitignore | 5 ++- Directory.Build.targets | 4 +++ NuGet.config | 1 + build/dependencies.targets | 65 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 Directory.Build.targets create mode 100644 build/dependencies.targets diff --git a/.gitignore b/.gitignore index 5686dc84ef..8fbeb143ae 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ node_modules *.orig BuildInfo.generated.cs msbuild.log -global.json \ No newline at end of file +global.json +*.g.targets +korebuild-lock.txt + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..d8f1db62cd --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/NuGet.config b/NuGet.config index 6a62aeda63..21510b3a41 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/build/dependencies.targets b/build/dependencies.targets new file mode 100644 index 0000000000..32e32dd503 --- /dev/null +++ b/build/dependencies.targets @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8cdba4f7ae89d2c4111d3591d1eb8ed85122b321 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 19 Sep 2017 13:47:09 -0700 Subject: [PATCH 194/295] Update bootstrappers --- build.cmd | 2 +- build.ps1 | 223 +++++++++++++++++++++++++++++++++++++------------ build.sh | 245 +++++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 379 insertions(+), 91 deletions(-) diff --git a/build.cmd b/build.cmd index 7d4894cb4a..b6c8d24864 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/build.ps1 index 1785334385..b7081bc1c2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,67 +1,186 @@ -$ErrorActionPreference = "Stop" +#!/usr/bin/env powershell +#requires -version 4 -function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +<# +.SYNOPSIS +Build this repository + +.DESCRIPTION +Downloads korebuild if required. Then builds the repository. + +.PARAMETER Path +The folder to build. Defaults to the folder containing this script. + +.PARAMETER Channel +The channel of KoreBuild to download. Overrides the value from the config file. + +.PARAMETER DotNetHome +The directory where .NET Core tools will be stored. + +.PARAMETER ToolsSource +The base url where build tools can be downloaded. Overrides the value from the config file. + +.PARAMETER Update +Updates KoreBuild to the latest version even if a lock file is present. + +.PARAMETER ConfigFile +The path to the configuration file that stores values. Defaults to version.props. + +.PARAMETER MSBuildArgs +Arguments to be passed to MSBuild + +.NOTES +This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. +When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. + +The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set +in the file are overridden by command line parameters. + +.EXAMPLE +Example config file: +```json { - while($true) - { - try - { - Invoke-WebRequest $url -OutFile $downloadLocation - break - } - catch - { - $exceptionMessage = $_.Exception.Message - Write-Host "Failed to download '$url': $exceptionMessage" - if ($retries -gt 0) { - $retries-- - Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 10 + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev", + "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" +} +``` +#> +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$Path = $PSScriptRoot, + [Alias('c')] + [string]$Channel, + [Alias('d')] + [string]$DotNetHome, + [Alias('s')] + [string]$ToolsSource, + [Alias('u')] + [switch]$Update, + [string]$ConfigFile = $null, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$MSBuildArgs +) +Set-StrictMode -Version 2 +$ErrorActionPreference = 'Stop' + +# +# Functions +# + +function Get-KoreBuild { + + $lockFile = Join-Path $Path 'korebuild-lock.txt' + + if (!(Test-Path $lockFile) -or $Update) { + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + } + + $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 + if (!$version) { + Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'" + } + $version = $version.TrimStart('version:').Trim() + $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) + + if (!(Test-Path $korebuildPath)) { + Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" + New-Item -ItemType Directory -Path $korebuildPath | Out-Null + $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip" + + try { + $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" + Get-RemoteFile $remotePath $tmpfile + if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { + # Use built-in commands where possible as they are cross-plat compatible + Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath } - else - { - $exception = $_.Exception - throw $exception + else { + # Fallback to old approach for old installations of PowerShell + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath) } } + catch { + remove-item -Recurse -Force $korebuildPath -ErrorAction Ignore + throw + } + finally { + remove-item $tmpfile -ErrorAction Ignore + } + } + + return $korebuildPath +} + +function Join-Paths([string]$path, [string[]]$childPaths) { + $childPaths | ForEach-Object { $path = Join-Path $path $_ } + return $path +} + +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { + if ($RemotePath -notlike 'http*') { + Copy-Item $RemotePath $LocalPath + return + } + + $retries = 10 + while ($retries -gt 0) { + $retries -= 1 + try { + Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + return + } + catch { + Write-Verbose "Request failed. $retries retries remaining" + } + } + + Write-Error "Download failed: '$RemotePath'." +} + +# +# Main +# + +# Load configuration or set defaults + +$Path = Resolve-Path $Path +if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' } + +if (Test-Path $ConfigFile) { + try { + $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json + if ($config) { + if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } + if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} + } + } catch { + Write-Warning "$ConfigFile could not be read. Its settings will be ignored." + Write-Warning $Error[0] } } -cd $PSScriptRoot - -$repoFolder = $PSScriptRoot -$env:REPO_FOLDER = $repoFolder - -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" -if ($env:KOREBUILD_ZIP) -{ - $koreBuildZip=$env:KOREBUILD_ZIP +if (!$DotNetHome) { + $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } ` + elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} ` + elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}` + else { Join-Path $PSScriptRoot '.dotnet'} } -$buildFolder = ".build" -$buildFile="$buildFolder\KoreBuild.ps1" +if (!$Channel) { $Channel = 'dev' } +if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } -if (!(Test-Path $buildFolder)) { - Write-Host "Downloading KoreBuild from $koreBuildZip" +# Execute - $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() - New-Item -Path "$tempFolder" -Type directory | Out-Null +$korebuildPath = Get-KoreBuild +Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') - $localZipFile="$tempFolder\korebuild.zip" - - DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) - - New-Item -Path "$buildFolder" -Type directory | Out-Null - copy-item "$tempFolder\**\build\*" $buildFolder -Recurse - - # Cleanup - if (Test-Path $tempFolder) { - Remove-Item -Recurse -Force $tempFolder - } +try { + Install-Tools $ToolsSource $DotNetHome + Invoke-RepositoryBuild $Path @MSBuildArgs +} +finally { + Remove-Module 'KoreBuild' -ErrorAction Ignore } - -&"$buildFile" @args diff --git a/build.sh b/build.sh index 08c555e1b8..9e32358cf3 100755 --- a/build.sh +++ b/build.sh @@ -1,47 +1,216 @@ #!/usr/bin/env bash -repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" -if [ ! -z $KOREBUILD_ZIP ]; then - koreBuildZip=$KOREBUILD_ZIP -fi +set -euo pipefail -buildFolder=".build" -buildFile="$buildFolder/KoreBuild.sh" +# +# variables +# -if test ! -d $buildFolder; then - echo "Downloading KoreBuild from $koreBuildZip" +RESET="\033[0m" +RED="\033[0;31m" +YELLOW="\033[0;33m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +config_file="$DIR/korebuild.json" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' - tempFolder="/tmp/KoreBuild-$(uuidgen)" - mkdir $tempFolder +# +# Functions +# +__usage() { + echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - localZipFile="$tempFolder/korebuild.zip" - - retries=6 - until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) - do - echo "Failed to download '$koreBuildZip'" - if [ "$retries" -le 0 ]; then - exit 1 - fi - retries=$((retries - 1)) - echo "Waiting 10 seconds before retrying. Retries left: $retries" - sleep 10s - done - - unzip -q -d $tempFolder $localZipFile - - mkdir $buildFolder - cp -r $tempFolder/**/build/** $buildFolder - - chmod +x $buildFile - - # Cleanup - if test -d $tempFolder; then - rm -rf $tempFolder + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 fi +} + +get_korebuild() { + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f $lock_file ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + fi + local version="$(grep 'version:*' -m 1 $lock_file)" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file $remote_path $tmpfile; then + unzip -q -d "$korebuild_path" $tmpfile + fi + rm $tmpfile || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}error: $*${RESET}" 1>&2 +} + +__warn() { + echo -e "${YELLOW}warning: $*${RESET}" +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp $remote_path $local_path + return 0 + fi + + failed=false + if __machine_has curl ; then + curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + elif __machine_has wget; then + wget --tries 10 -O $local_path $remote_path || failed=true + else + failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +# +# main +# + +while [[ $# > 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel=${1:-} + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + if [ ! -f "$config_file" ]; then + __error "Invalid value for --config-file. $config_file does not exist." + exit 1 + fi + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME=${1:-} + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 fi -chmod +x .build/dotnet/dotnet-install.sh -$buildFile -r $repoFolder "$@" +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +[ -z "${config_file:-}" ] && config_file="$repo_path/korebuild.json" +if [ -f "$config_file" ]; then + if __machine_has jq ; then + if jq '.' "$config_file" >/dev/null ; then + config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")" + config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + elif __machine_has python ; then + if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then + config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")" + config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + else + __warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.' + fi + + [ ! -z "${config_channel:-}" ] && channel="$config_channel" + [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +install_tools "$tools_source" "$DOTNET_HOME" +invoke_repository_build "$repo_path" $@ From 481d787647bf92defef637a23da077e3a8fe56bf Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 19 Sep 2017 13:53:19 -0700 Subject: [PATCH 195/295] Update bootstrappers --- korebuild.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 korebuild.json diff --git a/korebuild.json b/korebuild.json new file mode 100644 index 0000000000..6bbc5eeb9c --- /dev/null +++ b/korebuild.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/rel/2.0.2/tools/korebuild.schema.json", + "channel": "rel/2.0.2" +} From 1468bb7afd4c5cb238ed563f186f4994d499abd3 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 20 Sep 2017 13:41:27 -0700 Subject: [PATCH 196/295] Update the list of packages patching in 2.0.x --- build/dependencies.targets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build/dependencies.targets b/build/dependencies.targets index 32e32dd503..c1071f14b6 100644 --- a/build/dependencies.targets +++ b/build/dependencies.targets @@ -1,8 +1,22 @@  + + + + + + + + + + + + + + @@ -52,6 +66,7 @@ + From 0fbf540f37692cd0ea28a74277cd8028661a4f76 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 20 Sep 2017 17:23:27 -0700 Subject: [PATCH 197/295] Update build scripts, tools, and dependencies for 2.0.x --- build.sh | 40 ++++++++++++---------- build/dependencies.targets | 69 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index 9e32358cf3..5138fc4f22 100755 --- a/build.sh +++ b/build.sh @@ -23,7 +23,7 @@ tools_source='' # Functions # __usage() { - echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" echo "" echo "Arguments:" echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." @@ -47,16 +47,17 @@ __usage() { } get_korebuild() { + local version local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f $lock_file ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" fi - local version="$(grep 'version:*' -m 1 $lock_file)" + version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" return 1 fi - version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" { @@ -65,10 +66,10 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file $remote_path $tmpfile; then - unzip -q -d "$korebuild_path" $tmpfile + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" fi - rm $tmpfile || true + rm "$tmpfile" || true fi source "$korebuild_path/KoreBuild.sh" @@ -99,19 +100,22 @@ __get_remote_file() { local local_path=$2 if [[ "$remote_path" != 'http'* ]]; then - cp $remote_path $local_path + cp "$remote_path" "$local_path" return 0 fi - failed=false - if __machine_has curl ; then - curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true - elif __machine_has wget; then - wget --tries 10 -O $local_path $remote_path || failed=true + local failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true else failed=true fi + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + fi + if [ "$failed" = true ]; then __error "Download failed: $remote_path" 1>&2 return 1 @@ -122,7 +126,7 @@ __get_remote_file() { # main # -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do case $1 in -\?|-h|--help) __usage --no-exit @@ -130,7 +134,7 @@ while [[ $# > 0 ]]; do ;; -c|--channel|-Channel) shift - channel=${1:-} + channel="${1:-}" [ -z "$channel" ] && __usage ;; --config-file|-ConfigFile) @@ -144,7 +148,7 @@ while [[ $# > 0 ]]; do ;; -d|--dotnet-home|-DotNetHome) shift - DOTNET_HOME=${1:-} + DOTNET_HOME="${1:-}" [ -z "$DOTNET_HOME" ] && __usage ;; --path|-Path) @@ -213,4 +217,4 @@ fi get_korebuild install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" $@ +invoke_repository_build "$repo_path" "$@" diff --git a/build/dependencies.targets b/build/dependencies.targets index c1071f14b6..0e344b012b 100644 --- a/build/dependencies.targets +++ b/build/dependencies.targets @@ -4,8 +4,12 @@ + + + + @@ -15,13 +19,36 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -33,6 +60,8 @@ + + @@ -44,6 +73,7 @@ + @@ -51,7 +81,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -64,9 +125,15 @@ + + + + + + @@ -76,5 +143,7 @@ + + \ No newline at end of file From 05d077da43d0a3414c07d5d49928dcbd2a00979d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 21 Sep 2017 17:56:59 -0700 Subject: [PATCH 198/295] Increase Minimum Version of Visual Studio to 15.3.0 --- RazorViewCompilation.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 9e74955590..7f3dba7315 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.10 -MinimumVisualStudioVersion = 10.0.40219.1 +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}" From 311c52b12efa92f46e19529f0335b8150a28ede3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 25 Sep 2017 09:17:54 -0700 Subject: [PATCH 199/295] Honor CopyBuildOutputToPublishDirectory and CopyOutputSymbolsToPublishDirectory switches Fixes #204 --- ...pNetCore.Mvc.Razor.ViewCompilation.targets | 8 ++- ...ildOutputToPublishDirectoryTest_Desktop.cs | 63 +++++++++++++++++++ ...pyBuildOutputToPublishDirectory_CoreCLR.cs | 60 ++++++++++++++++++ ...utSymbolsToPublishDirectoryTest_CoreCLR.cs | 60 ++++++++++++++++++ ...utSymbolsToPublishDirectoryTest_Desktop.cs | 63 +++++++++++++++++++ .../Infrastructure/ApplicationTestFixture.cs | 12 +++- .../Infrastructure/PublishOnlyDeployer.cs | 47 ++++++++++++++ .../ViewCompilationOptionsTest_CoreCLR.cs | 5 ++ .../ViewCompilationOptionsTest_Desktop.cs | 5 ++ 9 files changed, 320 insertions(+), 3 deletions(-) create mode 100644 test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs create mode 100644 test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs create mode 100644 test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs create mode 100644 test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs create mode 100644 test/FunctionalTests/Infrastructure/PublishOnlyDeployer.cs diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index a67c93c946..dfe3bf81f2 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -170,11 +170,15 @@ Remove="%(MvcRazorFilesToCompile.FullPath)" Condition="'$(MvcRazorExcludeViewFilesFromPublish)'=='true'" /> - + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)')) - + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputPdbFullPath)')) diff --git a/test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs b/test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs new file mode 100644 index 0000000000..51d01d603f --- /dev/null +++ b/test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs @@ -0,0 +1,63 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class CopyBuildOutputToPublishDirectoryTest_Desktop : + LoggedTest, IClassFixture + { + public CopyBuildOutputToPublishDirectoryTest_Desktop( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PublishingWithOption_SkipsPublishingPrecompiledDll() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + var dllFile = Path.Combine(deployment.ContentRoot, "SimpleApp.PrecompiledViews.dll"); + var pdbFile = Path.ChangeExtension(dllFile, ".pdb"); + Assert.False(File.Exists(dllFile), $"{dllFile} exists at deployment."); + Assert.True(File.Exists(pdbFile), $"{pdbFile} does not exist at deployment."); + } + } + + public class TestFixture : DesktopApplicationTestFixture + { + public TestFixture() + { + PublishOnly = true; + } + + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("CopyBuildOutputToPublishDirectory", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs b/test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs new file mode 100644 index 0000000000..f5177af268 --- /dev/null +++ b/test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs @@ -0,0 +1,60 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class CopyBuildOutputToPublishDirectory_CoreCLR : + LoggedTest, IClassFixture + { + public CopyBuildOutputToPublishDirectory_CoreCLR( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PublishingWithOption_SkipsPublishingPrecompiledDll() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + var dllFile = Path.Combine(deployment.ContentRoot, "SimpleApp.PrecompiledViews.dll"); + var pdbFile = Path.ChangeExtension(dllFile, ".pdb"); + Assert.False(File.Exists(dllFile), $"{dllFile} exists at deployment."); + Assert.True(File.Exists(pdbFile), $"{pdbFile} does not exist at deployment."); + } + } + + public class TestFixture : CoreCLRApplicationTestFixture + { + public TestFixture() + { + PublishOnly = true; + } + + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("CopyBuildOutputToPublishDirectory", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs b/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs new file mode 100644 index 0000000000..bb55c6e838 --- /dev/null +++ b/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs @@ -0,0 +1,60 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class CopyOutputSymbolsToPublishDirectoryTest_CoreCLR : + LoggedTest, IClassFixture + { + public CopyOutputSymbolsToPublishDirectoryTest_CoreCLR( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PublishingWithOption_SkipsPublishingPdb() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + var dllFile = Path.Combine(deployment.ContentRoot, "SimpleApp.PrecompiledViews.dll"); + var pdbFile = Path.ChangeExtension(dllFile, ".pdb"); + Assert.True(File.Exists(dllFile), $"{dllFile} does not exist at deployment."); + Assert.False(File.Exists(pdbFile), $"{pdbFile} exists at deployment."); + } + } + + public class TestFixture : CoreCLRApplicationTestFixture + { + public TestFixture() + { + PublishOnly = true; + } + + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("CopyOutputSymbolsToPublishDirectory", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs b/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs new file mode 100644 index 0000000000..1152834603 --- /dev/null +++ b/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs @@ -0,0 +1,63 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class CopyOutputSymbolsToPublishDirectoryTest_Desktop : + LoggedTest, IClassFixture + { + public CopyOutputSymbolsToPublishDirectoryTest_Desktop( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PublishingWithOption_SkipsPublishingPdb() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + var dllFile = Path.Combine(deployment.ContentRoot, "SimpleApp.PrecompiledViews.dll"); + var pdbFile = Path.ChangeExtension(dllFile, ".pdb"); + Assert.True(File.Exists(dllFile), $"{dllFile} does not exist at deployment."); + Assert.False(File.Exists(pdbFile), $"{pdbFile} exists at deployment."); + } + } + + public class TestFixture : DesktopApplicationTestFixture + { + public TestFixture() + { + PublishOnly = true; + } + + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("CopyOutputSymbolsToPublishDirectory", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 7ad4ea355f..051f4cf2b6 100644 --- a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -26,6 +26,8 @@ namespace FunctionalTests public string ApplicationPath { get; } + public bool PublishOnly { get; set; } + protected abstract DeploymentParameters GetDeploymentParameters(); protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) @@ -77,7 +79,15 @@ namespace FunctionalTests if (_deploymentTask == null) { var deploymentParameters = GetDeploymentParameters(); - _deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory); + if (PublishOnly) + { + _deployer = new PublishOnlyDeployer(deploymentParameters, loggerFactory); + } + else + { + _deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory); + } + _deploymentTask = _deployer.DeployAsync(); } } diff --git a/test/FunctionalTests/Infrastructure/PublishOnlyDeployer.cs b/test/FunctionalTests/Infrastructure/PublishOnlyDeployer.cs new file mode 100644 index 0000000000..82a84209eb --- /dev/null +++ b/test/FunctionalTests/Infrastructure/PublishOnlyDeployer.cs @@ -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 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); + } + } + } +} diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs index d4fc86f303..6b80eca31d 100644 --- a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs +++ b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs @@ -39,6 +39,11 @@ namespace FunctionalTests public class TestFixture : CoreCLRApplicationTestFixture { + public TestFixture() + { + PublishOnly = true; + } + protected override DeploymentParameters GetDeploymentParameters() { var deploymentParameters = base.GetDeploymentParameters(); diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs index abd3371446..053b7456a9 100644 --- a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs +++ b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs @@ -42,6 +42,11 @@ namespace FunctionalTests public class TestFixture : DesktopApplicationTestFixture { + public TestFixture() + { + PublishOnly = true; + } + protected override DeploymentParameters GetDeploymentParameters() { var deploymentParameters = base.GetDeploymentParameters(); From bc2502cf4c1a753ed2e24e5f15d6ca31cb297a68 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 29 Sep 2017 17:02:36 -0700 Subject: [PATCH 200/295] Import dependencies.props last to ensure TargetFramework is set first --- Directory.Build.targets | 1 + build/common.props | 1 - build/dependencies.props | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index d8f1db62cd..5d5f288682 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,4 +1,5 @@ + diff --git a/build/common.props b/build/common.props index 5eff58a334..84652c8d8d 100644 --- a/build/common.props +++ b/build/common.props @@ -1,5 +1,4 @@ - diff --git a/build/dependencies.props b/build/dependencies.props index c6bc8a028c..71116da72a 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -11,4 +11,6 @@ 2.3.0-beta2-build3683 2.3.0-beta2-build1317 + + From 6112a098c1a7d32389c0bc7bde179a9d3ec40dbc Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 2 Oct 2017 14:13:22 -0700 Subject: [PATCH 201/295] Use MSBuild to set NuGet feeds instead of NuGet.config --- Directory.Build.targets | 1 + NuGet.config | 5 +---- build/sources.props | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 build/sources.props diff --git a/Directory.Build.targets b/Directory.Build.targets index 5d5f288682..7bf9e763a6 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,4 +1,5 @@ + diff --git a/NuGet.config b/NuGet.config index 21510b3a41..e32bddfd51 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,9 +2,6 @@ - - - - + diff --git a/build/sources.props b/build/sources.props new file mode 100644 index 0000000000..ff68f685fa --- /dev/null +++ b/build/sources.props @@ -0,0 +1,14 @@ + + + + + $(DotNetRestoreSources) + + $(RestoreSources); + https://dotnet.myget.org/F/aspnet-2-0-2-october2017-patch/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + https://api.nuget.org/v3/index.json; + + + From 9d07f205f2bda99f7b62c0d65ad70043b22e7a22 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 9 Oct 2017 11:11:31 -0700 Subject: [PATCH 202/295] Update how PackageReference versions are set Changes: - Remove floating versions - Disable myget feeds during a Universe build - Use package-specific MSBuild variables. Pattern = `packageId.Pascalize() + "PackageVersion"`, with a few exceptions. --- Directory.Build.targets | 4 +- build/common-testapps.props | 1 - build/common.props | 2 +- build/dependencies.props | 28 ++-- build/dependencies.targets | 149 ------------------ build/sources.props | 5 +- ...ore.Mvc.Razor.ViewCompilation.Tasks.csproj | 4 +- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 8 +- test/FunctionalTests/FunctionalTests.csproj | 16 +- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 6 +- ...ionUsingPrecompiledViewClassLibrary.csproj | 13 +- .../ApplicationUsingRelativePaths.csproj | 8 +- .../ApplicationWithConfigureMvc.csproj | 8 +- .../ApplicationWithCustomInputFiles.csproj | 8 +- .../ApplicationWithParseErrors.csproj | 8 +- .../ApplicationWithTagHelpers.csproj | 8 +- .../ClassLibraryTagHelper.csproj | 2 +- .../ClassLibraryWithPrecompiledViews.csproj | 2 +- .../PublishWithEmbedViewSources.csproj | 8 +- testapps/RazorPagesApp/RazorPagesApp.csproj | 10 +- testapps/SimpleApp/SimpleApp.csproj | 8 +- .../SimpleAppWithAssemblyRename.csproj | 8 +- testapps/StrongNamedApp/StrongNamedApp.csproj | 8 +- ...tCore.Mvc.Razor.ViewCompilation-x86.csproj | 8 +- 24 files changed, 93 insertions(+), 237 deletions(-) delete mode 100644 build/dependencies.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index 7bf9e763a6..246f7ac20c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,4 @@ - + - - diff --git a/build/common-testapps.props b/build/common-testapps.props index e653c1e0ce..cd9a184cf4 100644 --- a/build/common-testapps.props +++ b/build/common-testapps.props @@ -1,5 +1,4 @@ - <_MvcViewCompilationAddDesktopReferences>false $(MvcRazorCompileOnPublish) diff --git a/build/common.props b/build/common.props index 84652c8d8d..5ccb47fe42 100644 --- a/build/common.props +++ b/build/common.props @@ -12,7 +12,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index 71116da72a..938f1a7b7e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,15 +1,23 @@  - 2.0.0 - 0.4.0 - 2.0.1-rtm-15400 - 15.3.409 - 2.0.0 - 2.0.0 - 2.0.0 - 15.3.0 - 2.3.0-beta2-build3683 - 2.3.0-beta2-build1317 + 2.0.2-beta-15522 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 2.0.1-rtm-83 + 0.4.1-rtm-83 + 2.0.1-rtm-83 + 2.0.0 + 15.3.409 + 2.0.0 + 2.0.0 + 2.0.0 + 2.0.0 + 2.0.0 + 15.3.0 + 2.3.0-beta2-build3683 + 2.3.0-beta2-build1317 diff --git a/build/dependencies.targets b/build/dependencies.targets deleted file mode 100644 index 0e344b012b..0000000000 --- a/build/dependencies.targets +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/sources.props b/build/sources.props index ff68f685fa..804940f029 100644 --- a/build/sources.props +++ b/build/sources.props @@ -3,11 +3,14 @@ $(DotNetRestoreSources) - + $(RestoreSources); https://dotnet.myget.org/F/aspnet-2-0-2-october2017-patch/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + + + $(RestoreSources); https://api.nuget.org/v3/index.json; diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index c6280404a3..21cc65691f 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 9adc0c3d6b..8c30cba02a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -17,11 +17,11 @@ - + - - - + + + diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 5a47b97770..a5b97003ba 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -15,14 +15,14 @@ - - - - - - - - + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index 5951ec6470..c8dcf070b0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -13,9 +13,9 @@ - - - + + + diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index fdf2f0ce59..8c38a90a57 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -10,17 +10,14 @@ - - - - + + + + - + diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 632b2e7e05..d23136888f 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -7,9 +7,9 @@ - - - - + + + + diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index 316518f5f9..8b0391ee72 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -8,9 +8,9 @@ - - - - + + + + diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index 1f3a5714e1..c2109c80f5 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -11,9 +11,9 @@ - - - - + + + + diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 632b2e7e05..d23136888f 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -7,9 +7,9 @@ - - - - + + + + diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index e2b4bc0a9e..9ce995e2d9 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -12,9 +12,9 @@ - - - - + + + + diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index ced9c098b1..40486d50d6 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -6,6 +6,6 @@ netstandard2.0 - + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index 9d1c257919..7ea2e968b7 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -9,7 +9,7 @@ - + diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index fa1036a806..92a22fc152 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -8,9 +8,9 @@ - - - - + + + + diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index 796e4ee7c4..76715d87c9 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -10,11 +10,11 @@ - - - - - + + + + + diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 632b2e7e05..d23136888f 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -7,9 +7,9 @@ - - - - + + + + diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index 928bb9002a..3dd6d4d36e 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -8,9 +8,9 @@ - - - - + + + + diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 9e43484f7b..ae8897f711 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -11,9 +11,9 @@ - - - - + + + + diff --git a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj index 954058c0a0..b43549e0ce 100644 --- a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj +++ b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj @@ -1,4 +1,4 @@ - + Build-time references required to enable Razor view compilation as part of building the application. @@ -13,8 +13,8 @@ - - - + + + \ No newline at end of file From b9d1f8219101a3b8e0bc749067f6d6be6ec4d8d1 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 20 Sep 2017 13:22:25 -0700 Subject: [PATCH 203/295] Update bootstrappers --- .appveyor.yml | 6 +- build.cmd | 2 +- build.sh | 197 +------------------------------------- run.cmd | 2 + build.ps1 => run.ps1 | 56 +++++++---- run.sh | 223 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 267 insertions(+), 219 deletions(-) create mode 100644 run.cmd rename build.ps1 => run.ps1 (73%) create mode 100755 run.sh diff --git a/.appveyor.yml b/.appveyor.yml index 608e234350..c7b6e34316 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -init: +init: - git config --global core.autocrlf true branches: only: @@ -8,7 +8,7 @@ branches: - /^(.*\/)?ci-.*$/ - /^rel\/.*/ build_script: - - ps: .\build.ps1 + - ps: .\run.ps1 default-build clone_depth: 1 environment: global: @@ -16,4 +16,4 @@ environment: DOTNET_CLI_TELEMETRY_OPTOUT: 1 test: off deploy: off -os: Visual Studio 2017 \ No newline at end of file +os: Visual Studio 2017 diff --git a/build.cmd b/build.cmd index b6c8d24864..c0050bda12 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' default-build %*; exit $LASTEXITCODE" diff --git a/build.sh b/build.sh index 11cdbe5504..98a4b22765 100755 --- a/build.sh +++ b/build.sh @@ -1,199 +1,8 @@ #!/usr/bin/env bash set -euo pipefail - -# -# variables -# - -RESET="\033[0m" -RED="\033[0;31m" -MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" -config_file="$DIR/version.xml" -verbose=false -update=false -repo_path="$DIR" -channel='' -tools_source='' -# -# Functions -# -__usage() { - echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" - echo "" - echo "Arguments:" - echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." - echo "" - echo "Options:" - echo " --verbose Show verbose output." - echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." - echo " --config-file TThe path to the configuration file that stores values. Defaults to version.xml." - echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." - echo " --path The directory to build. Defaults to the directory containing the script." - echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." - echo " -u|--update Update to the latest KoreBuild even if the lock file is present." - echo "" - echo "Description:" - echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." - echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - - if [[ "${1:-}" != '--no-exit' ]]; then - exit 2 - fi -} - -get_korebuild() { - local version - local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f "$lock_file" ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" - fi - version="$(grep 'version:*' -m 1 "$lock_file")" - if [[ "$version" == '' ]]; then - __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" - return 1 - fi - version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" - local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" - - { - if [ ! -d "$korebuild_path" ]; then - mkdir -p "$korebuild_path" - local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" - tmpfile="$(mktemp)" - echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file "$remote_path" "$tmpfile"; then - unzip -q -d "$korebuild_path" "$tmpfile" - fi - rm "$tmpfile" || true - fi - - source "$korebuild_path/KoreBuild.sh" - } || { - if [ -d "$korebuild_path" ]; then - echo "Cleaning up after failed installation" - rm -rf "$korebuild_path" || true - fi - return 1 - } -} - -__error() { - echo -e "${RED}$*${RESET}" 1>&2 -} - -__machine_has() { - hash "$1" > /dev/null 2>&1 - return $? -} - -__get_remote_file() { - local remote_path=$1 - local local_path=$2 - - if [[ "$remote_path" != 'http'* ]]; then - cp "$remote_path" "$local_path" - return 0 - fi - - local failed=false - if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true - else - failed=true - fi - - if [ "$failed" = true ] && __machine_has curl; then - failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true - fi - - if [ "$failed" = true ]; then - __error "Download failed: $remote_path" 1>&2 - return 1 - fi -} - -__read_dom () { local IFS=\> ; read -r -d \< ENTITY CONTENT ;} - -# -# main -# - -while [[ $# -gt 0 ]]; do - case $1 in - -\?|-h|--help) - __usage --no-exit - exit 0 - ;; - -c|--channel|-Channel) - shift - channel="${1:-}" - [ -z "$channel" ] && __usage - ;; - --config-file|-ConfigFile) - shift - config_file="${1:-}" - [ -z "$config_file" ] && __usage - ;; - -d|--dotnet-home|-DotNetHome) - shift - DOTNET_HOME="${1:-}" - [ -z "$DOTNET_HOME" ] && __usage - ;; - --path|-Path) - shift - repo_path="${1:-}" - [ -z "$repo_path" ] && __usage - ;; - -s|--tools-source|-ToolsSource) - shift - tools_source="${1:-}" - [ -z "$tools_source" ] && __usage - ;; - -u|--update|-Update) - update=true - ;; - --verbose|-Verbose) - verbose=true - ;; - --) - shift - break - ;; - *) - break - ;; - esac - shift -done - -if ! __machine_has unzip; then - __error 'Missing required command: unzip' - exit 1 -fi - -if ! __machine_has curl && ! __machine_has wget; then - __error 'Missing required command. Either wget or curl is required.' - exit 1 -fi - -if [ -f "$config_file" ]; then - comment=false - while __read_dom; do - if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi - if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi - if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi - if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi - done < "$config_file" -fi - -[ -z "$channel" ] && channel='dev' -[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' - -get_korebuild -install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" "$@" +# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) +chmod +x "$DIR/run.sh"; sync +"$DIR/run.sh" default-build "$@" diff --git a/run.cmd b/run.cmd new file mode 100644 index 0000000000..d52d5c7e68 --- /dev/null +++ b/run.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/run.ps1 similarity index 73% rename from build.ps1 rename to run.ps1 index d5eb4d5cf2..49c2899856 100644 --- a/build.ps1 +++ b/run.ps1 @@ -3,10 +3,13 @@ <# .SYNOPSIS -Build this repository +Executes KoreBuild commands. .DESCRIPTION -Downloads korebuild if required. Then builds the repository. +Downloads korebuild if required. Then executes the KoreBuild command. To see available commands, execute with `-Command help`. + +.PARAMETER Command +The KoreBuild command to run. .PARAMETER Path The folder to build. Defaults to the folder containing this script. @@ -24,31 +27,32 @@ The base url where build tools can be downloaded. Overrides the value from the c Updates KoreBuild to the latest version even if a lock file is present. .PARAMETER ConfigFile -The path to the configuration file that stores values. Defaults to version.xml. +The path to the configuration file that stores values. Defaults to korebuild.json. -.PARAMETER MSBuildArgs -Arguments to be passed to MSBuild +.PARAMETER Arguments +Arguments to be passed to the command .NOTES This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. -The $ConfigFile is expected to be an XML file. It is optional, and the configuration values in it are optional as well. +The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set +in the file are overridden by command line parameters. .EXAMPLE Example config file: -```xml - - - - dev - https://aspnetcore.blob.core.windows.net/buildtools - - +```json +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev", + "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" +} ``` #> [CmdletBinding(PositionalBinding = $false)] param( + [Parameter(Mandatory=$true, Position = 0)] + [string]$Command, [string]$Path = $PSScriptRoot, [Alias('c')] [string]$Channel, @@ -58,9 +62,9 @@ param( [string]$ToolsSource, [Alias('u')] [switch]$Update, - [string]$ConfigFile = (Join-Path $PSScriptRoot 'version.xml'), + [string]$ConfigFile, [Parameter(ValueFromRemainingArguments = $true)] - [string[]]$MSBuildArgs + [string[]]$Arguments ) Set-StrictMode -Version 2 @@ -147,10 +151,20 @@ function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { # Load configuration or set defaults +$Path = Resolve-Path $Path +if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' } + if (Test-Path $ConfigFile) { - [xml] $config = Get-Content $ConfigFile - if (!($Channel)) { [string] $Channel = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildChannel' } - if (!($ToolsSource)) { [string] $ToolsSource = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildToolsSource' } + try { + $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json + if ($config) { + if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } + if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} + } + } catch { + Write-Warning "$ConfigFile could not be read. Its settings will be ignored." + Write-Warning $Error[0] + } } if (!$DotNetHome) { @@ -169,8 +183,8 @@ $korebuildPath = Get-KoreBuild Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') try { - Install-Tools $ToolsSource $DotNetHome - Invoke-RepositoryBuild $Path @MSBuildArgs + Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile + Invoke-KoreBuildCommand $Command @Arguments } finally { Remove-Module 'KoreBuild' -ErrorAction Ignore diff --git a/run.sh b/run.sh new file mode 100755 index 0000000000..c278423acc --- /dev/null +++ b/run.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# +# variables +# + +RESET="\033[0m" +RED="\033[0;31m" +YELLOW="\033[0;33m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' + +# +# Functions +# +__usage() { + echo "Usage: $(basename "${BASH_SOURCE[0]}") command [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " command The command to be run." + echo " ... Arguments passed to the command. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." + + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 + fi +} + +get_korebuild() { + local version + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" + fi + version="$(grep 'version:*' -m 1 "$lock_file")" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" + fi + rm "$tmpfile" || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}error: $*${RESET}" 1>&2 +} + +__warn() { + echo -e "${YELLOW}warning: $*${RESET}" +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp "$remote_path" "$local_path" + return 0 + fi + + local failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + else + failed=true + fi + + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +# +# main +# + +command="${1:-}" +shift + +while [[ $# -gt 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel="${1:-}" + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + if [ ! -f "$config_file" ]; then + __error "Invalid value for --config-file. $config_file does not exist." + exit 1 + fi + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME="${1:-}" + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 +fi + +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +[ -z "${config_file:-}" ] && config_file="$repo_path/korebuild.json" +if [ -f "$config_file" ]; then + if __machine_has jq ; then + if jq '.' "$config_file" >/dev/null ; then + config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")" + config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + elif __machine_has python ; then + if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then + config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")" + config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + else + __warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.' + fi + + [ ! -z "${config_channel:-}" ] && channel="$config_channel" + [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" +invoke_korebuild_command "$command" "$@" From bc58d8495a431d3de606afc52c2987d1ebf1e6ad Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 13 Oct 2017 12:59:28 -0700 Subject: [PATCH 204/295] Update build tools to 2.0.2-rc1-15526 and dependencies to 2.0.1-rtm-105 --- .gitignore | 1 - build.ps1 | 4 ++-- build.sh | 2 +- build/dependencies.props | 16 ++++++++-------- korebuild-lock.txt | 2 ++ 5 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 korebuild-lock.txt diff --git a/.gitignore b/.gitignore index 8fbeb143ae..f32b5e1275 100644 --- a/.gitignore +++ b/.gitignore @@ -41,5 +41,4 @@ BuildInfo.generated.cs msbuild.log global.json *.g.targets -korebuild-lock.txt diff --git a/build.ps1 b/build.ps1 index b7081bc1c2..f2be7cbb7c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -103,11 +103,11 @@ function Get-KoreBuild { } } catch { - remove-item -Recurse -Force $korebuildPath -ErrorAction Ignore + Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore throw } finally { - remove-item $tmpfile -ErrorAction Ignore + Remove-Item $tmpfile -ErrorAction Ignore } } diff --git a/build.sh b/build.sh index 5138fc4f22..14d84a8773 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ RED="\033[0;31m" YELLOW="\033[0;33m" MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" config_file="$DIR/korebuild.json" verbose=false update=false diff --git a/build/dependencies.props b/build/dependencies.props index 938f1a7b7e..bbbda2449f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,13 +1,13 @@  - 2.0.2-beta-15522 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 2.0.1-rtm-83 - 0.4.1-rtm-83 - 2.0.1-rtm-83 + 2.0.2-rc1-15526 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 2.0.1-rtm-105 + 0.4.1-rtm-105 + 2.0.1-rtm-105 2.0.0 15.3.409 2.0.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt new file mode 100644 index 0000000000..632c589cce --- /dev/null +++ b/korebuild-lock.txt @@ -0,0 +1,2 @@ +version:2.0.2-rc1-15526 +commithash:436afc3dc08f5e278431db807866cc5f032f4d7b From 00dd638c4ff35f53198ead9de7ccd40c26ec13c9 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 16 Oct 2017 12:51:43 -0700 Subject: [PATCH 205/295] Add RepositoryRoot --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d0406aac1b..fb91bbf3e5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,10 +1,11 @@ - + Microsoft ASP.NET Core https://github.com/aspnet/MvcPrecompilation git + $(MSBuildThisFileDirectory) $(MSBuildThisFileDirectory)build\Key.snk true true From 976ddc2ef89b2e0ec9f366d2952c3bd45d9d5b13 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 1 Nov 2017 18:05:30 -0700 Subject: [PATCH 206/295] Pin tool and package versions to make builds more repeatable Part of aspnet/Universe#575 --- .gitignore | 1 - Directory.Build.props | 6 ++--- Directory.Build.targets | 17 +++--------- NuGet.config | 1 + build/dependencies.props | 27 +++++++++++++++++++ build/repo.props | 9 ++++--- korebuild-lock.txt | 2 ++ korebuild.json | 4 +++ src/Directory.Build.props | 2 +- ...ore.Mvc.Razor.ViewCompilation.Tasks.csproj | 4 +-- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 6 ++--- test/Directory.Build.props | 10 +++---- test/FunctionalTests/FunctionalTests.csproj | 8 +++--- ...ionUsingPrecompiledViewClassLibrary.csproj | 8 +++--- .../ApplicationUsingRelativePaths.csproj | 8 +++--- .../ApplicationWithConfigureMvc.csproj | 8 +++--- .../ApplicationWithCustomInputFiles.csproj | 8 +++--- .../ApplicationWithParseErrors.csproj | 8 +++--- .../ApplicationWithTagHelpers.csproj | 8 +++--- .../ClassLibraryTagHelper.csproj | 2 +- .../ClassLibraryWithPrecompiledViews.csproj | 2 +- .../PublishWithEmbedViewSources.csproj | 8 +++--- testapps/RazorPagesApp/RazorPagesApp.csproj | 10 +++---- testapps/SimpleApp/SimpleApp.csproj | 8 +++--- .../SimpleAppWithAssemblyRename.csproj | 8 +++--- testapps/StrongNamedApp/StrongNamedApp.csproj | 8 +++--- tools/Directory.Build.props | 2 +- ...tCore.Mvc.Razor.ViewCompilation-x86.csproj | 6 ++--- version.props | 10 +++++++ version.xml | 8 ------ 30 files changed, 122 insertions(+), 95 deletions(-) create mode 100644 build/dependencies.props create mode 100644 korebuild-lock.txt create mode 100644 korebuild.json create mode 100644 version.props delete mode 100644 version.xml diff --git a/.gitignore b/.gitignore index d7589900af..18dc1b7b58 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,3 @@ node_modules BuildInfo.generated.cs msbuild.log global.json -korebuild-lock.txt diff --git a/Directory.Build.props b/Directory.Build.props index fb91bbf3e5..d875d2bcb9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,6 @@ - - + + + Microsoft ASP.NET Core @@ -9,7 +10,6 @@ $(MSBuildThisFileDirectory)build\Key.snk true true - $(VersionSuffix)-$(BuildNumber) true diff --git a/Directory.Build.targets b/Directory.Build.targets index bc118fd907..e83ff95e39 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,14 +1,5 @@ - - - - <_BootstrapperFile Condition=" $([MSBuild]::IsOSUnixLike()) ">build.sh - <_BootstrapperFile Condition="! $([MSBuild]::IsOSUnixLike()) ">build.cmd - <_BootstrapperError> - Package references have not been pinned. Run './$(_BootstrapperFile) /t:Pin'. - Also, you can run './$(_BootstrapperFile) /t:Restore' which will pin *and* restore packages. '$(_BootstrapperFile)' can be found in '$(MSBuildThisFileDirectory)'. - - - - - + + + $(MicrosoftNETCoreApp20PackageVersion) + diff --git a/NuGet.config b/NuGet.config index 20060c934e..4e8a1f6de1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,6 +3,7 @@ + diff --git a/build/dependencies.props b/build/dependencies.props new file mode 100644 index 0000000000..2f9e96ca98 --- /dev/null +++ b/build/dependencies.props @@ -0,0 +1,27 @@ + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + 2.1.0-preview1-15551 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 0.5.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 15.3.409 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.0.0 + 15.3.0 + 2.3.0 + 2.3.0 + + + diff --git a/build/repo.props b/build/repo.props index 13fe1c296a..b55e651b87 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,6 +1,7 @@  - - - - + + + Internal.AspNetCore.Universe.Lineup + https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json + diff --git a/korebuild-lock.txt b/korebuild-lock.txt new file mode 100644 index 0000000000..86352477bb --- /dev/null +++ b/korebuild-lock.txt @@ -0,0 +1,2 @@ +version:2.1.0-preview1-15551 +commithash:8fad9553b48533fddbb16a423ea55b9710ea2e63 diff --git a/korebuild.json b/korebuild.json new file mode 100644 index 0000000000..bd5d51a51b --- /dev/null +++ b/korebuild.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev" +} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9d9a3de33a..1e0980f663 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index de4cc931f7..e947ddb516 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 1caac2da0c..013353650c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -17,9 +17,9 @@ - - - + + + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 82ba457f18..c867cbd112 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,10 +2,10 @@ - - - - - + + + + + diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 93c7cc4c07..29ab9c4118 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index fbabf64c87..8f1b7d628f 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 6df15ec41d..3e094792f4 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index efd3e86929..f56ce8b676 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index e1139def5b..ec3f89e303 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 6df15ec41d..3e094792f4 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index 074f200bbb..5b14e4f5ab 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -12,10 +12,10 @@ - - - - + + + + diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index 26c1a257de..f536697188 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -6,7 +6,7 @@ - + diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index ad2c187789..b4d8fab4d4 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -9,7 +9,7 @@ - + diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index 9c384d6bd5..8d5f02ce7f 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index 24e2359014..aa8358b01f 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 6df15ec41d..3e094792f4 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index 168b8ac137..50dada77b1 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 4ba6ee0a1b..59da78d54e 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props index 9d9a3de33a..1e0980f663 100644 --- a/tools/Directory.Build.props +++ b/tools/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj index 89231458e4..511e0d7839 100644 --- a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj +++ b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/version.props b/version.props new file mode 100644 index 0000000000..5c4a7c32d1 --- /dev/null +++ b/version.props @@ -0,0 +1,10 @@ + + + 2.1.0 + preview1 + $(VersionPrefix) + $(VersionPrefix)-$(VersionSuffix)-final + t000 + $(VersionSuffix)-$(BuildNumber) + + diff --git a/version.xml b/version.xml deleted file mode 100644 index 3c05022b7d..0000000000 --- a/version.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - dev - 2.1.0 - preview1 - - From 36674b5d24d35cb5c07f0f53e54488d188650af9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 7 Nov 2017 12:43:40 -0800 Subject: [PATCH 207/295] Fix failing tests * Specify RIDs for SimpleApp * Default to the RID \ PlatformTarget that the SDK chooses (viz win7-x86 for .NET Framework) * Default Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj to win7-x86 and remove extraneous project under the tools directory to simplify the build. --- RazorViewCompilation.sln | 15 ----------- ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 26 +++++++++++++++---- ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 1 - ...ionUsingPrecompiledViewClassLibrary.csproj | 1 - .../ApplicationUsingRelativePaths.csproj | 1 - .../ApplicationWithConfigureMvc.csproj | 1 - .../ApplicationWithCustomInputFiles.csproj | 1 - .../ApplicationWithParseErrors.csproj | 1 - .../ApplicationWithTagHelpers.csproj | 1 - .../ClassLibraryWithPrecompiledViews.csproj | 1 - testapps/Directory.Build.targets | 2 +- .../PublishWithEmbedViewSources.csproj | 1 - testapps/RazorPagesApp/RazorPagesApp.csproj | 1 - testapps/SimpleApp/SimpleApp.csproj | 2 +- .../SimpleAppWithAssemblyRename.csproj | 1 - testapps/StrongNamedApp/StrongNamedApp.csproj | 1 - tools/Directory.Build.props | 7 ----- ...tCore.Mvc.Razor.ViewCompilation-x86.csproj | 23 ---------------- 18 files changed, 23 insertions(+), 64 deletions(-) delete mode 100644 tools/Directory.Build.props delete mode 100644 tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 7f3dba7315..a9acbeaa16 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -67,8 +67,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{75244EBD tools\Directory.Build.props = tools\Directory.Build.props EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86", "tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj", "{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}" -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 Global @@ -273,18 +271,6 @@ Global {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 - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|x64.ActiveCfg = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|x64.Build.0 = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|x86.ActiveCfg = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Debug|x86.Build.0 = Debug|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|Any CPU.Build.0 = Release|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x64.ActiveCfg = Release|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x64.Build.0 = Release|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x86.ActiveCfg = Release|Any CPU - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.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 @@ -318,7 +304,6 @@ Global {037F4B73-75FB-4570-A38A-9109B580168C} = {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} - {DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D} = {75244EBD-DFBD-4C4B-9543-C135AC142C7F} {996D4DEB-1701-435E-8048-1E65790C2050} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj index 013353650c..1acbdc3bd8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj @@ -4,17 +4,24 @@ Build-time references required to enable Razor view compilation as part of building the application. netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 + cshtml;razor;compilation;precompilation;aspnetcore true exe - ..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\ ..\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\ false + + win7-x86;win7-x64 + x86 + $(AssemblyName)-$(PlatformTarget) + false + bin\$(Configuration)\net461\win7-$(PlatformTarget) + obj\$(Configuration)\net461\win7-$(PlatformTarget) + + - @@ -30,8 +37,17 @@ - - + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index eae45ac67b..74c0b9d161 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index 8f1b7d628f..9478314e47 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 ..\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 3e094792f4..85a0a8df38 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index f56ce8b676..4aee9fb627 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true $(DefineConstants);TEST123 diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index ec3f89e303..95c4f130ad 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true true diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 3e094792f4..85a0a8df38 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index 5b14e4f5ab..c6c8b6e41c 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index b4d8fab4d4..4ba7c2f5c3 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 obj\precompiled\$(TargetFramework) true diff --git a/testapps/Directory.Build.targets b/testapps/Directory.Build.targets index cfb86134ad..a56638ed5c 100644 --- a/testapps/Directory.Build.targets +++ b/testapps/Directory.Build.targets @@ -20,7 +20,7 @@ Condition="'$(TestIncludeViewCompilationTargets)'=='true'"> <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll - <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='net461'">$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.exe + <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='net461'">$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index 8d5f02ce7f..9f3dc47490 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true true diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index aa8358b01f..9c7c5ab6b0 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 3e094792f4..f5f65c45ca 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -3,7 +3,7 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 + win7-x86;debian-x64 true diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index 50dada77b1..bee405d99b 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -4,7 +4,6 @@ NewAssemblyName netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 59da78d54e..d72479411d 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -3,7 +3,6 @@ netcoreapp2.0;net461 netcoreapp2.0 - win7-x64 true true true diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props deleted file mode 100644 index 1e0980f663..0000000000 --- a/tools/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj b/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj deleted file mode 100644 index 511e0d7839..0000000000 --- a/tools/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - Build-time references required to enable Razor view compilation as part of building the application. - net461 - win7-x86 - exe - ..\..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation - - - - - - - - - - - - - - - From 0210b69020ff9c10951bd75a782a8913758182ce Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 7 Nov 2017 12:40:29 -0800 Subject: [PATCH 208/295] Fix build warning for missing API base lines --- .../Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj index e947ddb516..7afcec3de8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj @@ -4,6 +4,7 @@ Microsoft Build Tasks supporting Razor view compilation. netstandard2.0 false + false From 02850d48dd9a3a4a398385a23988a0529333ba58 Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Fri, 10 Nov 2017 18:04:29 -0600 Subject: [PATCH 209/295] Add a missing tick to README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f3906067e..71b43697d2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The Razor syntax provides a fast, terse, clean, and lightweight way to combine s ``` ### 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: +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 From 7f1a987adaf246e03ffd1a58ab75b5e09b8d9b00 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 15 Nov 2017 11:03:08 -0800 Subject: [PATCH 210/295] Update samples and tests to target netcoreapp2.1 --- Directory.Build.props | 4 +++ build/dependencies.props | 24 ++++++------- korebuild-lock.txt | 4 +-- test/Directory.Build.props | 7 ++++ ...cationConsumingPrecompiledViews_CoreCLR.cs | 0 ...plicationUsingRelativePathsTest_CoreCLR.cs | 0 ...ApplicationWithConfigureMvcTest_CoreCLR.cs | 0 ...icationWithCustomInputFilesTest_CoreCLR.cs | 0 .../ApplicationWithParseErrorsTest_CoreCLR.cs | 0 .../ApplicationWithTagHelpersTest_CoreCLR.cs | 0 ...pyBuildOutputToPublishDirectory_CoreCLR.cs | 0 ...utSymbolsToPublishDirectoryTest_CoreCLR.cs | 0 .../CoreCLRApplicationTestFixture.cs | 11 +++++- .../PublishForRidTest_CoreCLR.cs | 19 ++++++---- .../PublishWithDebugTest_CoreCLR.cs | 14 ++++---- ...PublishWithEmbedViewSourcesTest_CoreCLR.cs | 0 .../RazorPagesAppTest_CoreCLR.cs | 0 .../SimpleAppTest_CoreCLR.cs | 0 ...SimpleAppWithAssemblyRenameTest_CoreCLR.cs | 0 .../StrongNamedAppTest_CoreCLR.cs | 0 .../ViewCompilationOptionsTest_CoreCLR.cs | 0 ...cationConsumingPrecompiledViews_Desktop.cs | 0 ...plicationUsingRelativePathsTest_Desktop.cs | 0 ...ApplicationWithConfigureMvcTest_Desktop.cs | 0 ...icationWithCustomInputFilesTest_Desktop.cs | 0 .../ApplicationWithParseErrorsTest_Desktop.cs | 0 .../ApplicationWithTagHelpersTest_Desktop.cs | 0 ...ildOutputToPublishDirectoryTest_Desktop.cs | 0 ...utSymbolsToPublishDirectoryTest_Desktop.cs | 0 .../DesktopApplicationTestFixture.cs | 2 +- .../PublishWithDebugTest_Desktop.cs | 17 +++++---- ...PublishWithEmbedViewSourcesTest_Desktop.cs | 0 .../RazorPagesAppTest_Desktop.cs | 0 .../SimpleAppTest_Desktop.cs | 0 ...SimpleAppWithAssemblyRenameTest_Desktop.cs | 0 .../StrongNamedAppTest_Desktop.cs | 0 .../ViewCompilationOptionsTest_Desktop.cs | 0 test/FunctionalTests/FunctionalTests.csproj | 8 ++++- .../Infrastructure/ApplicationTestFixture.cs | 36 +++++++++++++------ ...Core.Mvc.Razor.ViewCompilation.Test.csproj | 3 +- ...ionUsingPrecompiledViewClassLibrary.csproj | 3 +- .../ApplicationUsingRelativePaths.csproj | 3 +- .../ApplicationWithConfigureMvc.csproj | 3 +- .../ApplicationWithCustomInputFiles.csproj | 3 +- .../ApplicationWithParseErrors.csproj | 3 +- .../ApplicationWithTagHelpers.csproj | 3 +- .../ClassLibraryTagHelper.csproj | 3 +- .../ClassLibraryWithPrecompiledViews.csproj | 4 +-- testapps/Directory.Build.props | 7 ++++ testapps/Directory.Build.targets | 11 +++--- .../PublishWithEmbedViewSources.csproj | 3 +- testapps/RazorPagesApp/RazorPagesApp.csproj | 3 +- testapps/SimpleApp/SimpleApp.csproj | 3 +- .../SimpleAppWithAssemblyRename.csproj | 3 +- testapps/StrongNamedApp/StrongNamedApp.csproj | 3 +- 55 files changed, 125 insertions(+), 82 deletions(-) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationConsumingPrecompiledViews_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationUsingRelativePathsTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationWithConfigureMvcTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationWithCustomInputFilesTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationWithParseErrorsTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ApplicationWithTagHelpersTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/CopyBuildOutputToPublishDirectory_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs (100%) rename test/FunctionalTests/{Infrastructure => CoreCLRTests}/CoreCLRApplicationTestFixture.cs (71%) rename test/FunctionalTests/{ => CoreCLRTests}/PublishForRidTest_CoreCLR.cs (88%) rename test/FunctionalTests/{ => CoreCLRTests}/PublishWithDebugTest_CoreCLR.cs (81%) rename test/FunctionalTests/{ => CoreCLRTests}/PublishWithEmbedViewSourcesTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/RazorPagesAppTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/SimpleAppTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/SimpleAppWithAssemblyRenameTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/StrongNamedAppTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => CoreCLRTests}/ViewCompilationOptionsTest_CoreCLR.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationConsumingPrecompiledViews_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationUsingRelativePathsTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationWithConfigureMvcTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationWithCustomInputFilesTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationWithParseErrorsTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ApplicationWithTagHelpersTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/CopyBuildOutputToPublishDirectoryTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs (100%) rename test/FunctionalTests/{Infrastructure => DesktopTests}/DesktopApplicationTestFixture.cs (90%) rename test/FunctionalTests/{ => DesktopTests}/PublishWithDebugTest_Desktop.cs (79%) rename test/FunctionalTests/{ => DesktopTests}/PublishWithEmbedViewSourcesTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/RazorPagesAppTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/SimpleAppTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/SimpleAppWithAssemblyRenameTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/StrongNamedAppTest_Desktop.cs (100%) rename test/FunctionalTests/{ => DesktopTests}/ViewCompilationOptionsTest_Desktop.cs (100%) diff --git a/Directory.Build.props b/Directory.Build.props index d875d2bcb9..3ecf4afdd9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,8 @@  + + diff --git a/build/dependencies.props b/build/dependencies.props index 2f9e96ca98..775eb2d4d9 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 2.1.0-preview1-15551 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 0.5.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 15.3.409 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 + 2.1.0-preview1-27579 2.0.0 15.3.0 2.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 86352477bb..95f4613014 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15551 -commithash:8fad9553b48533fddbb16a423ea55b9710ea2e63 +version:2.1.0-preview1-15567 +commithash:903e3104807b1bb8cddd28bdef205b1e2dc021d1 diff --git a/test/Directory.Build.props b/test/Directory.Build.props index c867cbd112..7ec143f84d 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,6 +1,13 @@  + + netcoreapp2.1 + $(DeveloperBuildTestTfms) + netcoreapp2.1;netcoreapp2.0 + $(StandardTestTfms);net461 + + diff --git a/test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationUsingRelativePathsTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationUsingRelativePathsTest_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationWithConfigureMvcTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationWithConfigureMvcTest_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationWithParseErrorsTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationWithParseErrorsTest_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ApplicationWithTagHelpersTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ApplicationWithTagHelpersTest_CoreCLR.cs diff --git a/test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/CopyBuildOutputToPublishDirectory_CoreCLR.cs diff --git a/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs diff --git a/test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs b/test/FunctionalTests/CoreCLRTests/CoreCLRApplicationTestFixture.cs similarity index 71% rename from test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs rename to test/FunctionalTests/CoreCLRTests/CoreCLRApplicationTestFixture.cs index 6f4c8625df..d429b08de1 100644 --- a/test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs +++ b/test/FunctionalTests/CoreCLRTests/CoreCLRApplicationTestFixture.cs @@ -7,6 +7,15 @@ namespace FunctionalTests { public class CoreCLRApplicationTestFixture : 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) { @@ -17,6 +26,6 @@ namespace FunctionalTests { } - protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.CoreClr); + protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.CoreClr, TargetFramework); } } diff --git a/test/FunctionalTests/PublishForRidTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/PublishForRidTest_CoreCLR.cs similarity index 88% rename from test/FunctionalTests/PublishForRidTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/PublishForRidTest_CoreCLR.cs index fdbdcc96cd..48dec3c965 100644 --- a/test/FunctionalTests/PublishForRidTest_CoreCLR.cs +++ b/test/FunctionalTests/CoreCLRTests/PublishForRidTest_CoreCLR.cs @@ -29,10 +29,17 @@ namespace FunctionalTests var applicationName = nameof(SimpleApp); var applicationPath = ApplicationPaths.GetTestAppDirectory(applicationName); var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters( - applicationPath, - applicationName, - RuntimeFlavor.CoreClr); - + applicationPath, + applicationName, + RuntimeFlavor.CoreClr, +#if NETCOREAPP2_0 + "netcoreapp2.0"); +#elif NETCOREAPP2_1 + "netcoreapp2.1"); +#else +#error Target frameworks need to be updated +#endif + // Deploy for a rid that does not exist on the current platform. if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -49,7 +56,7 @@ namespace FunctionalTests // Act var expectedFile = Path.Combine( - deploymentParameters.PublishedApplicationRootPath, + deploymentParameters.PublishedApplicationRootPath, $"{applicationName}.PrecompiledViews.dll"); Assert.True(File.Exists(expectedFile), $"Expected precompiled file {expectedFile} does not exist."); } @@ -57,7 +64,7 @@ namespace FunctionalTests private class DotNetPublishDeployer : ApplicationDeployer { - public DotNetPublishDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory) + public DotNetPublishDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory) : base(deploymentParameters, loggerFactory) { } diff --git a/test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/PublishWithDebugTest_CoreCLR.cs similarity index 81% rename from test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/PublishWithDebugTest_CoreCLR.cs index ca8658e8cf..c66e4b68a5 100644 --- a/test/FunctionalTests/PublishWithDebugTest_CoreCLR.cs +++ b/test/FunctionalTests/CoreCLRTests/PublishWithDebugTest_CoreCLR.cs @@ -1,6 +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.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging.Testing; @@ -30,18 +31,19 @@ namespace FunctionalTests // 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); + var expected = Path.Combine(deployment.ContentRoot, $"{Fixture.ApplicationName}.PrecompiledViews.dll"); + Assert.True(File.Exists(expected), $"File {expected} does not exist."); } } public class TestFixture : CoreCLRApplicationTestFixture { + public TestFixture() + { + PublishOnly = true; + } + protected override DeploymentParameters GetDeploymentParameters() { var deploymentParameters = base.GetDeploymentParameters(); diff --git a/test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs diff --git a/test/FunctionalTests/RazorPagesAppTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/RazorPagesAppTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/RazorPagesAppTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/RazorPagesAppTest_CoreCLR.cs diff --git a/test/FunctionalTests/SimpleAppTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/SimpleAppTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs diff --git a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs diff --git a/test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/StrongNamedAppTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/StrongNamedAppTest_CoreCLR.cs diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/ViewCompilationOptionsTest_CoreCLR.cs similarity index 100% rename from test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs rename to test/FunctionalTests/CoreCLRTests/ViewCompilationOptionsTest_CoreCLR.cs diff --git a/test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationConsumingPrecompiledViews_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationConsumingPrecompiledViews_Desktop.cs diff --git a/test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationUsingRelativePathsTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationUsingRelativePathsTest_Desktop.cs diff --git a/test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationWithConfigureMvcTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationWithConfigureMvcTest_Desktop.cs diff --git a/test/FunctionalTests/ApplicationWithCustomInputFilesTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationWithCustomInputFilesTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithCustomInputFilesTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationWithCustomInputFilesTest_Desktop.cs diff --git a/test/FunctionalTests/ApplicationWithParseErrorsTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationWithParseErrorsTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithParseErrorsTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationWithParseErrorsTest_Desktop.cs diff --git a/test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ApplicationWithTagHelpersTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ApplicationWithTagHelpersTest_Desktop.cs diff --git a/test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs b/test/FunctionalTests/DesktopTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/CopyBuildOutputToPublishDirectoryTest_Desktop.cs diff --git a/test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs b/test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs diff --git a/test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs b/test/FunctionalTests/DesktopTests/DesktopApplicationTestFixture.cs similarity index 90% rename from test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs rename to test/FunctionalTests/DesktopTests/DesktopApplicationTestFixture.cs index 7e3579a017..a95dc59e7f 100644 --- a/test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs +++ b/test/FunctionalTests/DesktopTests/DesktopApplicationTestFixture.cs @@ -17,6 +17,6 @@ namespace FunctionalTests { } - protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.Clr); + protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.Clr, "net461"); } } diff --git a/test/FunctionalTests/PublishWithDebugTest_Desktop.cs b/test/FunctionalTests/DesktopTests/PublishWithDebugTest_Desktop.cs similarity index 79% rename from test/FunctionalTests/PublishWithDebugTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/PublishWithDebugTest_Desktop.cs index 22c940ddbd..0bc3ddb6ae 100644 --- a/test/FunctionalTests/PublishWithDebugTest_Desktop.cs +++ b/test/FunctionalTests/DesktopTests/PublishWithDebugTest_Desktop.cs @@ -1,6 +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.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; @@ -26,6 +27,7 @@ namespace FunctionalTests public ApplicationTestFixture Fixture { get; } [ConditionalFact] + [Fact] public async Task PublishingInDebugWorks() { using (StartLog(out var loggerFactory)) @@ -33,18 +35,19 @@ namespace FunctionalTests // 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); + var expected = Path.Combine(deployment.ContentRoot, $"{Fixture.ApplicationName}.PrecompiledViews.dll"); + Assert.True(File.Exists(expected), $"File {expected} does not exist."); } } - public class TestFixture : DesktopApplicationTestFixture + public class TestFixture : CoreCLRApplicationTestFixture { + public TestFixture() + { + PublishOnly = true; + } + protected override DeploymentParameters GetDeploymentParameters() { var deploymentParameters = base.GetDeploymentParameters(); diff --git a/test/FunctionalTests/PublishWithEmbedViewSourcesTest_Desktop.cs b/test/FunctionalTests/DesktopTests/PublishWithEmbedViewSourcesTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/PublishWithEmbedViewSourcesTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/PublishWithEmbedViewSourcesTest_Desktop.cs diff --git a/test/FunctionalTests/RazorPagesAppTest_Desktop.cs b/test/FunctionalTests/DesktopTests/RazorPagesAppTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/RazorPagesAppTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/RazorPagesAppTest_Desktop.cs diff --git a/test/FunctionalTests/SimpleAppTest_Desktop.cs b/test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/SimpleAppTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs diff --git a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs b/test/FunctionalTests/DesktopTests/SimpleAppWithAssemblyRenameTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/SimpleAppWithAssemblyRenameTest_Desktop.cs diff --git a/test/FunctionalTests/StrongNamedAppTest_Desktop.cs b/test/FunctionalTests/DesktopTests/StrongNamedAppTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/StrongNamedAppTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/StrongNamedAppTest_Desktop.cs diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs b/test/FunctionalTests/DesktopTests/ViewCompilationOptionsTest_Desktop.cs similarity index 100% rename from test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs rename to test/FunctionalTests/DesktopTests/ViewCompilationOptionsTest_Desktop.cs diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 29ab9c4118..2ea5cec310 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -1,15 +1,21 @@  - netcoreapp2.0 + netcoreapp2.1 + $(TargetFrameworks);netcoreapp2.0 + $(DefineConstants);__remove_this_to__GENERATE_BASELINES $(DefineConstants);GENERATE_BASELINES false false + false + + + diff --git a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 051f4cf2b6..56e988e05f 100644 --- a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging; @@ -12,7 +13,7 @@ namespace FunctionalTests public abstract class ApplicationTestFixture : IDisposable { private const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; - private readonly object _deploymentLock = new object(); + private static readonly SemaphoreSlim _deploymentLock = new SemaphoreSlim(initialCount: 1); private Task _deploymentTask; private IApplicationDeployer _deployer; @@ -30,14 +31,20 @@ namespace FunctionalTests protected abstract DeploymentParameters GetDeploymentParameters(); - protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) - => GetDeploymentParameters(ApplicationPath, ApplicationName, flavor); + protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor, string targetFramework) + => GetDeploymentParameters(ApplicationPath, ApplicationName, flavor, targetFramework); - public static DeploymentParameters GetDeploymentParameters(string applicationPath, string applicationName, RuntimeFlavor flavor) + public static DeploymentParameters GetDeploymentParameters(string applicationPath, string applicationName, RuntimeFlavor flavor, string targetFramework) { - var telemetryOptOut = new KeyValuePair( - DotnetCLITelemetryOptOut, - "1"); + // 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, @@ -47,16 +54,18 @@ namespace FunctionalTests { ApplicationName = applicationName, PublishApplicationBeforeDeployment = true, - TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0", Configuration = "Release", EnvironmentVariables = { - telemetryOptOut, + new KeyValuePair(DotnetCLITelemetryOptOut, "1"), + new KeyValuePair("SolutionConfiguration", projectConfiguration), }, PublishEnvironmentVariables = { - telemetryOptOut, + new KeyValuePair(DotnetCLITelemetryOptOut, "1"), + new KeyValuePair("SolutionConfiguration", projectConfiguration), }, + TargetFramework = targetFramework, }; return deploymentParameters; @@ -74,8 +83,9 @@ namespace FunctionalTests public async Task CreateDeploymentAsync(ILoggerFactory loggerFactory) { - lock (_deploymentLock) + try { + await _deploymentLock.WaitAsync(TimeSpan.FromSeconds(10)); if (_deploymentTask == null) { var deploymentParameters = GetDeploymentParameters(); @@ -91,6 +101,10 @@ namespace FunctionalTests _deploymentTask = _deployer.DeployAsync(); } } + finally + { + _deploymentLock.Release(); + } return await _deploymentTask; } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj index 74c0b9d161..06337dac6a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestTfms) diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index 9478314e47..631f5900b1 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) ..\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index 85a0a8df38..f330f2386d 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index 4aee9fb627..f27f45283b 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true $(DefineConstants);TEST123 diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index 95c4f130ad..f9904ee766 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true true diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 85a0a8df38..f330f2386d 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index c6c8b6e41c..d86ac254e6 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index f536697188..309df3008e 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -1,8 +1,7 @@  - netstandard2.0;net461 - netstandard2.0 + netstandard2.0 diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index 4ba7c2f5c3..b0e5e2f417 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -1,14 +1,14 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) obj\precompiled\$(TargetFramework) true + diff --git a/testapps/Directory.Build.props b/testapps/Directory.Build.props index 0094c38ae4..35e9c46835 100644 --- a/testapps/Directory.Build.props +++ b/testapps/Directory.Build.props @@ -1,6 +1,13 @@ + + netcoreapp2.1 + $(DeveloperBuildTestAppTfms) + netcoreapp2.1;netcoreapp2.0 + $(StandardTestAppTfms);net461 + + 1.0.0 diff --git a/testapps/Directory.Build.targets b/testapps/Directory.Build.targets index a56638ed5c..4b805513d6 100644 --- a/testapps/Directory.Build.targets +++ b/testapps/Directory.Build.targets @@ -4,23 +4,20 @@ <_MvcViewCompilationAddDesktopReferences>false $(MvcRazorCompileOnPublish) - <_MvcViewCompilationTasksPath>$(MSBuildThisFileDirectory)..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\bin\$(Configuration)\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll + $(Configuration) + <_MvcViewCompilationTasksPath>$(MSBuildThisFileDirectory)..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\bin\$(SolutionConfiguration)\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll - - - - - <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll - <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='net461'">$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe + <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'!='net461'">$(MSBuildThisFileDirectory)..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\bin\$(SolutionConfiguration)\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll + <_MvcViewCompilationBinaryPath Condition="'$(TargetFramework)'=='net461'">$(MSBuildThisFileDirectory)..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\bin\$(SolutionConfiguration)\net461\win7-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index 9f3dc47490..1362dd84ec 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true true diff --git a/testapps/RazorPagesApp/RazorPagesApp.csproj b/testapps/RazorPagesApp/RazorPagesApp.csproj index 9c7c5ab6b0..5ab7219211 100644 --- a/testapps/RazorPagesApp/RazorPagesApp.csproj +++ b/testapps/RazorPagesApp/RazorPagesApp.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index f5f65c45ca..f57d869aeb 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) win7-x86;debian-x64 true diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index bee405d99b..1a8db3562d 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -2,8 +2,7 @@ NewAssemblyName - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index d72479411d..9691746590 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestAppTfms) true true true From ed1eb295fbaf33816416f01a0ba0549926452a30 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 17 Nov 2017 13:00:26 -0800 Subject: [PATCH 211/295] Use MicrosoftNETCoreApp21PackageVersion to determine the runtime framework in netcoreapp2.1 --- Directory.Build.targets | 1 + build/dependencies.props | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index e83ff95e39..894b1d0cf8 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,6 @@  $(MicrosoftNETCoreApp20PackageVersion) + $(MicrosoftNETCoreApp21PackageVersion) diff --git a/build/dependencies.props b/build/dependencies.props index 775eb2d4d9..52c69ad9af 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,4 +1,4 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) @@ -19,6 +19,7 @@ 2.1.0-preview1-27579 2.1.0-preview1-27579 2.0.0 + 2.1.0-preview1-25907-02 15.3.0 2.3.0 2.3.0 From c869c47acfc59ab5e7cec7e7677d497bcf927662 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 21 Nov 2017 15:48:34 -0800 Subject: [PATCH 212/295] Replace aspnetcore-ci-dev feed with aspnetcore-dev --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- sources.props | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 sources.props diff --git a/build/dependencies.props b/build/dependencies.props index 52c69ad9af..b1e597873f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,23 +1,23 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15551 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 0.5.0-preview1-27498 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 + 2.1.0-preview1-15576 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 0.5.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 15.3.409 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 - 2.1.0-preview1-27579 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 2.0.0 2.1.0-preview1-25907-02 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 95f4613014..1a99066b7c 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15567 -commithash:903e3104807b1bb8cddd28bdef205b1e2dc021d1 +version:2.1.0-preview1-15576 +commithash:2f3856d2ba4f659fcb9253215b83946a06794a27 diff --git a/sources.props b/sources.props new file mode 100644 index 0000000000..9feff29d09 --- /dev/null +++ b/sources.props @@ -0,0 +1,16 @@ + + + + + $(DotNetRestoreSources) + + $(RestoreSources); + https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + + + From d457fec2cfbaad5b8485daa27071ca8d3c3b0022 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 29 Nov 2017 14:09:28 -0800 Subject: [PATCH 213/295] Specify runtime versions to install --- build/repo.props | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/repo.props b/build/repo.props index b55e651b87..b9d5f0e363 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,7 +1,14 @@  + + Internal.AspNetCore.Universe.Lineup https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json + + + + + From 6414cf0f23f559275848cd2ebaae2d4ff931d86d Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 29 Nov 2017 15:54:14 -0800 Subject: [PATCH 214/295] Use sources.props --- Directory.Build.props | 1 + NuGet.config | 3 --- sources.props => build/sources.props | 0 korebuild-lock.txt | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) rename sources.props => build/sources.props (100%) diff --git a/Directory.Build.props b/Directory.Build.props index 3ecf4afdd9..64f6af34d3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,6 +5,7 @@ + Microsoft ASP.NET Core diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..4bb3170917 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,8 +2,5 @@ - - - diff --git a/sources.props b/build/sources.props similarity index 100% rename from sources.props rename to build/sources.props diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 1a99066b7c..d8f6912caa 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15576 -commithash:2f3856d2ba4f659fcb9253215b83946a06794a27 +version:2.1.0-preview1-15616 +commithash:ef83157a1e36c3efd0dd8498cde92611a64c34cc From b4a6283d5694353b0f85ff4eda163fa69c324504 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 1 Dec 2017 10:26:06 -0800 Subject: [PATCH 215/295] Update bootstrappers --- run.ps1 | 17 +++++++++++------ run.sh | 30 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/run.ps1 b/run.ps1 index 49c2899856..27dcf848f8 100644 --- a/run.ps1 +++ b/run.ps1 @@ -29,6 +29,9 @@ Updates KoreBuild to the latest version even if a lock file is present. .PARAMETER ConfigFile The path to the configuration file that stores values. Defaults to korebuild.json. +.PARAMETER ToolsSourceSuffix +The Suffix to append to the end of the ToolsSource. Useful for query strings in blob stores. + .PARAMETER Arguments Arguments to be passed to the command @@ -51,7 +54,7 @@ Example config file: #> [CmdletBinding(PositionalBinding = $false)] param( - [Parameter(Mandatory=$true, Position = 0)] + [Parameter(Mandatory = $true, Position = 0)] [string]$Command, [string]$Path = $PSScriptRoot, [Alias('c')] @@ -63,6 +66,7 @@ param( [Alias('u')] [switch]$Update, [string]$ConfigFile, + [string]$ToolsSourceSuffix, [Parameter(ValueFromRemainingArguments = $true)] [string[]]$Arguments ) @@ -79,7 +83,7 @@ function Get-KoreBuild { $lockFile = Join-Path $Path 'korebuild-lock.txt' if (!(Test-Path $lockFile) -or $Update) { - Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile $ToolsSourceSuffix } $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 @@ -96,7 +100,7 @@ function Get-KoreBuild { try { $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" - Get-RemoteFile $remotePath $tmpfile + Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { # Use built-in commands where possible as they are cross-plat compatible Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath @@ -124,7 +128,7 @@ function Join-Paths([string]$path, [string[]]$childPaths) { return $path } -function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath, [string]$RemoteSuffix) { if ($RemotePath -notlike 'http*') { Copy-Item $RemotePath $LocalPath return @@ -134,7 +138,7 @@ function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { while ($retries -gt 0) { $retries -= 1 try { - Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + Invoke-WebRequest -UseBasicParsing -Uri $($RemotePath + $RemoteSuffix) -OutFile $LocalPath return } catch { @@ -161,7 +165,8 @@ if (Test-Path $ConfigFile) { if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} } - } catch { + } + catch { Write-Warning "$ConfigFile could not be read. Its settings will be ignored." Write-Warning $Error[0] } diff --git a/run.sh b/run.sh index c278423acc..834961fc3a 100755 --- a/run.sh +++ b/run.sh @@ -17,6 +17,7 @@ update=false repo_path="$DIR" channel='' tools_source='' +tools_source_suffix='' # # Functions @@ -29,13 +30,14 @@ __usage() { echo " ... Arguments passed to the command. Variable number of arguments allowed." echo "" echo "Options:" - echo " --verbose Show verbose output." - echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." - echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." - echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." - echo " --path The directory to build. Defaults to the directory containing the script." - echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." - echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." + echo " --tools-source-suffix|-ToolsSourceSuffix The suffix to append to tools-source. Useful for query strings." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." echo "" echo "Description:" echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." @@ -50,7 +52,7 @@ get_korebuild() { local version local lock_file="$repo_path/korebuild-lock.txt" if [ ! -f "$lock_file" ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" "$tools_source_suffix" fi version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then @@ -66,7 +68,7 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file "$remote_path" "$tmpfile"; then + if __get_remote_file "$remote_path" "$tmpfile" "$tools_source_suffix"; then unzip -q -d "$korebuild_path" "$tmpfile" fi rm "$tmpfile" || true @@ -98,6 +100,7 @@ __machine_has() { __get_remote_file() { local remote_path=$1 local local_path=$2 + local remote_path_suffix=$3 if [[ "$remote_path" != 'http'* ]]; then cp "$remote_path" "$local_path" @@ -106,14 +109,14 @@ __get_remote_file() { local failed=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + wget --tries 10 --quiet -O "$local_path" "${remote_path}${remote_path_suffix}" || failed=true else failed=true fi if [ "$failed" = true ] && __machine_has curl; then failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "${remote_path}${remote_path_suffix}" || failed=true fi if [ "$failed" = true ]; then @@ -164,6 +167,11 @@ while [[ $# -gt 0 ]]; do tools_source="${1:-}" [ -z "$tools_source" ] && __usage ;; + --tools-source-suffix|-ToolsSourceSuffix) + shift + tools_source_suffix="${1:-}" + [ -z "$tools_source_suffix" ] && __usage + ;; -u|--update|-Update) update=true ;; From e6a2f6811ce7a0abd9c605b450e52f7b2440915b Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 4 Dec 2017 15:05:56 -0800 Subject: [PATCH 216/295] LinepuePackageRestoreSource to aspnetcore-dev --- build/repo.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/repo.props b/build/repo.props index b9d5f0e363..78b0ce5879 100644 --- a/build/repo.props +++ b/build/repo.props @@ -4,7 +4,7 @@ Internal.AspNetCore.Universe.Lineup - https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json + https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json From f510e7034000e346f6771197d30aaf791ce2bf48 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 6 Dec 2017 16:22:12 -0800 Subject: [PATCH 217/295] Bump version to 2.0.2 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index b68865a1af..aeff39fd62 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@ - 2.0.1 + 2.0.2 rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final From d765737685b8410ff4574a7c3fd29493000ee7b5 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 10 Dec 2017 13:33:50 -0800 Subject: [PATCH 218/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 34 +++++++++++++++++----------------- korebuild-lock.txt | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index b1e597873f..5a92db8c25 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,26 +3,26 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15576 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 0.5.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 + 2.1.0-preview1-15618 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 0.5.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 15.3.409 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 2.0.0 - 2.1.0-preview1-25907-02 + 2.1.0-preview1-25915-01 15.3.0 - 2.3.0 - 2.3.0 + 2.3.1 + 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index d8f6912caa..e7cce93009 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15616 -commithash:ef83157a1e36c3efd0dd8498cde92611a64c34cc +version:2.1.0-preview1-15618 +commithash:00ce1383114015fe89b221146036e59e6bc11219 From 62819b4abc94bafbf090387c62fb3fbcca07e0ca Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 11 Dec 2017 10:48:33 -0800 Subject: [PATCH 219/295] Skip tests failing on the CI --- .../CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs | 2 +- test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs | 6 +++--- .../CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs | 2 +- test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs index bb55c6e838..d4ab88d0d4 100644 --- a/test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs +++ b/test/FunctionalTests/CoreCLRTests/CopyOutputSymbolsToPublishDirectoryTest_CoreCLR.cs @@ -24,7 +24,7 @@ namespace FunctionalTests public ApplicationTestFixture Fixture { get; } - [Fact] + [Fact(Skip = "Unblocking the build: https://github.com/aspnet/MvcPrecompilation/issues/225")] public async Task PublishingWithOption_SkipsPublishingPdb() { using (StartLog(out var loggerFactory)) diff --git a/test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs b/test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs index da7756d3c9..c7affc3b10 100644 --- a/test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs +++ b/test/FunctionalTests/CoreCLRTests/SimpleAppTest_CoreCLR.cs @@ -22,7 +22,7 @@ namespace FunctionalTests public ApplicationTestFixture Fixture { get; } - [Fact] + [Fact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_WorksForSimpleApps() { using (StartLog(out var loggerFactory)) @@ -40,7 +40,7 @@ namespace FunctionalTests } } - [Fact] + [Fact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() { using (StartLog(out var loggerFactory)) @@ -53,7 +53,7 @@ namespace FunctionalTests } } - [Fact] + [Fact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_PublishesPdbsToOutputDirectory() { using (StartLog(out var loggerFactory)) diff --git a/test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs b/test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs index 1152834603..d01e5d9e88 100644 --- a/test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs +++ b/test/FunctionalTests/DesktopTests/CopyOutputSymbolsToPublishDirectoryTest_Desktop.cs @@ -27,7 +27,7 @@ namespace FunctionalTests public ApplicationTestFixture Fixture { get; } - [ConditionalFact] + [ConditionalFact(Skip = "Unblocking the build: https://github.com/aspnet/MvcPrecompilation/issues/225")] public async Task PublishingWithOption_SkipsPublishingPdb() { using (StartLog(out var loggerFactory)) diff --git a/test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs b/test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs index 2961f5479c..db24e47c25 100644 --- a/test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs +++ b/test/FunctionalTests/DesktopTests/SimpleAppTest_Desktop.cs @@ -25,7 +25,7 @@ namespace FunctionalTests public ApplicationTestFixture Fixture { get; } - [ConditionalFact] + [ConditionalFact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_WorksForSimpleApps() { using (StartLog(out var loggerFactory)) @@ -43,7 +43,7 @@ namespace FunctionalTests } } - [ConditionalFact] + [ConditionalFact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() { using (StartLog(out var loggerFactory)) @@ -56,7 +56,7 @@ namespace FunctionalTests } } - [ConditionalFact] + [ConditionalFact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")] public async Task Precompilation_PublishesPdbsToOutputDirectory() { using (StartLog(out var loggerFactory)) From c925897dde39650309df5d1e9386b67043cbf8d8 Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Mon, 11 Dec 2017 12:06:33 -0800 Subject: [PATCH 220/295] Create .github/ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPALTE.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPALTE.md diff --git a/.github/ISSUE_TEMPALTE.md b/.github/ISSUE_TEMPALTE.md new file mode 100644 index 0000000000..180f5abcfa --- /dev/null +++ b/.github/ISSUE_TEMPALTE.md @@ -0,0 +1 @@ +This repo is OBSOLETE - please see the README file for information From 14892d4fbc88bbe7932a78563e7ee97af88e8a0e Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Mon, 11 Dec 2017 13:14:54 -0800 Subject: [PATCH 221/295] Created PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..180f5abcfa --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +This repo is OBSOLETE - please see the README file for information From 4f8db67cdd3642beef1420163bfc9e8100d5d2d4 Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Tue, 12 Dec 2017 09:14:52 -0800 Subject: [PATCH 222/295] Updated the readme.md file with obsolete details --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b43697d2..9097fce9a0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ -ASP.NET Core MVC Precompilation + ASP.NET Core MVC Precompilation (obsolete) === +## Obsolete +We are planning to release a new feature from the aspnet/Razor repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look here [![here](https://github.com/aspnet/Razor/issues/1740)]. + + 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) From f2069e5ae5d23390b9ff1bf1f049aceec9636afd Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Tue, 12 Dec 2017 09:16:05 -0800 Subject: [PATCH 223/295] Fixed the link to the replacement feature. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9097fce9a0..6f3637d213 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ === ## Obsolete -We are planning to release a new feature from the aspnet/Razor repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look here [![here](https://github.com/aspnet/Razor/issues/1740)]. +We are planning to release a new feature from the aspnet/Razor repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look [here](https://github.com/aspnet/Razor/issues/1740). AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/jx955ph2045dw1w0/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/mvcprecompilation/branch/dev) From 358506f7bbcdaefe079b413b15ea4a315f0aadca Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Tue, 12 Dec 2017 12:08:02 -0800 Subject: [PATCH 224/295] Changed the aspnet/Razor phare to be a link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f3637d213..c47f9c9afd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ === ## Obsolete -We are planning to release a new feature from the aspnet/Razor repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look [here](https://github.com/aspnet/Razor/issues/1740). +We are planning to release a new feature from the [aspnet/Razor](https://github.com/aspnet/razor) repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look [here](https://github.com/aspnet/Razor/issues/1740). AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/jx955ph2045dw1w0/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/mvcprecompilation/branch/dev) From f1ead21db7e9287a7d3006a6911f46806ff80336 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Wed, 13 Dec 2017 21:30:12 +0000 Subject: [PATCH 225/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 5a92db8c25..766a0bc082 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,23 +3,23 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15618 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 0.5.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 + 2.1.0-preview1-15626 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 0.5.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 15.3.409 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 2.0.0 - 2.1.0-preview1-25915-01 + 2.1.0-preview1-26008-01 15.3.0 2.3.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index e7cce93009..8d52a6128c 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15618 -commithash:00ce1383114015fe89b221146036e59e6bc11219 +version:2.1.0-preview1-15626 +commithash:fd6410e9c90c428bc01238372303ad09cb9ec889 From abce0227a3bd83d3cd4e94f3a31a4b2000a7de35 Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Wed, 13 Dec 2017 13:34:04 -0800 Subject: [PATCH 226/295] Updated the readme file to reflect the PR feedback --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c47f9c9afd..49eca511c4 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ - ASP.NET Core MVC Precompilation (obsolete) + +ASP.NET Core MVC Precompilation === -## Obsolete -We are planning to release a new feature from the [aspnet/Razor](https://github.com/aspnet/razor) repo, which would cover the scenarios provided by the tools in this repo. As a result, this repo is now obsolete. If you'd like to learn more about the new feature we will be replacing this with, please look [here](https://github.com/aspnet/Razor/issues/1740). - +## 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) From 94a85a5622015d308c83fbe130f9c3c3012bf6a4 Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Wed, 13 Dec 2017 13:36:28 -0800 Subject: [PATCH 227/295] Tweaked the content of ISSUE_Template file. --- .github/ISSUE_TEMPALTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPALTE.md b/.github/ISSUE_TEMPALTE.md index 180f5abcfa..953206f0ec 100644 --- a/.github/ISSUE_TEMPALTE.md +++ b/.github/ISSUE_TEMPALTE.md @@ -1 +1 @@ -This repo is OBSOLETE - please see the README file for information +## 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. From 978571a2768130622d3e043cfa6886cfed63bf9a Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Wed, 13 Dec 2017 13:37:13 -0800 Subject: [PATCH 228/295] Removed the "bold" text --- .github/ISSUE_TEMPALTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPALTE.md b/.github/ISSUE_TEMPALTE.md index 953206f0ec..37655ead71 100644 --- a/.github/ISSUE_TEMPALTE.md +++ b/.github/ISSUE_TEMPALTE.md @@ -1 +1 @@ -## 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. +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. From 6a10d620e4b819e099c2fad6b6f6250ab8e931bb Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan <34246760+mkArtakMSFT@users.noreply.github.com> Date: Wed, 13 Dec 2017 13:37:36 -0800 Subject: [PATCH 229/295] Updated the file content --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 180f5abcfa..37655ead71 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1 +1 @@ -This repo is OBSOLETE - please see the README file for information +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. From 34c9d5f03bc7d0a22ecde448aac8fe39cbc814bc Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Mon, 18 Dec 2017 17:43:24 -0800 Subject: [PATCH 230/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 766a0bc082..a1e53c39d2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,22 +4,22 @@ 2.1.0-preview1-15626 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 0.5.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 0.5.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 15.3.409 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 2.0.0 - 2.1.0-preview1-26008-01 + 2.1.0-preview1-26016-05 15.3.0 2.3.1 2.3.1 From a366dd916554bfea47c7a7bb870ae5fca5f092ff Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 31 Dec 2017 21:45:55 +0000 Subject: [PATCH 231/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index a1e53c39d2..1e98f8455c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,21 +3,21 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15626 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 0.5.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 + 2.1.0-preview1-15651 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 0.5.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 15.3.409 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 2.0.0 2.1.0-preview1-26016-05 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 8d52a6128c..7c2e97aa79 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15626 -commithash:fd6410e9c90c428bc01238372303ad09cb9ec889 +version:2.1.0-preview1-15651 +commithash:ebf2365121c2c6a6a0fbfa9b0f37bb5effc89323 From 64cb5d065f8b28a4400ec28e4c071eed9a3203bd Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 2 Jan 2018 13:46:46 -0800 Subject: [PATCH 232/295] Skip tests until we can get back to cleaning up the repo --- build/repo.props | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/repo.props b/build/repo.props index 78b0ce5879..9ca6e06bcd 100644 --- a/build/repo.props +++ b/build/repo.props @@ -7,6 +7,10 @@ https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json + + + + From 5bf6f2a194274a866e286de37817b486af3e3d23 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Thu, 4 Jan 2018 01:53:32 +0000 Subject: [PATCH 233/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 1e98f8455c..2758baf7ba 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 2.1.0-preview1-15651 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 0.5.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 0.5.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 15.3.409 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 2.0.0 2.1.0-preview1-26016-05 15.3.0 From fd83fd399f7be86c857406e97638ce9871013ddd Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sat, 6 Jan 2018 15:26:19 -0800 Subject: [PATCH 234/295] Update dependencies.props [auto-updated: dependencies] --- korebuild-lock.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 7c2e97aa79..2146d006d7 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15651 -commithash:ebf2365121c2c6a6a0fbfa9b0f37bb5effc89323 +version:2.1.0-preview1-15661 +commithash:c9349d4c8a495d3085d9b879214d80f2f45e2193 From c3dedd9feb689a9792c10938ff438045c3d4efc1 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Sat, 13 Jan 2018 12:06:00 -0800 Subject: [PATCH 235/295] update deps --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 2758baf7ba..0ba9617c8d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,23 +3,23 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15651 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 0.5.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 + 2.1.0-preview1-15670 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 0.5.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 15.3.409 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 + 2.1.0-preview1-28072 2.0.0 - 2.1.0-preview1-26016-05 + 2.1.0-preview1-26102-01 15.3.0 2.3.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 2146d006d7..181b38dcfe 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15661 -commithash:c9349d4c8a495d3085d9b879214d80f2f45e2193 +version:2.1.0-preview1-15670 +commithash:49176144e03c3015d83b21e3f1d0ce093c05ecc3 From d686acad871fccda5e3bae19d02db4db22e99501 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Sat, 13 Jan 2018 18:24:50 -0800 Subject: [PATCH 236/295] Avoid use of AssemblyQualifiedName in tests The type name generated by Razor is an implementation detail and shouldn't be used in tests outside of the Razor repo. Testing that the assembly name is correct should be enough to validate what we need for these tests. --- ...ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt | 2 +- .../Resources/ApplicationUsingRelativePaths.Home.About.txt | 2 +- .../Resources/ApplicationUsingRelativePaths.Home.Index.txt | 2 +- .../Resources/ApplicationWithConfigureMvc.Home.Index.txt | 2 +- .../ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt | 4 ++-- .../ApplicationWithTagHelpers.Home.LocalTagHelper.txt | 4 ++-- test/FunctionalTests/Resources/SimpleAppTest.Home.Index.txt | 4 ++-- .../Resources/SimpleAppWithAssemblyRenameTest.Home.Index.txt | 2 +- test/FunctionalTests/Resources/StrongNamedApp.Home.Index.txt | 2 +- .../ApplicationUsingRelativePaths/Views/Home/Index.cshtml | 2 +- testapps/ApplicationWithConfigureMvc/Views/Home/Index.cshtml | 2 +- .../Views/Home/ClassLibraryTagHelper.cshtml | 2 +- .../Views/Home/LocalTagHelper.cshtml | 2 +- .../ApplicationWithTagHelpers/Views/Shared/_Layout.cshtml | 2 +- .../Areas/Manage/Views/Shared/_Layout.cshtml | 2 +- testapps/SimpleApp/Views/Home/Index.cshtml | 2 +- testapps/SimpleApp/Views/Shared/_Layout.cshtml | 2 +- testapps/SimpleAppWithAssemblyRename/Views/Home/Index.cshtml | 2 +- testapps/StrongNamedApp/Views/Home/Index.cshtml | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt b/test/FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt index a0e0cd1b3b..e4baad155e 100644 --- a/test/FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt +++ b/test/FunctionalTests/Resources/ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt @@ -1,7 +1,7 @@ - AspNetCore._Areas_Manage_Views_Shared__Layout_cshtml, ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Admin home page

diff --git a/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.About.txt b/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.About.txt index 29277b2c98..c3b073162c 100644 --- a/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.About.txt +++ b/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.About.txt @@ -2,7 +2,7 @@ -AspNetCore._Views_Home_Index_cshtml, ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Hello from Index! \ No newline at end of file diff --git a/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.Index.txt b/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.Index.txt index 29277b2c98..c3b073162c 100644 --- a/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.Index.txt +++ b/test/FunctionalTests/Resources/ApplicationUsingRelativePaths.Home.Index.txt @@ -2,7 +2,7 @@ -AspNetCore._Views_Home_Index_cshtml, ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Hello from Index! \ No newline at end of file diff --git a/test/FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt b/test/FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt index 8d6a706cbd..6ed3f16836 100644 --- a/test/FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt +++ b/test/FunctionalTests/Resources/ApplicationWithConfigureMvc.Home.Index.txt @@ -1,2 +1,2 @@ -AspNetCore._Views_Home_Index_cshtml, ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Hello world! \ No newline at end of file diff --git a/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt b/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt index 9e1587d4bb..f3a28a4d23 100644 --- a/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt +++ b/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt @@ -8,7 +8,7 @@
-AspNetCore._Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
To boldy tag that no one has ever tagged before...
@@ -20,6 +20,6 @@ AspNetCore._Views_Home_ClassLibraryTagHelper_cshtml, ApplicationWithTagHelpers.P
- AspNetCore._Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt b/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt index cda9d510a9..43afc098bd 100644 --- a/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt +++ b/test/FunctionalTests/Resources/ApplicationWithTagHelpers.Home.LocalTagHelper.txt @@ -8,7 +8,7 @@
-AspNetCore._Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null TestTagHelper content. @@ -20,6 +20,6 @@ AspNetCore._Views_Home_LocalTagHelper_cshtml, ApplicationWithTagHelpers.Precompi
- AspNetCore._Views_Shared__Layout_cshtml, ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/test/FunctionalTests/Resources/SimpleAppTest.Home.Index.txt b/test/FunctionalTests/Resources/SimpleAppTest.Home.Index.txt index 620d2a25d0..afba35a9ea 100644 --- a/test/FunctionalTests/Resources/SimpleAppTest.Home.Index.txt +++ b/test/FunctionalTests/Resources/SimpleAppTest.Home.Index.txt @@ -35,7 +35,7 @@
-AspNetCore._Views_Home_Index_cshtml, SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +SimpleApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null @RenderSection("scripts", required: false) - @GetType().AssemblyQualifiedName + @GetType().Assembly.FullName diff --git a/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml index 6578e0e81c..821a366557 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml +++ b/testapps/ClassLibraryWithPrecompiledViews/Areas/Manage/Views/Shared/_Layout.cshtml @@ -1,7 +1,7 @@  - @GetType().AssemblyQualifiedName + @GetType().Assembly.FullName @RenderBody() @RenderSection("TestSection") diff --git a/testapps/SimpleApp/Views/Home/Index.cshtml b/testapps/SimpleApp/Views/Home/Index.cshtml index de297ae049..e6b0e16e90 100644 --- a/testapps/SimpleApp/Views/Home/Index.cshtml +++ b/testapps/SimpleApp/Views/Home/Index.cshtml @@ -2,7 +2,7 @@ ViewData["Title"] = "Home Page"; } -@GetType().AssemblyQualifiedName +@GetType().Assembly.FullName