Updating to use cli

Fixes #3908
This commit is contained in:
Pranav K 2016-01-13 19:18:06 -08:00
parent 779edb6fe1
commit 5b805bb12d
155 changed files with 702 additions and 436 deletions

2
.gitattributes vendored
View File

@ -48,3 +48,5 @@
*.fsproj text=auto *.fsproj text=auto
*.dbproj text=auto *.dbproj text=auto
*.sln text=auto eol=crlf *.sln text=auto eol=crlf
*.sh eol=lf

2
.gitignore vendored
View File

@ -2,6 +2,8 @@
[Bb]in/ [Bb]in/
TestResults/ TestResults/
.nuget/ .nuget/
.build/
.testPublish/
*.sln.ide/ *.sln.ide/
_ReSharper.*/ _ReSharper.*/
packages/ packages/

View File

@ -12,12 +12,11 @@ addons:
- zlib1g - zlib1g
before_install: before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install icu4c; fi - 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: mono:
- 4.0.5 - 4.0.5
os: os:
- linux - linux
- osx - osx
osx_image: xcode7.1
script: script:
- ./build.sh --quiet verify - ./build.sh --quiet verify

View File

@ -1,7 +1,7 @@
init: init:
- git config --global core.autocrlf true - git config --global core.autocrlf true
build_script: build_script:
- build.cmd --quiet --parallel verify - build.cmd --quiet verify
clone_depth: 1 clone_depth: 1
test: off test: off
deploy: off deploy: off

View File

@ -1,40 +1,40 @@
@echo off @ECHO off
cd %~dp0
SETLOCAL 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 NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_KOREBUILD_VERSION=
SET BUILDCMD_DNX_VERSION=
IF EXIST %CACHED_NUGET% goto copynuget IF NOT EXIST %BUILD_FOLDER% (
echo Downloading latest version of NuGet.exe... md %BUILD_FOLDER%
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
) )
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" %*

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/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 if test `uname` = Darwin; then
cachedir=~/Library/Caches/KBuild cachedir=~/Library/Caches/KBuild
else else
@ -11,33 +24,25 @@ else
fi fi
mkdir -p $cachedir mkdir -p $cachedir
nugetVersion=latest 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 if test ! -d $buildFolder; then
wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null mkdir $buildFolder
fi fi
if test ! -e .nuget; then if test ! -f $nugetPath; then
mkdir .nuget if test ! -f $cacheNuget; then
cp $cachePath .nuget/nuget.exe wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null
fi
cp $cacheNuget $nugetPath
fi fi
if test ! -d packages/Sake; then if test ! -d $koreBuildFolder; then
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre
mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages
fi fi
if ! type dnvm > /dev/null 2>&1; then source $koreBuildFolder/build/KoreBuild.sh
source packages/KoreBuild/build/dnvm.sh
fi
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 "$@"

View File

@ -32,6 +32,7 @@ namespace ActionConstraintSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "ActionConstraintSample.Web" "web": "ActionConstraintSample.Web"
@ -11,7 +12,12 @@
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": { },
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*"
}
}
} }
} }

View File

@ -29,6 +29,7 @@ namespace CustomRouteSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "CustomRouteSample.Web" "web": "CustomRouteSample.Web"
@ -8,10 +9,13 @@
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "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": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -46,6 +46,7 @@ namespace EmbeddedViewSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "EmbeddedViewSample.Web" "web": "EmbeddedViewSample.Web"
@ -10,10 +11,13 @@
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "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": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -42,6 +42,7 @@ namespace FormatFilterSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "FormatFilterSample.Web" "web": "FormatFilterSample.Web"
@ -13,7 +14,9 @@
"Microsoft.NETCore.Platforms": "1.0.1-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -41,6 +41,7 @@ namespace InlineConstraintSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "InlineConstraintSample.Web" "web": "InlineConstraintSample.Web"
@ -8,10 +9,13 @@
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "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": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -27,6 +27,7 @@ namespace JsonPatchSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "JsonPatchSample.Web" "web": "JsonPatchSample.Web"
@ -11,7 +12,12 @@
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*"
}
}
} }
} }

View File

