parent
779edb6fe1
commit
5b805bb12d
|
|
@ -48,3 +48,5 @@
|
|||
*.fsproj text=auto
|
||||
*.dbproj text=auto
|
||||
*.sln text=auto eol=crlf
|
||||
|
||||
*.sh eol=lf
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
[Bb]in/
|
||||
TestResults/
|
||||
.nuget/
|
||||
.build/
|
||||
.testPublish/
|
||||
*.sln.ide/
|
||||
_ReSharper.*/
|
||||
packages/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
68
build.cmd
68
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" %*
|
||||
|
|
|
|||
47
build.sh
47
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 "$@"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace ActionConstraintSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ namespace CustomRouteSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ namespace EmbeddedViewSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ namespace FormatFilterSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ namespace InlineConstraintSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ namespace JsonPatchSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ namespace LocalizationSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ namespace MvcSubAreaSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ namespace TagHelperSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseIISPlatformHandlerUrl()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ namespace UrlHelperSample.Web
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {}
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="IAssemblyProvider"/> that uses <see cref="DependencyContext"/> to discover assemblies that may
|
||||
/// contain Mvc specific types such as controllers, and view components.
|
||||
/// </summary>
|
||||
public class DependencyContextAssemblyProvider : IAssemblyProvider
|
||||
{
|
||||
private readonly DependencyContext _dependencyContext;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="DependencyContextAssemblyProvider"/>.
|
||||
/// </summary>
|
||||
/// <param name="environment">The <see cref="IApplicationEnvironment"/>.</param>
|
||||
public DependencyContextAssemblyProvider(IApplicationEnvironment environment)
|
||||
{
|
||||
var applicationAssembly = Assembly.Load(new AssemblyName(environment.ApplicationName));
|
||||
_dependencyContext = DependencyContext.Load(applicationAssembly);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the set of assembly names that are used as root for discovery of
|
||||
/// MVC controllers, view components and views.
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
}
|
||||
},
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
"dependencies": {
|
||||
"System.Text.Encoding": "4.0.11-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {}
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
}
|
||||
},
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
"dependencies": {
|
||||
"System.ComponentModel.Annotations": "4.1.0-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {}
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
}
|
||||
},
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
"dependencies": {
|
||||
"System.Runtime.Serialization.Xml": "4.1.0-*",
|
||||
"System.Xml.XmlSerializer": "4.0.11-*"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.6": {}
|
||||
"dotnet5.6": {
|
||||
"imports": "portable-net45+win8"
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <param name="fileProviderAccessor">The <see cref="IRazorViewEngineFileProviderAccessor"/>.</param>
|
||||
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
|
||||
public DependencyContextCompilationService(
|
||||
IApplicationEnvironment environment,
|
||||
IMvcRazorHost host,
|
||||
IOptions<RazorViewEngineOptions> optionsAccessor,
|
||||
IRazorViewEngineFileProviderAccessor fileProviderAccessor,
|
||||
ILoggerFactory loggerFactory)
|
||||
: this(DependencyContext.Default, environment, host, optionsAccessor, fileProviderAccessor, loggerFactory)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initalizes a new instance of the <see cref="DependencyContextCompilationService"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dependencyContext"><see cref="DependencyContext"/> to use for reference resolution.</param>
|
||||
/// <param name="environment">The environment for the executing application.</param>
|
||||
/// <param name="host">The <see cref="IMvcRazorHost"/> that was used to generate the code.</param>
|
||||
/// <param name="optionsAccessor">Accessor to <see cref="RazorViewEngineOptions"/>.</param>
|
||||
/// <param name="fileProviderAccessor">The <see cref="IRazorViewEngineFileProviderAccessor"/>.</param>
|
||||
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
|
||||
public DependencyContextCompilationService(
|
||||
DependencyContext dependencyContext,
|
||||
IApplicationEnvironment environment,
|
||||
IMvcRazorHost host,
|
||||
IOptions<RazorViewEngineOptions> 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<MetadataReference> GetApplicationReferences()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets up compilation and parse option default options for <see cref="RazorViewEngineOptions"/> using <see cref="DependencyContext"/>
|
||||
/// Sets up compilation and parse option default options for <see cref="RazorViewEngineOptions"/> using
|
||||
/// <see cref="DependencyContext"/>
|
||||
/// </summary>
|
||||
public class DependencyContextRazorViewEngineOptionsSetup : ConfigureOptions<RazorViewEngineOptions>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="DependencyContextRazorViewEngineOptionsSetup"/>.
|
||||
/// </summary>
|
||||
public DependencyContextRazorViewEngineOptionsSetup() : this(DependencyContext.Default)
|
||||
public DependencyContextRazorViewEngineOptionsSetup(IApplicationEnvironment applicationEnvironment)
|
||||
: base(options => ConfigureRazor(options, applicationEnvironment))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="DependencyContextRazorViewEngineOptionsSetup"/>.
|
||||
/// </summary>
|
||||
/// <param name="dependencyContext"><see cref="DependencyContext"/> to use as compilation and parse option source.</param>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
|||
/// </summary>
|
||||
/// <param name="applicationEnvironment"><see cref="IApplicationEnvironment"/> for the application.</param>
|
||||
/// <param name="hostingEnvironment"><see cref="IHostingEnvironment"/> for the application.</param>
|
||||
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 }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
}
|
||||
},
|
||||
"dotnet5.6": {
|
||||
"imports": "portable-net45+win8",
|
||||
"dependencies": {
|
||||
"System.Text.Encoding": "4.0.11-*",
|
||||
"System.Runtime.Loader": "4.0.0-*",
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.6": {
|
||||
"imports": "portable-net45+win8",
|
||||
"dependencies": {
|
||||
"System.Security.Cryptography.Algorithms": "4.0.0-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {}
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
}
|
||||
},
|
||||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
"dependencies": {
|
||||
"System.Net.Http": "4.0.1-*",
|
||||
"System.Runtime.Serialization.Xml": "4.1.0-*",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"dotnet5.6": {}
|
||||
"dotnet5.6": {
|
||||
"imports": "portable-net451+win8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class ActionConstraintSampleTest : IClassFixture<MvcTestFixture<ActionConstraintSample.Web.Startup>>
|
||||
public class ActionConstraintSampleTest : IClassFixture<MvcSampleFixture<ActionConstraintSample.Web.Startup>>
|
||||
{
|
||||
public ActionConstraintSampleTest(MvcTestFixture<ActionConstraintSample.Web.Startup> fixture)
|
||||
public ActionConstraintSampleTest(MvcSampleFixture<ActionConstraintSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class CustomRouteSampleTest : IClassFixture<MvcTestFixture<CustomRouteSample.Web.Startup>>
|
||||
public class CustomRouteSampleTest : IClassFixture<MvcSampleFixture<CustomRouteSample.Web.Startup>>
|
||||
{
|
||||
public CustomRouteSampleTest(MvcTestFixture<CustomRouteSample.Web.Startup> fixture)
|
||||
public CustomRouteSampleTest(MvcSampleFixture<CustomRouteSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/// </summary>
|
||||
public class CustomUrlHelperTests : IClassFixture<MvcTestFixture<UrlHelperSample.Web.Startup>>
|
||||
public class CustomUrlHelperTests : IClassFixture<MvcSampleFixture<UrlHelperSample.Web.Startup>>
|
||||
{
|
||||
private const string _cdnServerBaseUrl = "http://cdn.contoso.com";
|
||||
|
||||
public CustomUrlHelperTests(MvcTestFixture<UrlHelperSample.Web.Startup> fixture)
|
||||
public CustomUrlHelperTests(MvcSampleFixture<UrlHelperSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class EmbeddedViewSampleTest : IClassFixture<MvcTestFixture<EmbeddedViewSample.Web.Startup>>
|
||||
public class EmbeddedViewSampleTest : IClassFixture<MvcSampleFixture<EmbeddedViewSample.Web.Startup>>
|
||||
{
|
||||
public EmbeddedViewSampleTest(MvcTestFixture<EmbeddedViewSample.Web.Startup> fixture)
|
||||
public EmbeddedViewSampleTest(MvcSampleFixture<EmbeddedViewSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class FormatFilterSampleTest : IClassFixture<MvcTestFixture<FormatFilterSample.Web.Startup>>
|
||||
public class FormatFilterSampleTest : IClassFixture<MvcSampleFixture<FormatFilterSample.Web.Startup>>
|
||||
{
|
||||
// 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<FormatFilterSample.Web.Startup> fixture)
|
||||
public FormatFilterSampleTest(MvcSampleFixture<FormatFilterSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class InlineConstraintSampleTest : IClassFixture<MvcTestFixture<InlineConstraintSample.Web.Startup>>
|
||||
public class InlineConstraintSampleTest : IClassFixture<MvcSampleFixture<InlineConstraintSample.Web.Startup>>
|
||||
{
|
||||
public InlineConstraintSampleTest(MvcTestFixture<InlineConstraintSample.Web.Startup> fixture)
|
||||
public InlineConstraintSampleTest(MvcSampleFixture<InlineConstraintSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class JsonPatchSampleTest : IClassFixture<MvcTestFixture<JsonPatchSample.Web.Startup>>
|
||||
public class JsonPatchSampleTest : IClassFixture<MvcSampleFixture<JsonPatchSample.Web.Startup>>
|
||||
{
|
||||
public JsonPatchSampleTest(MvcTestFixture<JsonPatchSample.Web.Startup> fixture)
|
||||
public JsonPatchSampleTest(MvcSampleFixture<JsonPatchSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class LocalizationSampleTest : IClassFixture<MvcTestFixture<LocalizationSample.Web.Startup>>
|
||||
public class LocalizationSampleTest : IClassFixture<MvcSampleFixture<LocalizationSample.Web.Startup>>
|
||||
{
|
||||
public LocalizationSampleTest(MvcTestFixture<LocalizationSample.Web.Startup> fixture)
|
||||
public LocalizationSampleTest(MvcSampleFixture<LocalizationSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
{
|
||||
public class MvcEncodedTestFixture<TStartup> : MvcTestFixture<TStartup>
|
||||
{
|
||||
protected override void InitializeServices(IServiceCollection services)
|
||||
protected override void InitializeServices(IServiceCollection services, string relativePath)
|
||||
{
|
||||
base.InitializeServices(services);
|
||||
base.InitializeServices(services, relativePath);
|
||||
services.AddTransient<HtmlEncoder, HtmlTestEncoder>();
|
||||
services.AddTransient<JavaScriptEncoder, JavaScriptTestEncoder>();
|
||||
services.AddTransient<UrlEncoder, UrlTestEncoder>();
|
||||
|
|
|
|||
|
|
@ -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<TStartup> : MvcTestFixture<TStartup>
|
||||
{
|
||||
public MvcSampleFixture()
|
||||
: base("../../../../samples/")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,9 +8,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class MvcSandboxTest : IClassFixture<MvcTestFixture<MvcSandbox.Startup>>
|
||||
public class MvcSandboxTest : IClassFixture<MvcSampleFixture<MvcSandbox.Startup>>
|
||||
{
|
||||
public MvcSandboxTest(MvcTestFixture<MvcSandbox.Startup> fixture)
|
||||
public MvcSandboxTest(MvcSampleFixture<MvcSandbox.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<IApplicationEnvironment>(
|
||||
new TestApplicationEnvironment(applicationEnvironment, applicationName, applicationRoot));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class SubAreaTests : IClassFixture<MvcTestFixture<MvcSubAreaSample.Web.Startup>>
|
||||
public class SubAreaTests : IClassFixture<MvcSampleFixture<MvcSubAreaSample.Web.Startup>>
|
||||
{
|
||||
public SubAreaTests(MvcTestFixture<MvcSubAreaSample.Web.Startup> fixture)
|
||||
public SubAreaTests(MvcSampleFixture<MvcSubAreaSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||
{
|
||||
public class TagHelperSampleTest : IClassFixture<MvcTestFixture<TagHelperSample.Web.Startup>>
|
||||
public class TagHelperSampleTest : IClassFixture<MvcSampleFixture<TagHelperSample.Web.Startup>>
|
||||
{
|
||||
public TagHelperSampleTest(MvcTestFixture<TagHelperSample.Web.Startup> fixture)
|
||||
public TagHelperSampleTest(MvcSampleFixture<TagHelperSample.Web.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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<MetadataReference> 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<MetadataReference>();
|
||||
|
||||
var libraryExports = libraryExporter.GetAllExports(environment.ApplicationName);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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<IHostingEnvironment>());
|
||||
var applicationEnvironment = new Mock<IApplicationEnvironment>();
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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<Type, Type[]>()
|
||||
{
|
||||
{
|
||||
|
|
@ -167,12 +186,9 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
},
|
||||
{
|
||||
typeof(IConfigureOptions<RazorViewEngineOptions>),
|
||||
new Type[]
|
||||
{
|
||||
typeof(RazorViewEngineOptionsSetup),
|
||||
}
|
||||
razorViewEngineOptionsRegistrations
|
||||
},
|
||||
{
|
||||
{
|
||||
typeof(IActionConstraintProvider),
|
||||
new Type[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"version": "1.0.0-*",
|
||||
"shared": "**/*.cs",
|
||||
"frameworks": {
|
||||
"dnx451": {},
|
||||
"dnxcore50": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.1.0-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"version": "1.0.0-*",
|
||||
"shared": "**/*.cs",
|
||||
"frameworks": {
|
||||
"dnx451": {},
|
||||
"dnxcore50": {
|
||||
"net451": {},
|
||||
"dotnet5.4": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.1.0-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ namespace ApiExplorerWebSite
|
|||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ namespace ApplicationModelWebSite
|
|||
var host = new WebHostBuilder()
|
||||
.UseDefaultConfiguration(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue