From 5b805bb12db3e47b380038cf6aa5d149f9f02421 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 13 Jan 2016 19:18:06 -0800 Subject: [PATCH] Updating to use cli Fixes #3908 --- .gitattributes | 2 + .gitignore | 2 + .travis.yml | 5 +- appveyor.yml | 2 +- build.cmd | 68 +++++++++---------- build.sh | 47 +++++++------ samples/ActionConstraintSample.Web/Startup.cs | 1 + .../ActionConstraintSample.Web/hosting.json | 3 - .../ActionConstraintSample.Web/project.json | 12 +++- samples/CustomRouteSample.Web/Startup.cs | 1 + samples/CustomRouteSample.Web/hosting.json | 3 - samples/CustomRouteSample.Web/project.json | 12 ++-- samples/EmbeddedViewSample.Web/Startup.cs | 1 + samples/EmbeddedViewSample.Web/hosting.json | 3 - samples/EmbeddedViewSample.Web/project.json | 12 ++-- samples/FormatFilterSample.Web/Startup.cs | 1 + samples/FormatFilterSample.Web/hosting.json | 3 - samples/FormatFilterSample.Web/project.json | 9 ++- samples/InlineConstraintSample.Web/Startup.cs | 1 + .../InlineConstraintSample.Web/hosting.json | 3 - .../InlineConstraintSample.Web/project.json | 12 ++-- samples/JsonPatchSample.Web/Startup.cs | 1 + samples/JsonPatchSample.Web/hosting.json | 3 - samples/JsonPatchSample.Web/project.json | 12 +++- samples/LocalizationSample.Web/Startup.cs | 1 + samples/LocalizationSample.Web/hosting.json | 3 - samples/LocalizationSample.Web/project.json | 12 ++-- samples/MvcSandbox/Startup.cs | 3 +- samples/MvcSandbox/hosting.json | 3 - samples/MvcSandbox/project.json | 9 ++- samples/MvcSubAreaSample.Web/Startup.cs | 1 + samples/MvcSubAreaSample.Web/hosting.json | 3 - samples/MvcSubAreaSample.Web/project.json | 9 ++- samples/TagHelperSample.Web/Startup.cs | 1 + samples/TagHelperSample.Web/hosting.json | 3 - samples/TagHelperSample.Web/project.json | 9 ++- samples/UrlHelperSample.Web/Startup.cs | 1 + samples/UrlHelperSample.Web/hosting.json | 3 - samples/UrlHelperSample.Web/project.json | 12 ++-- .../project.json | 4 +- .../DependencyContextAssemblyProvider.cs | 17 +++++ .../project.json | 1 + .../project.json | 4 +- .../project.json | 1 + .../project.json | 4 +- .../project.json | 1 + .../project.json | 4 +- .../DependencyContextCompilationService.cs | 25 ++----- ...dencyContextRazorViewEngineOptionsSetup.cs | 55 ++++++++------- .../RazorViewEngineOptionsSetup.cs | 21 ++++-- .../project.json | 1 + .../project.json | 1 + .../project.json | 4 +- .../project.json | 1 + src/Microsoft.AspNetCore.Mvc/project.json | 4 +- .../project.json | 14 +++- .../project.json | 14 +++- .../Filters/ResultFilterAttributeTest.cs | 3 +- .../DefaultAssemblyProviderTests.cs | 4 +- .../NonDisposableStreamTest.cs | 4 +- .../project.json | 15 +++- .../project.json | 14 +++- .../project.json | 14 +++- .../project.json | 14 +++- .../project.json | 14 +++- .../ActionConstraintSampleTest.cs | 4 +- .../CompilationOptionsTests.cs | 6 +- .../CustomRouteSampleTest.cs | 4 +- .../CustomUrlHelperTest.cs | 4 +- .../EmbeddedViewSampleTest.cs | 4 +- .../FormatFilterSampleTest.cs | 4 +- .../InlineConstraintSampleTest.cs | 4 +- .../JsonPatchSampleTest.cs | 4 +- .../LocalizationSampleTest.cs | 4 +- .../MvcEncodedTestFixtureOfT.cs | 4 +- .../MvcSampleFixture.cs | 13 ++++ .../MvcSandboxTest.cs | 4 +- .../MvcTestFixture.cs | 26 ++++--- .../RouteDataTest.cs | 3 - .../SubAreaTests.cs | 4 +- .../TagHelperSampleTest.cs | 4 +- .../project.json | 18 +++-- .../project.json | 15 +++- .../project.json | 14 +++- .../project.json | 14 +++- .../DefaultRoslynCompilationServiceTest.cs | 2 + .../Internal/ExpressionRewriterTest.cs | 15 +++- .../project.json | 17 +++-- .../project.json | 14 +++- .../MvcOptionsSetupTest.cs | 4 ++ .../MvcServiceCollectionExtensionsTest.cs | 26 +++++-- .../project.json | 18 +++-- .../project.json | 4 +- .../project.json | 4 +- .../project.json | 14 +++- .../project.json | 10 ++- test/WebSites/ApiExplorerWebSite/Startup.cs | 1 + test/WebSites/ApiExplorerWebSite/hosting.json | 3 - test/WebSites/ApiExplorerWebSite/project.json | 9 ++- .../ApplicationModelWebSite/Startup.cs | 1 + .../ApplicationModelWebSite/hosting.json | 3 - .../ApplicationModelWebSite/project.json | 9 ++- test/WebSites/BasicWebSite/Startup.cs | 8 ++- test/WebSites/BasicWebSite/hosting.json | 3 - test/WebSites/BasicWebSite/project.json | 9 ++- .../project.json | 9 ++- .../ControllersFromServicesWebSite/Startup.cs | 1 + .../hosting.json | 3 - .../project.json | 9 ++- test/WebSites/CorsWebSite/Startup.cs | 1 + test/WebSites/CorsWebSite/hosting.json | 3 - test/WebSites/CorsWebSite/project.json | 9 ++- .../ErrorPageMiddlewareWebSite/Startup.cs | 1 + .../ErrorPageMiddlewareWebSite/hosting.json | 3 - .../ErrorPageMiddlewareWebSite/project.json | 9 ++- test/WebSites/FilesWebSite/Startup.cs | 1 + test/WebSites/FilesWebSite/hosting.json | 3 - test/WebSites/FilesWebSite/project.json | 9 ++- test/WebSites/FiltersWebSite/Startup.cs | 1 + test/WebSites/FiltersWebSite/hosting.json | 3 - test/WebSites/FiltersWebSite/project.json | 9 ++- test/WebSites/FormatterWebSite/Startup.cs | 1 + test/WebSites/FormatterWebSite/hosting.json | 3 - test/WebSites/FormatterWebSite/project.json | 9 ++- .../WebSites/HtmlGenerationWebSite/Startup.cs | 1 + .../HtmlGenerationWebSite/hosting.json | 3 - .../HtmlGenerationWebSite/project.json | 9 ++- .../project.json | 23 ++++--- .../Startup.cs | 1 + .../hosting.json | 3 - .../project.json | 9 ++- .../Services/FrameworkSpecificHelper.cs | 10 +-- test/WebSites/RazorWebSite/Startup.cs | 5 +- .../_Partial.cshtml | 4 +- test/WebSites/RazorWebSite/hosting.json | 3 - test/WebSites/RazorWebSite/project.json | 10 +-- test/WebSites/RoutingWebSite/Startup.cs | 1 + test/WebSites/RoutingWebSite/hosting.json | 3 - test/WebSites/RoutingWebSite/project.json | 9 ++- test/WebSites/SimpleWebSite/Startup.cs | 1 + test/WebSites/SimpleWebSite/hosting.json | 3 - test/WebSites/SimpleWebSite/project.json | 9 ++- test/WebSites/TagHelpersWebSite/Startup.cs | 1 + test/WebSites/TagHelpersWebSite/hosting.json | 3 - test/WebSites/TagHelpersWebSite/project.json | 9 ++- test/WebSites/UserClassLibrary/project.json | 14 ++-- test/WebSites/VersioningWebSite/Startup.cs | 1 + test/WebSites/VersioningWebSite/hosting.json | 3 - test/WebSites/VersioningWebSite/project.json | 9 ++- .../WebApiCompatShimWebSite/Startup.cs | 1 + .../WebApiCompatShimWebSite/hosting.json | 3 - .../WebApiCompatShimWebSite/project.json | 9 ++- test/WebSites/XmlFormattersWebSite/Startup.cs | 1 + .../XmlFormattersWebSite/hosting.json | 3 - .../XmlFormattersWebSite/project.json | 6 +- 155 files changed, 702 insertions(+), 436 deletions(-) delete mode 100644 samples/ActionConstraintSample.Web/hosting.json delete mode 100644 samples/CustomRouteSample.Web/hosting.json delete mode 100644 samples/EmbeddedViewSample.Web/hosting.json delete mode 100644 samples/FormatFilterSample.Web/hosting.json delete mode 100644 samples/InlineConstraintSample.Web/hosting.json delete mode 100644 samples/JsonPatchSample.Web/hosting.json delete mode 100644 samples/LocalizationSample.Web/hosting.json delete mode 100644 samples/MvcSandbox/hosting.json delete mode 100644 samples/MvcSubAreaSample.Web/hosting.json delete mode 100644 samples/TagHelperSample.Web/hosting.json delete mode 100644 samples/UrlHelperSample.Web/hosting.json create mode 100644 test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSampleFixture.cs delete mode 100644 test/WebSites/ApiExplorerWebSite/hosting.json delete mode 100644 test/WebSites/ApplicationModelWebSite/hosting.json delete mode 100644 test/WebSites/BasicWebSite/hosting.json delete mode 100644 test/WebSites/ControllersFromServicesWebSite/hosting.json delete mode 100644 test/WebSites/CorsWebSite/hosting.json delete mode 100644 test/WebSites/ErrorPageMiddlewareWebSite/hosting.json delete mode 100644 test/WebSites/FilesWebSite/hosting.json delete mode 100644 test/WebSites/FiltersWebSite/hosting.json delete mode 100644 test/WebSites/FormatterWebSite/hosting.json delete mode 100644 test/WebSites/HtmlGenerationWebSite/hosting.json delete mode 100644 test/WebSites/RazorPageExecutionInstrumentationWebSite/hosting.json delete mode 100644 test/WebSites/RazorWebSite/hosting.json delete mode 100644 test/WebSites/RoutingWebSite/hosting.json delete mode 100644 test/WebSites/SimpleWebSite/hosting.json delete mode 100644 test/WebSites/TagHelpersWebSite/hosting.json delete mode 100644 test/WebSites/VersioningWebSite/hosting.json delete mode 100644 test/WebSites/WebApiCompatShimWebSite/hosting.json delete mode 100644 test/WebSites/XmlFormattersWebSite/hosting.json diff --git a/.gitattributes b/.gitattributes index bdaa5ba982..d4ee1cb7f3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -48,3 +48,5 @@ *.fsproj text=auto *.dbproj text=auto *.sln text=auto eol=crlf + +*.sh eol=lf diff --git a/.gitignore b/.gitignore index 648eae61cf..ca84ed6576 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ [Bb]in/ TestResults/ .nuget/ +.build/ +.testPublish/ *.sln.ide/ _ReSharper.*/ packages/ diff --git a/.travis.yml b/.travis.yml index 85e366978c..0c980749e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,11 @@ addons: - zlib1g before_install: - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install icu4c; fi -env: - - KOREBUILD_DNU_RESTORE_CORECLR=true MONO_THREADS_PER_CPU=2000 MONO_MANAGED_WATCHER=disabled KOREBUILD_TEST_DNXCORE=true NO_PARALLEL_TEST_PROJECTS=Microsoft.AspNetCore.Mvc.FunctionalTests mono: - 4.0.5 os: - linux - osx +osx_image: xcode7.1 script: - - ./build.sh --quiet verify + - ./build.sh --quiet verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 58a3e1bc22..636a7618d3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ init: - git config --global core.autocrlf true build_script: - - build.cmd --quiet --parallel verify + - build.cmd --quiet verify clone_depth: 1 test: off deploy: off \ No newline at end of file diff --git a/build.cmd b/build.cmd index 553e3929a0..65fb3e3353 100644 --- a/build.cmd +++ b/build.cmd @@ -1,40 +1,40 @@ -@echo off -cd %~dp0 - +@ECHO off SETLOCAL + +SET REPO_FOLDER=%~dp0 +CD "%REPO_FOLDER%" + +SET BUILD_FOLDER=.build +SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet +SET KOREBUILD_VERSION= + +SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe SET NUGET_VERSION=latest SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe -SET BUILDCMD_KOREBUILD_VERSION= -SET BUILDCMD_DNX_VERSION= -IF EXIST %CACHED_NUGET% goto copynuget -echo Downloading latest version of NuGet.exe... -IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" - -:copynuget -IF EXIST .nuget\nuget.exe goto restore -md .nuget -copy %CACHED_NUGET% .nuget\nuget.exe > nul - -:restore -IF EXIST packages\Sake goto getdnx -IF "%BUILDCMD_KOREBUILD_VERSION%"=="" ( - .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre -) ELSE ( - .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre -) -.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages - -:getdnx -IF "%BUILDCMD_DNX_VERSION%"=="" ( - SET BUILDCMD_DNX_VERSION=latest -) -IF "%SKIP_DNX_INSTALL%"=="" ( - CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default - CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default -) ELSE ( - CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 +IF NOT EXIST %BUILD_FOLDER% ( + md %BUILD_FOLDER% ) -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* +IF NOT EXIST %NUGET_PATH% ( + IF NOT EXIST %CACHED_NUGET% ( + echo Downloading latest version of NuGet.exe... + IF NOT EXIST %LocalAppData%\NuGet ( + md %LocalAppData%\NuGet + ) + @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" + ) + + copy %CACHED_NUGET% %NUGET_PATH% > nul +) + +IF NOT EXIST %KOREBUILD_FOLDER% ( + SET KOREBUILD_DOWNLOAD_ARGS= + IF NOT "%KOREBUILD_VERSION%"=="" ( + SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% + ) + + %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% +) + +"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %* diff --git a/build.sh b/build.sh index da4e3fcd1c..7b5e25e3a8 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +repoFolder="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +buildFolder=.build +koreBuildFolder=$buildFolder/KoreBuild-dotnet + +nugetPath=$buildFolder/nuget.exe + if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild else @@ -11,33 +24,25 @@ else fi mkdir -p $cachedir nugetVersion=latest -cachePath=$cachedir/nuget.$nugetVersion.exe +cacheNuget=$cachedir/nuget.$nugetVersion.exe -url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe +nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe -if test ! -f $cachePath; then - wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null +if test ! -d $buildFolder; then + mkdir $buildFolder fi -if test ! -e .nuget; then - mkdir .nuget - cp $cachePath .nuget/nuget.exe +if test ! -f $nugetPath; then + if test ! -f $cacheNuget; then + wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null + fi + + cp $cacheNuget $nugetPath fi -if test ! -d packages/Sake; then - mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages +if test ! -d $koreBuildFolder; then + mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre fi -if ! type dnvm > /dev/null 2>&1; then - source packages/KoreBuild/build/dnvm.sh -fi +source $koreBuildFolder/build/KoreBuild.sh -if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then - dnvm install latest -runtime coreclr -alias default - dnvm install default -runtime mono -alias default -else - dnvm use default -runtime mono -fi - -mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" diff --git a/samples/ActionConstraintSample.Web/Startup.cs b/samples/ActionConstraintSample.Web/Startup.cs index d54d62c1b7..6a06bce863 100644 --- a/samples/ActionConstraintSample.Web/Startup.cs +++ b/samples/ActionConstraintSample.Web/Startup.cs @@ -32,6 +32,7 @@ namespace ActionConstraintSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/ActionConstraintSample.Web/hosting.json b/samples/ActionConstraintSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/ActionConstraintSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/ActionConstraintSample.Web/project.json b/samples/ActionConstraintSample.Web/project.json index e35b489bc2..66477e3bc2 100644 --- a/samples/ActionConstraintSample.Web/project.json +++ b/samples/ActionConstraintSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "ActionConstraintSample.Web" @@ -11,7 +12,12 @@ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": { }, + "dnxcore50": { + "imports": "portable-net451+win8", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-*" + } + } } } \ No newline at end of file diff --git a/samples/CustomRouteSample.Web/Startup.cs b/samples/CustomRouteSample.Web/Startup.cs index a2ce5c18ce..829b432e2f 100644 --- a/samples/CustomRouteSample.Web/Startup.cs +++ b/samples/CustomRouteSample.Web/Startup.cs @@ -29,6 +29,7 @@ namespace CustomRouteSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/CustomRouteSample.Web/hosting.json b/samples/CustomRouteSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/CustomRouteSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/CustomRouteSample.Web/project.json b/samples/CustomRouteSample.Web/project.json index dee7ce09c0..7019260e7e 100644 --- a/samples/CustomRouteSample.Web/project.json +++ b/samples/CustomRouteSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "CustomRouteSample.Web" @@ -8,10 +9,13 @@ "dependencies": { "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/EmbeddedViewSample.Web/Startup.cs b/samples/EmbeddedViewSample.Web/Startup.cs index 27ab145d1b..36885ac8c4 100644 --- a/samples/EmbeddedViewSample.Web/Startup.cs +++ b/samples/EmbeddedViewSample.Web/Startup.cs @@ -46,6 +46,7 @@ namespace EmbeddedViewSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/EmbeddedViewSample.Web/hosting.json b/samples/EmbeddedViewSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/EmbeddedViewSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/EmbeddedViewSample.Web/project.json b/samples/EmbeddedViewSample.Web/project.json index f7999aa99b..9ac91575b8 100644 --- a/samples/EmbeddedViewSample.Web/project.json +++ b/samples/EmbeddedViewSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "EmbeddedViewSample.Web" @@ -10,10 +11,13 @@ "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", - "Microsoft.Extensions.FileProviders.Embedded": "1.0.0-*" + "Microsoft.Extensions.FileProviders.Embedded": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/FormatFilterSample.Web/Startup.cs b/samples/FormatFilterSample.Web/Startup.cs index f515f3fce3..bd76a8d0c8 100644 --- a/samples/FormatFilterSample.Web/Startup.cs +++ b/samples/FormatFilterSample.Web/Startup.cs @@ -42,6 +42,7 @@ namespace FormatFilterSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/FormatFilterSample.Web/hosting.json b/samples/FormatFilterSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/FormatFilterSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/FormatFilterSample.Web/project.json b/samples/FormatFilterSample.Web/project.json index 0c47557941..4c820919bb 100644 --- a/samples/FormatFilterSample.Web/project.json +++ b/samples/FormatFilterSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "FormatFilterSample.Web" @@ -13,7 +14,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/InlineConstraintSample.Web/Startup.cs b/samples/InlineConstraintSample.Web/Startup.cs index 4aa7e4a707..ae380cd715 100644 --- a/samples/InlineConstraintSample.Web/Startup.cs +++ b/samples/InlineConstraintSample.Web/Startup.cs @@ -41,6 +41,7 @@ namespace InlineConstraintSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/InlineConstraintSample.Web/hosting.json b/samples/InlineConstraintSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/InlineConstraintSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/InlineConstraintSample.Web/project.json b/samples/InlineConstraintSample.Web/project.json index d8cbb11f0c..a7494235ea 100644 --- a/samples/InlineConstraintSample.Web/project.json +++ b/samples/InlineConstraintSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "InlineConstraintSample.Web" @@ -8,10 +9,13 @@ "dependencies": { "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/JsonPatchSample.Web/Startup.cs b/samples/JsonPatchSample.Web/Startup.cs index 071b5475ae..4cb04c6e9c 100644 --- a/samples/JsonPatchSample.Web/Startup.cs +++ b/samples/JsonPatchSample.Web/Startup.cs @@ -27,6 +27,7 @@ namespace JsonPatchSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/JsonPatchSample.Web/hosting.json b/samples/JsonPatchSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/JsonPatchSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/JsonPatchSample.Web/project.json b/samples/JsonPatchSample.Web/project.json index d33f07e585..8ba11526b7 100644 --- a/samples/JsonPatchSample.Web/project.json +++ b/samples/JsonPatchSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "JsonPatchSample.Web" @@ -11,7 +12,12 @@ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-*" + } + } } } \ No newline at end of file diff --git a/samples/LocalizationSample.Web/Startup.cs b/samples/LocalizationSample.Web/Startup.cs index 7a3ab7dcea..9d195ccc91 100644 --- a/samples/LocalizationSample.Web/Startup.cs +++ b/samples/LocalizationSample.Web/Startup.cs @@ -45,6 +45,7 @@ namespace LocalizationSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/LocalizationSample.Web/hosting.json b/samples/LocalizationSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/LocalizationSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/LocalizationSample.Web/project.json b/samples/LocalizationSample.Web/project.json index 6b3cd87c2a..7ed6342ec6 100644 --- a/samples/LocalizationSample.Web/project.json +++ b/samples/LocalizationSample.Web/project.json @@ -3,15 +3,19 @@ "web": "LocalizationSample.Web" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/MvcSandbox/Startup.cs b/samples/MvcSandbox/Startup.cs index 7c6a6e2039..d7f3fcafdf 100644 --- a/samples/MvcSandbox/Startup.cs +++ b/samples/MvcSandbox/Startup.cs @@ -19,7 +19,7 @@ namespace MvcSandbox // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { - + app.UseDeveloperExceptionPage(); app.UseStaticFiles(); loggerFactory.AddConsole(); app.UseMvc(routes => @@ -35,6 +35,7 @@ namespace MvcSandbox var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/MvcSandbox/hosting.json b/samples/MvcSandbox/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/MvcSandbox/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/MvcSandbox/project.json b/samples/MvcSandbox/project.json index 57730bc1f9..aa72e4256f 100644 --- a/samples/MvcSandbox/project.json +++ b/samples/MvcSandbox/project.json @@ -4,7 +4,8 @@ }, "compilationOptions": { "emitEntryPoint": true, - "warningsAsErrors": true + "warningsAsErrors": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Diagnostics": "1.0.0-*", @@ -21,8 +22,10 @@ "dotnet-razor-tooling": "1.0.0-*" }, "frameworks": { - "dnx451": { }, - "dnxcore50": { } + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } }, "exclude": [ "wwwroot", diff --git a/samples/MvcSubAreaSample.Web/Startup.cs b/samples/MvcSubAreaSample.Web/Startup.cs index 5faf39e35d..e7c3d5f169 100644 --- a/samples/MvcSubAreaSample.Web/Startup.cs +++ b/samples/MvcSubAreaSample.Web/Startup.cs @@ -41,6 +41,7 @@ namespace MvcSubAreaSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/MvcSubAreaSample.Web/hosting.json b/samples/MvcSubAreaSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/MvcSubAreaSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/MvcSubAreaSample.Web/project.json b/samples/MvcSubAreaSample.Web/project.json index fb9af166b3..14908d3597 100644 --- a/samples/MvcSubAreaSample.Web/project.json +++ b/samples/MvcSubAreaSample.Web/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "MvcSubAreaSample.Web" @@ -15,7 +16,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/samples/TagHelperSample.Web/Startup.cs b/samples/TagHelperSample.Web/Startup.cs index a583c33d21..56e2de4fe1 100644 --- a/samples/TagHelperSample.Web/Startup.cs +++ b/samples/TagHelperSample.Web/Startup.cs @@ -39,6 +39,7 @@ namespace TagHelperSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/samples/TagHelperSample.Web/hosting.json b/samples/TagHelperSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/TagHelperSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/TagHelperSample.Web/project.json b/samples/TagHelperSample.Web/project.json index 221c3a7b0e..78b1f807a8 100644 --- a/samples/TagHelperSample.Web/project.json +++ b/samples/TagHelperSample.Web/project.json @@ -1,7 +1,8 @@ { "compilationOptions": { "emitEntryPoint": true, - "warningsAsErrors": true + "warningsAsErrors": true, + "preserveCompilationContext": true }, "commands": { "web": "TagHelperSample.Web" @@ -20,8 +21,10 @@ "dotnet-razor-tooling": "1.0.0-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } }, "exclude": [ "wwwroot", diff --git a/samples/UrlHelperSample.Web/Startup.cs b/samples/UrlHelperSample.Web/Startup.cs index a337b05810..cac4203062 100644 --- a/samples/UrlHelperSample.Web/Startup.cs +++ b/samples/UrlHelperSample.Web/Startup.cs @@ -40,6 +40,7 @@ namespace UrlHelperSample.Web var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/samples/UrlHelperSample.Web/hosting.json b/samples/UrlHelperSample.Web/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/samples/UrlHelperSample.Web/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/samples/UrlHelperSample.Web/project.json b/samples/UrlHelperSample.Web/project.json index b9561787ab..aa433d8004 100644 --- a/samples/UrlHelperSample.Web/project.json +++ b/samples/UrlHelperSample.Web/project.json @@ -1,16 +1,20 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "UrlHelperSample.Web" }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.0.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/project.json b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/project.json index 3cd02ee390..0f8cb2957b 100644 --- a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/project.json +++ b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/project.json @@ -22,6 +22,8 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": {} + "dotnet5.4": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DependencyContextAssemblyProvider.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DependencyContextAssemblyProvider.cs index 5ac5af4d8b..3c9e099441 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DependencyContextAssemblyProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/DependencyContextAssemblyProvider.cs @@ -7,11 +7,28 @@ using System.Diagnostics; using System.Linq; using System.Reflection; using Microsoft.Extensions.DependencyModel; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.AspNetCore.Mvc.Infrastructure { + /// + /// An that uses to discover assemblies that may + /// contain Mvc specific types such as controllers, and view components. + /// public class DependencyContextAssemblyProvider : IAssemblyProvider { + private readonly DependencyContext _dependencyContext; + + /// + /// Initializes a new instance of . + /// + /// The . + public DependencyContextAssemblyProvider(IApplicationEnvironment environment) + { + var applicationAssembly = Assembly.Load(new AssemblyName(environment.ApplicationName)); + _dependencyContext = DependencyContext.Load(applicationAssembly); + } + /// /// Gets the set of assembly names that are used as root for discovery of /// MVC controllers, view components and views. diff --git a/src/Microsoft.AspNetCore.Mvc.Core/project.json b/src/Microsoft.AspNetCore.Mvc.Core/project.json index ae7be58986..f379682261 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Core/project.json @@ -55,6 +55,7 @@ } }, "dotnet5.4": { + "imports": "portable-net451+win8", "dependencies": { "System.Text.Encoding": "4.0.11-*" } diff --git a/src/Microsoft.AspNetCore.Mvc.Cors/project.json b/src/Microsoft.AspNetCore.Mvc.Cors/project.json index c1f6298d56..51c371462e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Cors/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Cors/project.json @@ -15,6 +15,8 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": {} + "dotnet5.4": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/project.json b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/project.json index 12f3630b59..19f7efd6ca 100644 --- a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/project.json +++ b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/project.json @@ -28,6 +28,7 @@ } }, "dotnet5.4": { + "imports": "portable-net451+win8", "dependencies": { "System.ComponentModel.Annotations": "4.1.0-*" } diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/project.json b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/project.json index 809364ce44..712f305b71 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/project.json @@ -19,6 +19,8 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": {} + "dotnet5.4": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/project.json b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/project.json index 6aec15af5d..d266df7d19 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/project.json @@ -28,6 +28,7 @@ } }, "dotnet5.4": { + "imports": "portable-net451+win8", "dependencies": { "System.Runtime.Serialization.Xml": "4.1.0-*", "System.Xml.XmlSerializer": "4.0.11-*" diff --git a/src/Microsoft.AspNetCore.Mvc.Localization/project.json b/src/Microsoft.AspNetCore.Mvc.Localization/project.json index 821f38f282..99fd3ee394 100644 --- a/src/Microsoft.AspNetCore.Mvc.Localization/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Localization/project.json @@ -18,7 +18,9 @@ }, "frameworks": { "net451": {}, - "dotnet5.6": {} + "dotnet5.6": { + "imports": "portable-net45+win8" + } }, "exclude": [ "wwwroot", diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextCompilationService.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextCompilationService.cs index b11294b830..76da719a8b 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextCompilationService.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextCompilationService.cs @@ -1,8 +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 System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Microsoft.CodeAnalysis; using Microsoft.Extensions.DependencyModel; using Microsoft.Extensions.Logging; @@ -27,26 +29,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal /// The . /// The . public DependencyContextCompilationService( - IApplicationEnvironment environment, - IMvcRazorHost host, - IOptions optionsAccessor, - IRazorViewEngineFileProviderAccessor fileProviderAccessor, - ILoggerFactory loggerFactory) - : this(DependencyContext.Default, environment, host, optionsAccessor, fileProviderAccessor, loggerFactory) - { - } - - /// - /// Initalizes a new instance of the class. - /// - /// to use for reference resolution. - /// The environment for the executing application. - /// The that was used to generate the code. - /// Accessor to . - /// The . - /// The . - public DependencyContextCompilationService( - DependencyContext dependencyContext, IApplicationEnvironment environment, IMvcRazorHost host, IOptions optionsAccessor, @@ -54,7 +36,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal ILoggerFactory loggerFactory) : base(environment, host, optionsAccessor, fileProviderAccessor, loggerFactory) { - _dependencyContext = dependencyContext; + var applicationAssembly = Assembly.Load(new AssemblyName(environment.ApplicationName)); + _dependencyContext = DependencyContext.Load(applicationAssembly); } protected override List GetApplicationReferences() diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextRazorViewEngineOptionsSetup.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextRazorViewEngineOptionsSetup.cs index 119d2100e7..d2eb5de88c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextRazorViewEngineOptionsSetup.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DependencyContextRazorViewEngineOptionsSetup.cs @@ -3,42 +3,41 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc.Razor; +using System.Linq; +using System.Reflection; using Microsoft.CodeAnalysis; -using Microsoft.Extensions.Options; +using Microsoft.CodeAnalysis.CSharp; using Microsoft.Extensions.DependencyModel; +using Microsoft.Extensions.Options; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.AspNetCore.Mvc.Razor.Internal { /// - /// Sets up compilation and parse option default options for using + /// Sets up compilation and parse option default options for using + /// /// public class DependencyContextRazorViewEngineOptionsSetup : ConfigureOptions { /// /// Initializes a new instance of . /// - public DependencyContextRazorViewEngineOptionsSetup() : this(DependencyContext.Default) + public DependencyContextRazorViewEngineOptionsSetup(IApplicationEnvironment applicationEnvironment) + : base(options => ConfigureRazor(options, applicationEnvironment)) { } - /// - /// Initializes a new instance of . - /// - /// to use as compilation and parse option source. - public DependencyContextRazorViewEngineOptionsSetup(DependencyContext dependencyContext) : base(options => ConfigureRazor(options, dependencyContext)) + private static void ConfigureRazor(RazorViewEngineOptions options, IApplicationEnvironment applicationEnvironment) { - } - - private static void ConfigureRazor(RazorViewEngineOptions options, DependencyContext dependencyContext) - { - var compilationOptions = dependencyContext.CompilationOptions; + var applicationAssembly = Assembly.Load(new AssemblyName(applicationEnvironment.ApplicationName)); + var dependencyContext = DependencyContext.Load(applicationAssembly); + var compilationOptions = dependencyContext?.CompilationOptions ?? Extensions.DependencyModel.CompilationOptions.Default; SetParseOptions(options, compilationOptions); SetCompilationOptions(options, compilationOptions); } - private static void SetCompilationOptions(RazorViewEngineOptions options, Microsoft.Extensions.DependencyModel.CompilationOptions compilationOptions) + private static void SetCompilationOptions(RazorViewEngineOptions options, Extensions.DependencyModel.CompilationOptions compilationOptions) { var roslynOptions = options.CompilationOptions; @@ -58,31 +57,39 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal if (compilationOptions.Optimize.HasValue) { - var optimizationLevel = compilationOptions.Optimize.Value ? OptimizationLevel.Debug : OptimizationLevel.Release; + var optimizationLevel = compilationOptions.Optimize.Value + ? OptimizationLevel.Debug + : OptimizationLevel.Release; roslynOptions = roslynOptions.WithOptimizationLevel(optimizationLevel); } if (compilationOptions.WarningsAsErrors.HasValue) { - var reportDiagnostic = compilationOptions.WarningsAsErrors.Value ? ReportDiagnostic.Error : ReportDiagnostic.Default; + var reportDiagnostic = compilationOptions.WarningsAsErrors.Value + ? ReportDiagnostic.Error + : ReportDiagnostic.Default; roslynOptions = roslynOptions.WithGeneralDiagnosticOption(reportDiagnostic); } options.CompilationOptions = roslynOptions; } - private static void SetParseOptions(RazorViewEngineOptions options, Microsoft.Extensions.DependencyModel.CompilationOptions compilationOptions) + private static void SetParseOptions( + RazorViewEngineOptions options, + Extensions.DependencyModel.CompilationOptions compilationOptions) { - var roslynParseOptions = options.ParseOptions; - roslynParseOptions = roslynParseOptions.WithPreprocessorSymbols(compilationOptions.Defines); + var parseOptions = options.ParseOptions; + parseOptions = parseOptions.WithPreprocessorSymbols( + parseOptions.PreprocessorSymbolNames.Concat(compilationOptions.Defines)); - var languageVersion = roslynParseOptions.LanguageVersion; - if (Enum.TryParse(compilationOptions.LanguageVersion, ignoreCase: true, result: out languageVersion)) + LanguageVersion languageVersion; + if (!string.IsNullOrEmpty(compilationOptions.LanguageVersion) && + Enum.TryParse(compilationOptions.LanguageVersion, ignoreCase: true, result: out languageVersion)) { - roslynParseOptions = roslynParseOptions.WithLanguageVersion(languageVersion); + parseOptions = parseOptions.WithLanguageVersion(languageVersion); } - options.ParseOptions = roslynParseOptions; + options.ParseOptions = parseOptions; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs index fd05e27377..4f8b6ee89a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptionsSetup.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.Linq; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.CodeAnalysis; @@ -21,31 +22,37 @@ namespace Microsoft.AspNetCore.Mvc /// /// for the application. /// for the application. - public RazorViewEngineOptionsSetup(IApplicationEnvironment applicationEnvironment, - IHostingEnvironment hostingEnvironment) + public RazorViewEngineOptionsSetup( + IApplicationEnvironment applicationEnvironment, + IHostingEnvironment hostingEnvironment) : base(options => ConfigureRazor(options, applicationEnvironment, hostingEnvironment)) { } - private static void ConfigureRazor(RazorViewEngineOptions razorOptions, + private static void ConfigureRazor( + RazorViewEngineOptions razorOptions, IApplicationEnvironment applicationEnvironment, IHostingEnvironment hostingEnvironment) { razorOptions.FileProviders.Add(new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath)); - var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp6); - var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary); + var compilationOptions = razorOptions.CompilationOptions; + string configurationSymbol; if (hostingEnvironment.IsDevelopment()) { - razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols("DEBUG"); + configurationSymbol = "DEBUG"; razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Debug); } else { - razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols("RELEASE"); + configurationSymbol = "RELEASE"; razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Release); } + + var parseOptions = razorOptions.ParseOptions; + razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols( + parseOptions.PreprocessorSymbolNames.Concat(new[] { configurationSymbol })); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/project.json b/src/Microsoft.AspNetCore.Mvc.Razor/project.json index 9ed9c544a6..f0045c9991 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Razor/project.json @@ -40,6 +40,7 @@ } }, "dotnet5.6": { + "imports": "portable-net45+win8", "dependencies": { "System.Text.Encoding": "4.0.11-*", "System.Runtime.Loader": "4.0.0-*", diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/project.json b/src/Microsoft.AspNetCore.Mvc.TagHelpers/project.json index 2d6caecaff..ad259fff81 100644 --- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/project.json +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/project.json @@ -30,6 +30,7 @@ "frameworks": { "net451": {}, "dotnet5.6": { + "imports": "portable-net45+win8", "dependencies": { "System.Security.Cryptography.Algorithms": "4.0.0-*" } diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/project.json b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/project.json index 6cddbb1a46..6f0a6f6885 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/project.json +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/project.json @@ -38,6 +38,8 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": {} + "dotnet5.4": { + "imports": "portable-net451+win8", + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/project.json b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/project.json index 1c6a87c172..c60b8d275b 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/project.json +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/project.json @@ -28,6 +28,7 @@ } }, "dotnet5.4": { + "imports": "portable-net451+win8", "dependencies": { "System.Net.Http": "4.0.1-*", "System.Runtime.Serialization.Xml": "4.1.0-*", diff --git a/src/Microsoft.AspNetCore.Mvc/project.json b/src/Microsoft.AspNetCore.Mvc/project.json index 09493ef3ae..e944eb3214 100644 --- a/src/Microsoft.AspNetCore.Mvc/project.json +++ b/src/Microsoft.AspNetCore.Mvc/project.json @@ -27,6 +27,8 @@ }, "frameworks": { "net451": {}, - "dotnet5.6": {} + "dotnet5.6": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/project.json index 1e1d797886..6dc60aa02b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/project.json @@ -6,21 +6,29 @@ "dependencies": { "Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/project.json b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/project.json index 5bc70f4227..f29b158c99 100644 --- a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/project.json @@ -11,21 +11,29 @@ }, "Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResultFilterAttributeTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResultFilterAttributeTest.cs index c6b30ae850..bfec55fb06 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResultFilterAttributeTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/ResultFilterAttributeTest.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. -#if DNX451 using System.Threading.Tasks; using Moq; using Xunit; @@ -34,4 +33,4 @@ namespace Microsoft.AspNetCore.Mvc.Filters } } } -#endif + diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs index 9078674a2b..129bc816c3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.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. +#if DNXCORE50 using System; using System.Collections.Generic; using System.Linq; @@ -254,4 +255,5 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs index 4ab4e65efe..0a4f4f9766 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal { public class NonDisposableStreamTest { -#if DNX451 +#if !DNXCORE50 [Fact] public void InnerStreamIsOpenOnClose() { @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal nonDisposableStream.Dispose(); } -#if DNX451 +#if !DNXCORE50 [Fact] public void InnerStreamIsNotFlushedOnClose() { diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Core.Test/project.json index fdbc1db21c..7de05538f6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/project.json @@ -19,21 +19,30 @@ "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.Extensions.Logging": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Cors.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Cors.Test/project.json index b3aee7c98c..27b7985b46 100644 --- a/test/Microsoft.AspNetCore.Mvc.Cors.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Cors.Test/project.json @@ -13,21 +13,29 @@ "Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/project.json b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/project.json index de6aa5f82d..e6f5f5b5d4 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/project.json @@ -13,21 +13,29 @@ "Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/project.json index b3aee7c98c..27b7985b46 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/project.json @@ -13,21 +13,29 @@ "Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/project.json index a539638410..e061478f4b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/project.json @@ -12,21 +12,29 @@ "version": "1.0.0-*" }, "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ActionConstraintSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ActionConstraintSampleTest.cs index 51cdab2482..d7c38755a2 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ActionConstraintSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ActionConstraintSampleTest.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class ActionConstraintSampleTest : IClassFixture> + public class ActionConstraintSampleTest : IClassFixture> { - public ActionConstraintSampleTest(MvcTestFixture fixture) + public ActionConstraintSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs index 511a1f8d48..2741c6f28e 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs @@ -22,10 +22,10 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public async Task CompilationOptions_AreUsedByViewsAndPartials() { // Arrange -#if DNX451 +#if NET451 || DNX451 var expected = -@"This method is running from DNX451 -This method is only defined in DNX451"; +@"This method is running from NET451 +This method is only defined in NET451"; #elif DNXCORE50 var expected = @"This method is running from DNXCORE50 diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomRouteSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomRouteSampleTest.cs index 7c7ec4944f..198da2a0ac 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomRouteSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomRouteSampleTest.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class CustomRouteSampleTest : IClassFixture> + public class CustomRouteSampleTest : IClassFixture> { - public CustomRouteSampleTest(MvcTestFixture fixture) + public CustomRouteSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomUrlHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomUrlHelperTest.cs index 3afc21327e..b84455c3d1 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomUrlHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CustomUrlHelperTest.cs @@ -15,11 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests /// 1. Based on configuration, generate Content urls pointing to local or a CDN server /// 2. Based on configuration, generate lower case urls /// - public class CustomUrlHelperTests : IClassFixture> + public class CustomUrlHelperTests : IClassFixture> { private const string _cdnServerBaseUrl = "http://cdn.contoso.com"; - public CustomUrlHelperTests(MvcTestFixture fixture) + public CustomUrlHelperTests(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs index 410dfbd010..a105642c46 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs @@ -7,9 +7,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class EmbeddedViewSampleTest : IClassFixture> + public class EmbeddedViewSampleTest : IClassFixture> { - public EmbeddedViewSampleTest(MvcTestFixture fixture) + public EmbeddedViewSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/FormatFilterSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/FormatFilterSampleTest.cs index 73d9911544..4331d07566 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/FormatFilterSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/FormatFilterSampleTest.cs @@ -9,13 +9,13 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class FormatFilterSampleTest : IClassFixture> + public class FormatFilterSampleTest : IClassFixture> { // Typical accept header sent by Chrome browser private const string ChromeAcceptHeader = "text/html,application/xhtml+xml," + "application/xml;q=0.9,image/webp,*/*;q=0.8"; - public FormatFilterSampleTest(MvcTestFixture fixture) + public FormatFilterSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InlineConstraintSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InlineConstraintSampleTest.cs index 4dd2d2eeb6..cfb20bd0ee 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InlineConstraintSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InlineConstraintSampleTest.cs @@ -11,9 +11,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class InlineConstraintSampleTest : IClassFixture> + public class InlineConstraintSampleTest : IClassFixture> { - public InlineConstraintSampleTest(MvcTestFixture fixture) + public InlineConstraintSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/JsonPatchSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/JsonPatchSampleTest.cs index 265b8a1e56..61104c9881 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/JsonPatchSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/JsonPatchSampleTest.cs @@ -13,9 +13,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class JsonPatchSampleTest : IClassFixture> + public class JsonPatchSampleTest : IClassFixture> { - public JsonPatchSampleTest(MvcTestFixture fixture) + public JsonPatchSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/LocalizationSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/LocalizationSampleTest.cs index c2a2a24559..ccd74a80aa 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/LocalizationSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/LocalizationSampleTest.cs @@ -11,9 +11,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class LocalizationSampleTest : IClassFixture> + public class LocalizationSampleTest : IClassFixture> { - public LocalizationSampleTest(MvcTestFixture fixture) + public LocalizationSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcEncodedTestFixtureOfT.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcEncodedTestFixtureOfT.cs index 16d6c494d6..5d588ee2aa 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcEncodedTestFixtureOfT.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcEncodedTestFixtureOfT.cs @@ -9,9 +9,9 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests { public class MvcEncodedTestFixture : MvcTestFixture { - protected override void InitializeServices(IServiceCollection services) + protected override void InitializeServices(IServiceCollection services, string relativePath) { - base.InitializeServices(services); + base.InitializeServices(services, relativePath); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSampleFixture.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSampleFixture.cs new file mode 100644 index 0000000000..54aeff56ad --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSampleFixture.cs @@ -0,0 +1,13 @@ +// 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. + +namespace Microsoft.AspNetCore.Mvc.FunctionalTests +{ + public class MvcSampleFixture : MvcTestFixture + { + public MvcSampleFixture() + : base("../../../../samples/") + { + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSandboxTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSandboxTest.cs index 17ca7fd0d4..5ddca16f69 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSandboxTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcSandboxTest.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class MvcSandboxTest : IClassFixture> + public class MvcSandboxTest : IClassFixture> { - public MvcSandboxTest(MvcTestFixture fixture) + public MvcSandboxTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs index 7c6d8de9f0..a4805030c0 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs @@ -10,8 +10,6 @@ using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.AspNetCore.Mvc.FunctionalTests @@ -21,6 +19,11 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests private readonly TestServer _server; public MvcTestFixture() + : this("../../../Websites/") + { + } + + protected MvcTestFixture(string relativePath) { // RequestLocalizationOptions saves the current culture when constructed, potentially changing response // localization i.e. RequestLocalizationMiddleware behavior. Ensure the saved culture @@ -28,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests using (new CultureReplacer()) { var builder = new WebHostBuilder() - .ConfigureServices(InitializeServices) + .ConfigureServices(serviceCollection => InitializeServices(serviceCollection, relativePath)) .UseStartup(typeof(TStartup)); _server = new TestServer(builder); @@ -46,10 +49,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests _server.Dispose(); } - protected virtual void InitializeServices(IServiceCollection services) + protected virtual void InitializeServices(IServiceCollection services, string relativePath) { - var libraryManager = DnxPlatformServices.Default.LibraryManager; - // When an application executes in a regular context, the application base path points to the root // directory where the application is located, for example .../samples/MvcSample.Web. However, when // executing an application as part of a test, the ApplicationBasePath of the IApplicationEnvironment @@ -58,10 +59,19 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests // environment value so that components like the view engine work properly in the context of the test. var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly; var applicationName = startupAssembly.GetName().Name; - var library = libraryManager.GetLibrary(applicationName); - var applicationRoot = Path.GetDirectoryName(library.Path); var applicationEnvironment = PlatformServices.Default.Application; +#if DNXCORE50 || DNX451 + var libraryManager = DnxPlatformServices.Default.LibraryManager; + var library = libraryManager.GetLibrary(applicationName); + var applicationRoot = Path.GetDirectoryName(library.Path); +#else + var applicationRoot = Path.GetFullPath(Path.Combine( + applicationEnvironment.ApplicationBasePath, + relativePath, + applicationName + )); +#endif services.AddSingleton( new TestApplicationEnvironment(applicationEnvironment, applicationName, applicationRoot)); diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RouteDataTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RouteDataTest.cs index 90d8b6db30..57c520c5c6 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RouteDataTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RouteDataTest.cs @@ -5,11 +5,8 @@ using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; -using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Template; using Newtonsoft.Json; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/SubAreaTests.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/SubAreaTests.cs index f6a12d0098..6e9997498a 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/SubAreaTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/SubAreaTests.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class SubAreaTests : IClassFixture> + public class SubAreaTests : IClassFixture> { - public SubAreaTests(MvcTestFixture fixture) + public SubAreaTests(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelperSampleTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelperSampleTest.cs index 188ff321bf..d7280db274 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelperSampleTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelperSampleTest.cs @@ -13,9 +13,9 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { - public class TagHelperSampleTest : IClassFixture> + public class TagHelperSampleTest : IClassFixture> { - public TagHelperSampleTest(MvcTestFixture fixture) + public TagHelperSampleTest(MvcSampleFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/project.json index e62a16b233..4e8e93290e 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/project.json @@ -50,15 +50,25 @@ "UrlHelperSample.Web": "1.0.0", "VersioningWebSite": "1.0.0", "WebApiCompatShimWebSite": "1.0.0", - "XmlFormattersWebSite": "1.0.0", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "XmlFormattersWebSite": "1.0.0" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "dnx451": { + "dependencies": { + "xunit.runner.aspnet": "2.0.0-aspnet-*" + }, + }, + "net451": { }, + "dnxcore50": { + "dependencies": { + "xunit.runner.aspnet": "2.0.0-aspnet-*" + }, + "imports": "portable-net451+win8" + } }, "exclude": [ "wwwroot", diff --git a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/project.json b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/project.json index d415f785ab..6e8f94a4ca 100644 --- a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/project.json +++ b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/project.json @@ -11,21 +11,30 @@ "type": "build" }, "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.Extensions.Logging": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Localization.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Localization.Test/project.json index 2881a87b4b..bff5355904 100644 --- a/test/Microsoft.AspNetCore.Mvc.Localization.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Localization.Test/project.json @@ -11,21 +11,29 @@ "type": "build" }, "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/project.json index ea76486172..593a74ac8d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/project.json @@ -12,9 +12,9 @@ }, "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, @@ -26,13 +26,21 @@ }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRoslynCompilationServiceTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRoslynCompilationServiceTest.cs index abb6915038..190c39ff4e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRoslynCompilationServiceTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRoslynCompilationServiceTest.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. +#if DNXCORE50 using System; using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.CodeAnalysis; @@ -389,3 +390,4 @@ public class NotRazorPrefixType {}"; } } } +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/ExpressionRewriterTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/ExpressionRewriterTest.cs index be64f330e5..578de54d61 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/ExpressionRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/ExpressionRewriterTest.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -566,9 +567,19 @@ public class Person private IEnumerable GetReferences() { - var libraryExporter = CompilationServices.Default.LibraryExporter; - var environment = PlatformServices.Default.Application; + var libraryExporter = CompilationServices.Default?.LibraryExporter; + if (libraryExporter == null) + { + var types = new[] + { + typeof(System.Linq.Expressions.Expression), + typeof(string), + }; + return types.Select(t => MetadataReference.CreateFromFile(t.GetTypeInfo().Assembly.Location)); + } + + var environment = PlatformServices.Default.Application; var references = new List(); var libraryExports = libraryExporter.GetAllExports(environment.ApplicationName); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Razor.Test/project.json index 0733dc5789..f7a12e247f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/project.json @@ -23,25 +23,32 @@ "type": "build" }, "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.Dnx.Runtime": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, @@ -50,4 +57,4 @@ "node_modules", "bower_components" ] -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json index 034a0241ea..2051f0d105 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json @@ -14,21 +14,29 @@ }, "Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs index 3e62cdc5dc..4fd05807a5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Linq; using System.Threading; +using System.Reflection; using System.Xml; using System.Xml.Linq; using Microsoft.AspNetCore.Hosting; @@ -252,6 +253,9 @@ namespace Microsoft.AspNetCore.Mvc serviceCollection.AddSingleton(Mock.Of()); var applicationEnvironment = new Mock(); + applicationEnvironment.SetupGet(e => e.ApplicationName) + .Returns(typeof(MvcOptionsSetupTest).GetTypeInfo().Assembly.GetName().Name); + // ApplicationBasePath is used to set up a PhysicalFileProvider which requires // a real directory. applicationEnvironment.SetupGet(e => e.ApplicationBasePath) diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs index 26a187cbf4..93454ca6d2 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs @@ -21,6 +21,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Internal; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.CompilationAbstractions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; @@ -138,6 +139,24 @@ namespace Microsoft.AspNetCore.Mvc { get { + Type[] razorViewEngineOptionsRegistrations; + if (CompilationServices.Default == null) + { + razorViewEngineOptionsRegistrations = new[] + { + typeof(RazorViewEngineOptionsSetup), + typeof(DependencyContextRazorViewEngineOptionsSetup) + }; + + } + else + { + razorViewEngineOptionsRegistrations = new[] + { + typeof(RazorViewEngineOptionsSetup) + }; + } + return new Dictionary() { { @@ -167,12 +186,9 @@ namespace Microsoft.AspNetCore.Mvc }, { typeof(IConfigureOptions), - new Type[] - { - typeof(RazorViewEngineOptionsSetup), - } + razorViewEngineOptionsRegistrations }, - { + { typeof(IActionConstraintProvider), new Type[] { diff --git a/test/Microsoft.AspNetCore.Mvc.Test/project.json b/test/Microsoft.AspNetCore.Mvc.Test/project.json index 2fc6cc5bc5..a49f9acea4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.Test/project.json @@ -6,21 +6,31 @@ "Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.Extensions.Logging": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { "dependencies": { - "Moq": "4.2.1312.1622" + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit": "2.1.0" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/project.json b/test/Microsoft.AspNetCore.Mvc.TestCommon/project.json index a5080ac6ad..b9b75a8151 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/project.json +++ b/test/Microsoft.AspNetCore.Mvc.TestCommon/project.json @@ -2,8 +2,8 @@ "version": "1.0.0-*", "shared": "**/*.cs", "frameworks": { - "dnx451": {}, - "dnxcore50": { + "net451": {}, + "dotnet5.4": { "dependencies": { "System.Runtime": "4.1.0-*" } diff --git a/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources/project.json b/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources/project.json index a5080ac6ad..b9b75a8151 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources/project.json +++ b/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources/project.json @@ -2,8 +2,8 @@ "version": "1.0.0-*", "shared": "**/*.cs", "frameworks": { - "dnx451": {}, - "dnxcore50": { + "net451": {}, + "dotnet5.4": { "dependencies": { "System.Runtime": "4.1.0-*" } diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/project.json b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/project.json index fdbc1db21c..0b2ee74ff2 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/project.json @@ -19,21 +19,29 @@ "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { + "dependencies": { + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + }, + "net451": { "dependencies": { "Moq": "4.2.1312.1622" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/project.json b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/project.json index 47876ba87b..c609edbcd0 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/project.json +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/project.json @@ -9,20 +9,24 @@ "Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.NETCore.Platforms": "1.0.1-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": { "dependencies": { - "Moq": "4.2.1312.1622" + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } }, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } } diff --git a/test/WebSites/ApiExplorerWebSite/Startup.cs b/test/WebSites/ApiExplorerWebSite/Startup.cs index c10d77ca64..45c8e6eb71 100644 --- a/test/WebSites/ApiExplorerWebSite/Startup.cs +++ b/test/WebSites/ApiExplorerWebSite/Startup.cs @@ -46,6 +46,7 @@ namespace ApiExplorerWebSite { var host = new WebHostBuilder() .UseDefaultConfiguration(args) + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseStartup() .Build(); diff --git a/test/WebSites/ApiExplorerWebSite/hosting.json b/test/WebSites/ApiExplorerWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/ApiExplorerWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/ApiExplorerWebSite/project.json b/test/WebSites/ApiExplorerWebSite/project.json index faab0a6913..f41d89cadb 100644 --- a/test/WebSites/ApiExplorerWebSite/project.json +++ b/test/WebSites/ApiExplorerWebSite/project.json @@ -3,7 +3,8 @@ "web": "ApiExplorerWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/ApplicationModelWebSite/Startup.cs b/test/WebSites/ApplicationModelWebSite/Startup.cs index 5098b9f97b..551903a93f 100644 --- a/test/WebSites/ApplicationModelWebSite/Startup.cs +++ b/test/WebSites/ApplicationModelWebSite/Startup.cs @@ -37,6 +37,7 @@ namespace ApplicationModelWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/ApplicationModelWebSite/hosting.json b/test/WebSites/ApplicationModelWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/ApplicationModelWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/ApplicationModelWebSite/project.json b/test/WebSites/ApplicationModelWebSite/project.json index 4bf2e7387c..38e4039e65 100644 --- a/test/WebSites/ApplicationModelWebSite/project.json +++ b/test/WebSites/ApplicationModelWebSite/project.json @@ -3,7 +3,8 @@ "web": "ApplicationModelWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -13,7 +14,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/Startup.cs b/test/WebSites/BasicWebSite/Startup.cs index b050d4524f..7e7a439fd6 100644 --- a/test/WebSites/BasicWebSite/Startup.cs +++ b/test/WebSites/BasicWebSite/Startup.cs @@ -42,9 +42,10 @@ namespace BasicWebSite // Add MVC to the request pipeline app.UseMvc(routes => { - routes.MapRoute("areaRoute", - "{area:exists}/{controller}/{action}", - new { controller = "Home", action = "Index" }); + routes.MapRoute( + "areaRoute", + "{area:exists}/{controller}/{action}", + new { controller = "Home", action = "Index" }); routes.MapRoute("ActionAsMethod", "{controller}/{action}", defaults: new { controller = "Home", action = "Index" }); @@ -57,6 +58,7 @@ namespace BasicWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/BasicWebSite/hosting.json b/test/WebSites/BasicWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/BasicWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/project.json b/test/WebSites/BasicWebSite/project.json index 30840f10d6..42171beaa7 100644 --- a/test/WebSites/BasicWebSite/project.json +++ b/test/WebSites/BasicWebSite/project.json @@ -3,7 +3,8 @@ "web": "BasicWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Mvc": "1.0.0-*", @@ -15,8 +16,10 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } }, "exclude": [ "wwwroot", diff --git a/test/WebSites/ControllersFromServicesClassLibrary/project.json b/test/WebSites/ControllersFromServicesClassLibrary/project.json index a12824f6bf..04d335f7d2 100644 --- a/test/WebSites/ControllersFromServicesClassLibrary/project.json +++ b/test/WebSites/ControllersFromServicesClassLibrary/project.json @@ -1,9 +1,12 @@ { "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.0.0-*" + "Microsoft.AspNetCore.Mvc": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/ControllersFromServicesWebSite/Startup.cs b/test/WebSites/ControllersFromServicesWebSite/Startup.cs index df2124bac3..14d5741a68 100644 --- a/test/WebSites/ControllersFromServicesWebSite/Startup.cs +++ b/test/WebSites/ControllersFromServicesWebSite/Startup.cs @@ -42,6 +42,7 @@ namespace ControllersFromServicesWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/ControllersFromServicesWebSite/hosting.json b/test/WebSites/ControllersFromServicesWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/ControllersFromServicesWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/ControllersFromServicesWebSite/project.json b/test/WebSites/ControllersFromServicesWebSite/project.json index 5fb9a47e50..cde5732bd0 100644 --- a/test/WebSites/ControllersFromServicesWebSite/project.json +++ b/test/WebSites/ControllersFromServicesWebSite/project.json @@ -3,7 +3,8 @@ "web": "ControllersFromServicesWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "ControllersFromServicesClassLibrary": "1.0.0", @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/CorsWebSite/Startup.cs b/test/WebSites/CorsWebSite/Startup.cs index 6d08ccea36..a5154e0376 100644 --- a/test/WebSites/CorsWebSite/Startup.cs +++ b/test/WebSites/CorsWebSite/Startup.cs @@ -83,6 +83,7 @@ namespace CorsWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/CorsWebSite/hosting.json b/test/WebSites/CorsWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/CorsWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/CorsWebSite/project.json b/test/WebSites/CorsWebSite/project.json index f65a072eea..3fb00ca3a2 100644 --- a/test/WebSites/CorsWebSite/project.json +++ b/test/WebSites/CorsWebSite/project.json @@ -3,7 +3,8 @@ "web": "CorsWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -15,7 +16,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs b/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs index e88cda550f..95892a76f3 100644 --- a/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs +++ b/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs @@ -28,6 +28,7 @@ namespace ErrorPageMiddlewareWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/hosting.json b/test/WebSites/ErrorPageMiddlewareWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/ErrorPageMiddlewareWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/project.json b/test/WebSites/ErrorPageMiddlewareWebSite/project.json index aaaf57c1be..3d30a87a1f 100644 --- a/test/WebSites/ErrorPageMiddlewareWebSite/project.json +++ b/test/WebSites/ErrorPageMiddlewareWebSite/project.json @@ -3,7 +3,8 @@ "web": "ErrorPageMiddlewareWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/FilesWebSite/Startup.cs b/test/WebSites/FilesWebSite/Startup.cs index 4a733f1e55..9ff9f0faf4 100644 --- a/test/WebSites/FilesWebSite/Startup.cs +++ b/test/WebSites/FilesWebSite/Startup.cs @@ -30,6 +30,7 @@ namespace FilesWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/FilesWebSite/hosting.json b/test/WebSites/FilesWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/FilesWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/FilesWebSite/project.json b/test/WebSites/FilesWebSite/project.json index eac5b8eea3..6201961c21 100644 --- a/test/WebSites/FilesWebSite/project.json +++ b/test/WebSites/FilesWebSite/project.json @@ -3,7 +3,8 @@ "web": "FilesWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "resource": "EmbeddedResources/**", "dependencies": { @@ -15,7 +16,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/FiltersWebSite/Startup.cs b/test/WebSites/FiltersWebSite/Startup.cs index 1dab78fd39..7055b7f103 100644 --- a/test/WebSites/FiltersWebSite/Startup.cs +++ b/test/WebSites/FiltersWebSite/Startup.cs @@ -72,6 +72,7 @@ namespace FiltersWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/FiltersWebSite/hosting.json b/test/WebSites/FiltersWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/FiltersWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/FiltersWebSite/project.json b/test/WebSites/FiltersWebSite/project.json index 803a886222..9f0d165b71 100644 --- a/test/WebSites/FiltersWebSite/project.json +++ b/test/WebSites/FiltersWebSite/project.json @@ -3,7 +3,8 @@ "web": "FiltersWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -15,7 +16,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/FormatterWebSite/Startup.cs b/test/WebSites/FormatterWebSite/Startup.cs index ba546cf188..66ec272cc3 100644 --- a/test/WebSites/FormatterWebSite/Startup.cs +++ b/test/WebSites/FormatterWebSite/Startup.cs @@ -39,6 +39,7 @@ namespace FormatterWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/FormatterWebSite/hosting.json b/test/WebSites/FormatterWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/FormatterWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/FormatterWebSite/project.json b/test/WebSites/FormatterWebSite/project.json index c630c28e96..7fbb933b35 100644 --- a/test/WebSites/FormatterWebSite/project.json +++ b/test/WebSites/FormatterWebSite/project.json @@ -3,7 +3,8 @@ "web": "FormatterWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/HtmlGenerationWebSite/Startup.cs b/test/WebSites/HtmlGenerationWebSite/Startup.cs index dd04e02ec5..c3a65c121f 100644 --- a/test/WebSites/HtmlGenerationWebSite/Startup.cs +++ b/test/WebSites/HtmlGenerationWebSite/Startup.cs @@ -47,6 +47,7 @@ namespace HtmlGenerationWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/HtmlGenerationWebSite/hosting.json b/test/WebSites/HtmlGenerationWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/HtmlGenerationWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/HtmlGenerationWebSite/project.json b/test/WebSites/HtmlGenerationWebSite/project.json index 223b7e55da..715d4d66f3 100644 --- a/test/WebSites/HtmlGenerationWebSite/project.json +++ b/test/WebSites/HtmlGenerationWebSite/project.json @@ -3,7 +3,8 @@ "web": "HtmlGenerationWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", @@ -13,7 +14,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/project.json b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/project.json index bd522256c2..fa13fdbcbb 100644 --- a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/project.json +++ b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/project.json @@ -1,13 +1,16 @@ { - "dependencies": { - "Microsoft.AspNetCore.Http": "1.0.0-*", - "Microsoft.AspNetCore.Http.Extensions": "1.0.0-*", - "Microsoft.AspNetCore.Testing": "1.0.0-*", - "Microsoft.Extensions.Configuration": "1.0.0-*", - "Microsoft.Extensions.DependencyInjection": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } + "dependencies": { + "Microsoft.AspNetCore.Http": "1.0.0-*", + "Microsoft.AspNetCore.Http.Extensions": "1.0.0-*", + "Microsoft.AspNetCore.Testing": "1.0.0-*", + "Microsoft.Extensions.Configuration": "1.0.0-*", + "Microsoft.Extensions.DependencyInjection": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" + }, + "frameworks": { + "net451": { }, + "dnxcore50": { + "imports": "portable-net451+win8" } + } } diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs index ef568f6e52..ee1e18c4a9 100644 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs +++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs @@ -49,6 +49,7 @@ namespace RazorPageExecutionInstrumentationWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/hosting.json b/test/WebSites/RazorPageExecutionInstrumentationWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/project.json b/test/WebSites/RazorPageExecutionInstrumentationWebSite/project.json index d804fbdcd5..4b41cce457 100644 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/project.json +++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "RazorPageExecutionInstrumentationWebSite" @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs b/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs index 6bc50a8362..0662a17354 100644 --- a/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs +++ b/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs @@ -7,17 +7,17 @@ namespace RazorWebSite { public string ExecuteOperation() { -#if DNX451 - return "This method is running from DNX451"; +#if NET451 + return "This method is running from NET451"; #elif DNXCORE50 return "This method is running from DNXCORE50"; #endif } -#if DNX451_CUSTOM_DEFINE - public string ExecuteDnx451Operation() +#if NET451_CUSTOM_DEFINE + public string ExecuteNet451Operation() { - return "This method is only defined in DNX451"; + return "This method is only defined in NET451"; } #endif diff --git a/test/WebSites/RazorWebSite/Startup.cs b/test/WebSites/RazorWebSite/Startup.cs index 1bf64e6b24..7d275862e6 100644 --- a/test/WebSites/RazorWebSite/Startup.cs +++ b/test/WebSites/RazorWebSite/Startup.cs @@ -20,9 +20,7 @@ namespace RazorWebSite .AddRazorOptions(options => { options.ViewLocationExpanders.Add(new NonMainPageViewLocationExpander()); -#if DNX451 - options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols("DNX451", "DNX451_CUSTOM_DEFINE"); -#else +#if DNXCORE50 options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols("DNXCORE50", "DNXCORE50_CUSTOM_DEFINE"); #endif }) @@ -68,6 +66,7 @@ namespace RazorWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml b/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml index 18c5f2a0fb..b9d426a64c 100644 --- a/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml +++ b/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml @@ -1,8 +1,8 @@ @inject FrameworkSpecificHelper MyHelper @{ string value = -#if DNX451_CUSTOM_DEFINE - MyHelper.ExecuteDnx451Operation(); +#if NET451_CUSTOM_DEFINE + MyHelper.ExecuteNet451Operation(); #endif #if DNXCORE50_CUSTOM_DEFINE MyHelper.ExecuteDnxCore50Operation(); diff --git a/test/WebSites/RazorWebSite/hosting.json b/test/WebSites/RazorWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/RazorWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/RazorWebSite/project.json b/test/WebSites/RazorWebSite/project.json index d411009bcd..c875a7fa16 100644 --- a/test/WebSites/RazorWebSite/project.json +++ b/test/WebSites/RazorWebSite/project.json @@ -3,7 +3,8 @@ "web": "RazorWebSite" }, "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "dependencies": { "Microsoft.AspNetCore.Localization": "1.0.0-*", @@ -15,10 +16,10 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": { + "net451": { "compilationOptions": { "define": [ - "DNX451_CUSTOM_DEFINE" + "NET451_CUSTOM_DEFINE" ] } }, @@ -27,7 +28,8 @@ "define": [ "DNXCORE50_CUSTOM_DEFINE" ] - } + }, + "imports": "portable-net451+win8" } } } \ No newline at end of file diff --git a/test/WebSites/RoutingWebSite/Startup.cs b/test/WebSites/RoutingWebSite/Startup.cs index 29706d7e14..98d5e1c64a 100644 --- a/test/WebSites/RoutingWebSite/Startup.cs +++ b/test/WebSites/RoutingWebSite/Startup.cs @@ -46,6 +46,7 @@ namespace RoutingWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/RoutingWebSite/hosting.json b/test/WebSites/RoutingWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/RoutingWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/RoutingWebSite/project.json b/test/WebSites/RoutingWebSite/project.json index 39d66dddff..cbd7fcdeb7 100644 --- a/test/WebSites/RoutingWebSite/project.json +++ b/test/WebSites/RoutingWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "RoutingWebSite" @@ -13,7 +14,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/SimpleWebSite/Startup.cs b/test/WebSites/SimpleWebSite/Startup.cs index 536e3d3bd1..bc8ad4ff91 100644 --- a/test/WebSites/SimpleWebSite/Startup.cs +++ b/test/WebSites/SimpleWebSite/Startup.cs @@ -34,6 +34,7 @@ namespace SimpleWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/SimpleWebSite/hosting.json b/test/WebSites/SimpleWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/SimpleWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/SimpleWebSite/project.json b/test/WebSites/SimpleWebSite/project.json index 6c02ff5a29..d6f73d9ab9 100644 --- a/test/WebSites/SimpleWebSite/project.json +++ b/test/WebSites/SimpleWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "SimpleWebSite" @@ -11,7 +12,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/TagHelpersWebSite/Startup.cs b/test/WebSites/TagHelpersWebSite/Startup.cs index 1bd368678a..6506bfdf2c 100644 --- a/test/WebSites/TagHelpersWebSite/Startup.cs +++ b/test/WebSites/TagHelpersWebSite/Startup.cs @@ -27,6 +27,7 @@ namespace TagHelpersWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/TagHelpersWebSite/hosting.json b/test/WebSites/TagHelpersWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/TagHelpersWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/TagHelpersWebSite/project.json b/test/WebSites/TagHelpersWebSite/project.json index 16e6177f26..1c591aff40 100644 --- a/test/WebSites/TagHelpersWebSite/project.json +++ b/test/WebSites/TagHelpersWebSite/project.json @@ -2,7 +2,8 @@ "compilationOptions": { "allowUnsafe": true, "emitEntryPoint": true, - "warningsAsErrors": true + "warningsAsErrors": true, + "preserveCompilationContext": true }, "commands": { "web": "TagHelpersWebSite" @@ -16,7 +17,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/UserClassLibrary/project.json b/test/WebSites/UserClassLibrary/project.json index eee2211a60..26aa4274aa 100644 --- a/test/WebSites/UserClassLibrary/project.json +++ b/test/WebSites/UserClassLibrary/project.json @@ -1,10 +1,10 @@ { - "frameworks": { - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Runtime": "4.1.0-*" - } - } + "frameworks": { + "net451": { }, + "dotnet54": { + "dependencies": { + "System.Runtime": "4.1.0-*" + } } + } } diff --git a/test/WebSites/VersioningWebSite/Startup.cs b/test/WebSites/VersioningWebSite/Startup.cs index 5367c4be65..e6311cbe02 100644 --- a/test/WebSites/VersioningWebSite/Startup.cs +++ b/test/WebSites/VersioningWebSite/Startup.cs @@ -31,6 +31,7 @@ namespace VersioningWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/VersioningWebSite/hosting.json b/test/WebSites/VersioningWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/VersioningWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/VersioningWebSite/project.json b/test/WebSites/VersioningWebSite/project.json index 51f5da3f63..849e1d7581 100644 --- a/test/WebSites/VersioningWebSite/project.json +++ b/test/WebSites/VersioningWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "VersioningWebSite" @@ -13,7 +14,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/WebApiCompatShimWebSite/Startup.cs b/test/WebSites/WebApiCompatShimWebSite/Startup.cs index 4e49717280..f6c11fce8a 100644 --- a/test/WebSites/WebApiCompatShimWebSite/Startup.cs +++ b/test/WebSites/WebApiCompatShimWebSite/Startup.cs @@ -38,6 +38,7 @@ namespace WebApiCompatShimWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/WebApiCompatShimWebSite/hosting.json b/test/WebSites/WebApiCompatShimWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/WebApiCompatShimWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/WebApiCompatShimWebSite/project.json b/test/WebSites/WebApiCompatShimWebSite/project.json index ab7a25a1cf..2364c92ee5 100644 --- a/test/WebSites/WebApiCompatShimWebSite/project.json +++ b/test/WebSites/WebApiCompatShimWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "WebApiCompatShimWebSite" @@ -14,7 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} + "net451": {}, + "dnxcore50": { + "imports": "portable-net451+win8" + } } } \ No newline at end of file diff --git a/test/WebSites/XmlFormattersWebSite/Startup.cs b/test/WebSites/XmlFormattersWebSite/Startup.cs index 98e3519982..a50ae9218a 100644 --- a/test/WebSites/XmlFormattersWebSite/Startup.cs +++ b/test/WebSites/XmlFormattersWebSite/Startup.cs @@ -82,6 +82,7 @@ namespace XmlFormattersWebSite var host = new WebHostBuilder() .UseDefaultConfiguration(args) .UseStartup() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .Build(); host.Run(); diff --git a/test/WebSites/XmlFormattersWebSite/hosting.json b/test/WebSites/XmlFormattersWebSite/hosting.json deleted file mode 100644 index 26fd5141aa..0000000000 --- a/test/WebSites/XmlFormattersWebSite/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} \ No newline at end of file diff --git a/test/WebSites/XmlFormattersWebSite/project.json b/test/WebSites/XmlFormattersWebSite/project.json index 37568ad83f..702c934368 100644 --- a/test/WebSites/XmlFormattersWebSite/project.json +++ b/test/WebSites/XmlFormattersWebSite/project.json @@ -1,6 +1,7 @@ { "compilationOptions": { - "emitEntryPoint": true + "emitEntryPoint": true, + "preserveCompilationContext": true }, "commands": { "web": "XmlFormattersWebSite" @@ -14,8 +15,9 @@ "Microsoft.NETCore.Platforms": "1.0.1-*" }, "frameworks": { - "dnx451": {}, + "net451": {}, "dnxcore50": { + "imports": "portable-net451+win8", "dependencies": { "System.Linq.Queryable": "4.0.1-*" }