@ -45,6 +45,7 @@ namespace LocalizationSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -3,15 +3,19 @@
"web": "LocalizationSample.Web" "web": "LocalizationSample.Web"
}, },
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "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": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -19,7 +19,7 @@ namespace MvcSandbox
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{ {
app.UseDeveloperExceptionPage();
app.UseStaticFiles(); app.UseStaticFiles();
loggerFactory.AddConsole(); loggerFactory.AddConsole();
app.UseMvc(routes => app.UseMvc(routes =>
@ -35,6 +35,7 @@ namespace MvcSandbox
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -4,7 +4,8 @@
}, },
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true, "emitEntryPoint": true,
"warningsAsErrors": true "warningsAsErrors": true,
"preserveCompilationContext": true
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*", "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
@ -21,8 +22,10 @@
"dotnet-razor-tooling": "1.0.0-*" "dotnet-razor-tooling": "1.0.0-*"
}, },
"frameworks": { "frameworks": {
"dnx451": { }, "net451": {},
"dnxcore50": { } "dnxcore50": {
"imports": "portable-net451+win8"
}
}, },
"exclude": [ "exclude": [
"wwwroot", "wwwroot",

View File

@ -41,6 +41,7 @@ namespace MvcSubAreaSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,6 +1,7 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "MvcSubAreaSample.Web" "web": "MvcSubAreaSample.Web"
@ -15,7 +16,9 @@
"Microsoft.NETCore.Platforms": "1.0.1-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -39,6 +39,7 @@ namespace TagHelperSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseIISPlatformHandlerUrl() .UseIISPlatformHandlerUrl()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,7 +1,8 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true, "emitEntryPoint": true,
"warningsAsErrors": true "warningsAsErrors": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "TagHelperSample.Web" "web": "TagHelperSample.Web"
@ -20,8 +21,10 @@
"dotnet-razor-tooling": "1.0.0-*" "dotnet-razor-tooling": "1.0.0-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
}, },
"exclude": [ "exclude": [
"wwwroot", "wwwroot",

View File

@ -40,6 +40,7 @@ namespace UrlHelperSample.Web
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.Build(); .Build();
host.Run(); host.Run();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -1,16 +1,20 @@
{ {
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"commands": { "commands": {
"web": "UrlHelperSample.Web" "web": "UrlHelperSample.Web"
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Mvc": "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": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -22,6 +22,8 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": {} "dotnet5.4": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -7,11 +7,28 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.Extensions.DependencyModel; using Microsoft.Extensions.DependencyModel;
using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.AspNetCore.Mvc.Infrastructure 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 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> /// <summary>
/// Gets the set of assembly names that are used as root for discovery of /// Gets the set of assembly names that are used as root for discovery of
/// MVC controllers, view components and views. /// MVC controllers, view components and views.

View File

@ -55,6 +55,7 @@
} }
}, },
"dotnet5.4": { "dotnet5.4": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"System.Text.Encoding": "4.0.11-*" "System.Text.Encoding": "4.0.11-*"
} }

View File

@ -15,6 +15,8 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": {} "dotnet5.4": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -28,6 +28,7 @@
} }
}, },
"dotnet5.4": { "dotnet5.4": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"System.ComponentModel.Annotations": "4.1.0-*" "System.ComponentModel.Annotations": "4.1.0-*"
} }

View File

@ -19,6 +19,8 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": {} "dotnet5.4": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -28,6 +28,7 @@
} }
}, },
"dotnet5.4": { "dotnet5.4": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"System.Runtime.Serialization.Xml": "4.1.0-*", "System.Runtime.Serialization.Xml": "4.1.0-*",
"System.Xml.XmlSerializer": "4.0.11-*" "System.Xml.XmlSerializer": "4.0.11-*"

View File

@ -18,7 +18,9 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.6": {} "dotnet5.6": {
"imports": "portable-net45+win8"
}
}, },
"exclude": [ "exclude": [
"wwwroot", "wwwroot",

View File

@ -1,8 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyModel; using Microsoft.Extensions.DependencyModel;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -27,26 +29,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
/// <param name="fileProviderAccessor">The <see cref="IRazorViewEngineFileProviderAccessor"/>.</param> /// <param name="fileProviderAccessor">The <see cref="IRazorViewEngineFileProviderAccessor"/>.</param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param> /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
public DependencyContextCompilationService( 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, IApplicationEnvironment environment,
IMvcRazorHost host, IMvcRazorHost host,
IOptions<RazorViewEngineOptions> optionsAccessor, IOptions<RazorViewEngineOptions> optionsAccessor,
@ -54,7 +36,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
ILoggerFactory loggerFactory) ILoggerFactory loggerFactory)
: base(environment, host, optionsAccessor, fileProviderAccessor, 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() protected override List<MetadataReference> GetApplicationReferences()

View File

@ -3,42 +3,41 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Razor; using System.Linq;
using System.Reflection;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Options; using Microsoft.CodeAnalysis.CSharp;
using Microsoft.Extensions.DependencyModel; using Microsoft.Extensions.DependencyModel;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.AspNetCore.Mvc.Razor.Internal namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{ {
/// <summary> /// <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> /// </summary>
public class DependencyContextRazorViewEngineOptionsSetup : ConfigureOptions<RazorViewEngineOptions> public class DependencyContextRazorViewEngineOptionsSetup : ConfigureOptions<RazorViewEngineOptions>
{ {
/// <summary> /// <summary>
/// Initializes a new instance of <see cref="DependencyContextRazorViewEngineOptionsSetup"/>. /// Initializes a new instance of <see cref="DependencyContextRazorViewEngineOptionsSetup"/>.
/// </summary> /// </summary>
public DependencyContextRazorViewEngineOptionsSetup() : this(DependencyContext.Default) public DependencyContextRazorViewEngineOptionsSetup(IApplicationEnvironment applicationEnvironment)
: base(options => ConfigureRazor(options, applicationEnvironment))
{ {
} }
/// <summary> private static void ConfigureRazor(RazorViewEngineOptions options, IApplicationEnvironment applicationEnvironment)
/// 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))
{ {
} var applicationAssembly = Assembly.Load(new AssemblyName(applicationEnvironment.ApplicationName));
var dependencyContext = DependencyContext.Load(applicationAssembly);
private static void ConfigureRazor(RazorViewEngineOptions options, DependencyContext dependencyContext) var compilationOptions = dependencyContext?.CompilationOptions ?? Extensions.DependencyModel.CompilationOptions.Default;
{
var compilationOptions = dependencyContext.CompilationOptions;
SetParseOptions(options, compilationOptions); SetParseOptions(options, compilationOptions);
SetCompilationOptions(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; var roslynOptions = options.CompilationOptions;
@ -58,31 +57,39 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
if (compilationOptions.Optimize.HasValue) 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); roslynOptions = roslynOptions.WithOptimizationLevel(optimizationLevel);
} }
if (compilationOptions.WarningsAsErrors.HasValue) 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); roslynOptions = roslynOptions.WithGeneralDiagnosticOption(reportDiagnostic);
} }
options.CompilationOptions = roslynOptions; 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; var parseOptions = options.ParseOptions;
roslynParseOptions = roslynParseOptions.WithPreprocessorSymbols(compilationOptions.Defines); parseOptions = parseOptions.WithPreprocessorSymbols(
parseOptions.PreprocessorSymbolNames.Concat(compilationOptions.Defines));
var languageVersion = roslynParseOptions.LanguageVersion; LanguageVersion languageVersion;
if (Enum.TryParse(compilationOptions.LanguageVersion, ignoreCase: true, result: out 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;
} }
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // 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.Hosting;
using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
@ -21,31 +22,37 @@ namespace Microsoft.AspNetCore.Mvc
/// </summary> /// </summary>
/// <param name="applicationEnvironment"><see cref="IApplicationEnvironment"/> for the application.</param> /// <param name="applicationEnvironment"><see cref="IApplicationEnvironment"/> for the application.</param>
/// <param name="hostingEnvironment"><see cref="IHostingEnvironment"/> for the application.</param> /// <param name="hostingEnvironment"><see cref="IHostingEnvironment"/> for the application.</param>
public RazorViewEngineOptionsSetup(IApplicationEnvironment applicationEnvironment, public RazorViewEngineOptionsSetup(
IHostingEnvironment hostingEnvironment) IApplicationEnvironment applicationEnvironment,
IHostingEnvironment hostingEnvironment)
: base(options => ConfigureRazor(options, applicationEnvironment, hostingEnvironment)) : base(options => ConfigureRazor(options, applicationEnvironment, hostingEnvironment))
{ {
} }
private static void ConfigureRazor(RazorViewEngineOptions razorOptions, private static void ConfigureRazor(
RazorViewEngineOptions razorOptions,
IApplicationEnvironment applicationEnvironment, IApplicationEnvironment applicationEnvironment,
IHostingEnvironment hostingEnvironment) IHostingEnvironment hostingEnvironment)
{ {
razorOptions.FileProviders.Add(new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath)); razorOptions.FileProviders.Add(new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath));
var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp6); var compilationOptions = razorOptions.CompilationOptions;
var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary); string configurationSymbol;
if (hostingEnvironment.IsDevelopment()) if (hostingEnvironment.IsDevelopment())
{ {
razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols("DEBUG"); configurationSymbol = "DEBUG";
razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Debug); razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Debug);
} }
else else
{ {
razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols("RELEASE"); configurationSymbol = "RELEASE";
razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Release); razorOptions.CompilationOptions = compilationOptions.WithOptimizationLevel(OptimizationLevel.Release);
} }
var parseOptions = razorOptions.ParseOptions;
razorOptions.ParseOptions = parseOptions.WithPreprocessorSymbols(
parseOptions.PreprocessorSymbolNames.Concat(new[] { configurationSymbol }));
} }
} }
} }

View File

@ -40,6 +40,7 @@
} }
}, },
"dotnet5.6": { "dotnet5.6": {
"imports": "portable-net45+win8",
"dependencies": { "dependencies": {
"System.Text.Encoding": "4.0.11-*", "System.Text.Encoding": "4.0.11-*",
"System.Runtime.Loader": "4.0.0-*", "System.Runtime.Loader": "4.0.0-*",

View File

@ -30,6 +30,7 @@
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.6": { "dotnet5.6": {
"imports": "portable-net45+win8",
"dependencies": { "dependencies": {
"System.Security.Cryptography.Algorithms": "4.0.0-*" "System.Security.Cryptography.Algorithms": "4.0.0-*"
} }

View File

@ -38,6 +38,8 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": {} "dotnet5.4": {
"imports": "portable-net451+win8",
}
} }
} }

View File

@ -28,6 +28,7 @@
} }
}, },
"dotnet5.4": { "dotnet5.4": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"System.Net.Http": "4.0.1-*", "System.Net.Http": "4.0.1-*",
"System.Runtime.Serialization.Xml": "4.1.0-*", "System.Runtime.Serialization.Xml": "4.1.0-*",

View File

@ -27,6 +27,8 @@
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.6": {} "dotnet5.6": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -6,21 +6,29 @@
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -11,21 +11,29 @@
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // 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 System.Threading.Tasks;
using Moq; using Moq;
using Xunit; using Xunit;
@ -34,4 +33,4 @@ namespace Microsoft.AspNetCore.Mvc.Filters
} }
} }
} }
#endif

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if DNXCORE50
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -254,4 +255,5 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
} }
} }
} }
} }
#endif

View File

@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{ {
public class NonDisposableStreamTest public class NonDisposableStreamTest
{ {
#if DNX451 #if !DNXCORE50
[Fact] [Fact]
public void InnerStreamIsOpenOnClose() public void InnerStreamIsOpenOnClose()
{ {
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
nonDisposableStream.Dispose(); nonDisposableStream.Dispose();
} }
#if DNX451 #if !DNXCORE50
[Fact] [Fact]
public void InnerStreamIsNotFlushedOnClose() public void InnerStreamIsNotFlushedOnClose()
{ {

View File

@ -19,21 +19,30 @@
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.Extensions.Logging": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -13,21 +13,29 @@
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -13,21 +13,29 @@
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -13,21 +13,29 @@
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -12,21 +12,29 @@
"version": "1.0.0-*" "version": "1.0.0-*"
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -8,9 +8,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -22,10 +22,10 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public async Task CompilationOptions_AreUsedByViewsAndPartials() public async Task CompilationOptions_AreUsedByViewsAndPartials()
{ {
// Arrange // Arrange
#if DNX451 #if NET451 || DNX451
var expected = var expected =
@"This method is running from DNX451 @"This method is running from NET451
This method is only defined in DNX451"; This method is only defined in NET451";
#elif DNXCORE50 #elif DNXCORE50
var expected = var expected =
@"This method is running from DNXCORE50 @"This method is running from DNXCORE50

View File

@ -8,9 +8,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -15,11 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
/// 1. Based on configuration, generate Content urls pointing to local or a CDN server /// 1. Based on configuration, generate Content urls pointing to local or a CDN server
/// 2. Based on configuration, generate lower case urls /// 2. Based on configuration, generate lower case urls
/// </summary> /// </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"; 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; Client = fixture.Client;
} }

View File

@ -7,9 +7,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -9,13 +9,13 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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 // Typical accept header sent by Chrome browser
private const string ChromeAcceptHeader = "text/html,application/xhtml+xml," + private const string ChromeAcceptHeader = "text/html,application/xhtml+xml," +
"application/xml;q=0.9,image/webp,*/*;q=0.8"; "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; Client = fixture.Client;
} }

View File

@ -11,9 +11,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -13,9 +13,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -11,9 +11,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -9,9 +9,9 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
{ {
public class MvcEncodedTestFixture<TStartup> : MvcTestFixture<TStartup> 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<HtmlEncoder, HtmlTestEncoder>();
services.AddTransient<JavaScriptEncoder, JavaScriptTestEncoder>(); services.AddTransient<JavaScriptEncoder, JavaScriptTestEncoder>();
services.AddTransient<UrlEncoder, UrlTestEncoder>(); services.AddTransient<UrlEncoder, UrlTestEncoder>();

View File

@ -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/")
{
}
}
}

View File

@ -8,9 +8,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -10,8 +10,6 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests namespace Microsoft.AspNetCore.Mvc.FunctionalTests
@ -21,6 +19,11 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
private readonly TestServer _server; private readonly TestServer _server;
public MvcTestFixture() public MvcTestFixture()
: this("../../../Websites/")
{
}
protected MvcTestFixture(string relativePath)
{ {
// RequestLocalizationOptions saves the current culture when constructed, potentially changing response // RequestLocalizationOptions saves the current culture when constructed, potentially changing response
// localization i.e. RequestLocalizationMiddleware behavior. Ensure the saved culture // localization i.e. RequestLocalizationMiddleware behavior. Ensure the saved culture
@ -28,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
using (new CultureReplacer()) using (new CultureReplacer())
{ {
var builder = new WebHostBuilder() var builder = new WebHostBuilder()
.ConfigureServices(InitializeServices) .ConfigureServices(serviceCollection => InitializeServices(serviceCollection, relativePath))
.UseStartup(typeof(TStartup)); .UseStartup(typeof(TStartup));
_server = new TestServer(builder); _server = new TestServer(builder);
@ -46,10 +49,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
_server.Dispose(); _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 // 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 // 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 // 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. // environment value so that components like the view engine work properly in the context of the test.
var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly; var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly;
var applicationName = startupAssembly.GetName().Name; var applicationName = startupAssembly.GetName().Name;
var library = libraryManager.GetLibrary(applicationName);
var applicationRoot = Path.GetDirectoryName(library.Path);
var applicationEnvironment = PlatformServices.Default.Application; 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>( services.AddSingleton<IApplicationEnvironment>(
new TestApplicationEnvironment(applicationEnvironment, applicationName, applicationRoot)); new TestApplicationEnvironment(applicationEnvironment, applicationName, applicationRoot));

View File

@ -5,11 +5,8 @@ using System.Collections.Generic;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Template;
using Newtonsoft.Json; using Newtonsoft.Json;
using Xunit; using Xunit;

View File

@ -8,9 +8,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -13,9 +13,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests 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; Client = fixture.Client;
} }

View File

@ -50,15 +50,25 @@
"UrlHelperSample.Web": "1.0.0", "UrlHelperSample.Web": "1.0.0",
"VersioningWebSite": "1.0.0", "VersioningWebSite": "1.0.0",
"WebApiCompatShimWebSite": "1.0.0", "WebApiCompatShimWebSite": "1.0.0",
"XmlFormattersWebSite": "1.0.0", "XmlFormattersWebSite": "1.0.0"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "dnx451": {
"dnxcore50": {} "dependencies": {
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
},
"net451": { },
"dnxcore50": {
"dependencies": {
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"imports": "portable-net451+win8"
}
}, },
"exclude": [ "exclude": [
"wwwroot", "wwwroot",

View File

@ -11,21 +11,30 @@
"type": "build" "type": "build"
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.Extensions.Logging": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -11,21 +11,29 @@
"type": "build" "type": "build"
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -12,9 +12,9 @@
}, },
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0-*", "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0-*",
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
@ -26,13 +26,21 @@
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
}, },

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if DNXCORE50
using System; using System;
using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
@ -389,3 +390,4 @@ public class NotRazorPrefixType {}";
} }
} }
} }
#endif

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
@ -566,9 +567,19 @@ public class Person
private IEnumerable<MetadataReference> GetReferences() private IEnumerable<MetadataReference> GetReferences()
{ {
var libraryExporter = CompilationServices.Default.LibraryExporter; var libraryExporter = CompilationServices.Default?.LibraryExporter;
var environment = PlatformServices.Default.Application; 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 references = new List<MetadataReference>();
var libraryExports = libraryExporter.GetAllExports(environment.ApplicationName); var libraryExports = libraryExporter.GetAllExports(environment.ApplicationName);

View File

@ -23,25 +23,32 @@
"type": "build" "type": "build"
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Dnx.Runtime": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "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", "node_modules",
"bower_components" "bower_components"
] ]
} }

View File

@ -14,21 +14,29 @@
}, },
"Microsoft.AspNetCore.Testing": "1.0.0-*", "Microsoft.AspNetCore.Testing": "1.0.0-*",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
}, },

View File

@ -5,6 +5,7 @@ using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Reflection;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -252,6 +253,9 @@ namespace Microsoft.AspNetCore.Mvc
serviceCollection.AddSingleton(Mock.Of<IHostingEnvironment>()); serviceCollection.AddSingleton(Mock.Of<IHostingEnvironment>());
var applicationEnvironment = new Mock<IApplicationEnvironment>(); 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 // ApplicationBasePath is used to set up a PhysicalFileProvider which requires
// a real directory. // a real directory.
applicationEnvironment.SetupGet(e => e.ApplicationBasePath) applicationEnvironment.SetupGet(e => e.ApplicationBasePath)

View File

@ -21,6 +21,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.CompilationAbstractions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -138,6 +139,24 @@ namespace Microsoft.AspNetCore.Mvc
{ {
get get
{ {
Type[] razorViewEngineOptionsRegistrations;
if (CompilationServices.Default == null)
{
razorViewEngineOptionsRegistrations = new[]
{
typeof(RazorViewEngineOptionsSetup),
typeof(DependencyContextRazorViewEngineOptionsSetup)
};
}
else
{
razorViewEngineOptionsRegistrations = new[]
{
typeof(RazorViewEngineOptionsSetup)
};
}
return new Dictionary<Type, Type[]>() return new Dictionary<Type, Type[]>()
{ {
{ {
@ -167,12 +186,9 @@ namespace Microsoft.AspNetCore.Mvc
}, },
{ {
typeof(IConfigureOptions<RazorViewEngineOptions>), typeof(IConfigureOptions<RazorViewEngineOptions>),
new Type[] razorViewEngineOptionsRegistrations
{
typeof(RazorViewEngineOptionsSetup),
}
}, },
{ {
typeof(IActionConstraintProvider), typeof(IActionConstraintProvider),
new Type[] new Type[]
{ {

View File

@ -6,21 +6,31 @@
"Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.0.0-*", "Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.Extensions.Logging": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": { "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": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -2,8 +2,8 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"shared": "**/*.cs", "shared": "**/*.cs",
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": { "dotnet5.4": {
"dependencies": { "dependencies": {
"System.Runtime": "4.1.0-*" "System.Runtime": "4.1.0-*"
} }

View File

@ -2,8 +2,8 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"shared": "**/*.cs", "shared": "**/*.cs",
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": { "dotnet5.4": {
"dependencies": { "dependencies": {
"System.Runtime": "4.1.0-*" "System.Runtime": "4.1.0-*"
} }

View File

@ -19,21 +19,29 @@
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*", "Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*",
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
}
},
"net451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -9,20 +9,24 @@
"Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "xunit": "2.1.0"
}, },
"testRunner": "xunit",
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"dependencies": { "dependencies": {
"Moq": "4.2.1312.1622" "Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
}, },
"dnxcore50": { "dnxcore50": {
"imports": "portable-net451+win8",
"dependencies": { "dependencies": {
"moq.netcore": "4.4.0-beta8" "moq.netcore": "4.4.0-beta8",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
} }
} }
} }

View File

@ -46,6 +46,7 @@ namespace ApiExplorerWebSite
{ {
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();

View File

@ -1,3 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel"
}

View File

@ -3,7 +3,8 @@
"web": "ApiExplorerWebSite" "web": "ApiExplorerWebSite"
}, },
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true "emitEntryPoint": true,
"preserveCompilationContext": true
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
@ -14,7 +15,9 @@
"Microsoft.NETCore.Platforms": "1.0.1-*" "Microsoft.NETCore.Platforms": "1.0.1-*"
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "net451": {},
"dnxcore50": {} "dnxcore50": {
"imports": "portable-net451+win8"
}
} }
} }

View File

@ -37,6 +37,7 @@ namespace ApplicationModelWebSite
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultConfiguration(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.Build(); .Build();
host.Run(); host.Run();

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