Allow MvcRazorHost to run on vanilla .NET45

- Added net45 target and removed specific aspnet50 and aspnetcore50 APIs
from that code path.
This commit is contained in:
David Fowler 2014-09-11 10:42:08 -07:00
Родитель 6944fd4bc4
Коммит 29baf80161
2 изменённых файлов: 29 добавлений и 4 удалений

Просмотреть файл

@ -9,7 +9,10 @@ using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
#if ASPNET50 || ASPNETCORE50
using Microsoft.Framework.Runtime; using Microsoft.Framework.Runtime;
#endif
namespace Microsoft.AspNet.Mvc.Razor namespace Microsoft.AspNet.Mvc.Razor
{ {
@ -36,6 +39,7 @@ namespace Microsoft.AspNet.Mvc.Razor
// This field holds the type name without the generic decoration (MyBaseType) // This field holds the type name without the generic decoration (MyBaseType)
private readonly string _baseType; private readonly string _baseType;
#if ASPNET50 || ASPNETCORE50
/// <summary> /// <summary>
/// Initializes a new instance of <see cref="MvcRazorHost"/> with the specified /// Initializes a new instance of <see cref="MvcRazorHost"/> with the specified
/// <param name="appEnvironment"/>. /// <param name="appEnvironment"/>.
@ -45,6 +49,18 @@ namespace Microsoft.AspNet.Mvc.Razor
: this(new PhysicalFileSystem(appEnvironment.ApplicationBasePath)) : this(new PhysicalFileSystem(appEnvironment.ApplicationBasePath))
{ {
} }
#elif NET45
/// <summary>
/// Initializes a new instance of <see cref="MvcRazorHost"/> with the specified
/// <param name="root"/>.
/// </summary>
/// <param name="root">The path to the application base.</param>
public MvcRazorHost(string root) :
this(new PhysicalFileSystem(root))
{
}
#endif
/// <summary> /// <summary>
/// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="fileSystem"/>. /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="fileSystem"/>.

Просмотреть файл

@ -6,11 +6,10 @@
"dependencies": { "dependencies": {
"Microsoft.AspNet.FileSystems": "1.0.0-*", "Microsoft.AspNet.FileSystems": "1.0.0-*",
"Microsoft.AspNet.Mvc.Common": "", "Microsoft.AspNet.Mvc.Common": "",
"Microsoft.AspNet.Razor": "4.0.0-*", "Microsoft.AspNet.Razor": "4.0.0-*"
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
}, },
"frameworks": { "frameworks": {
"aspnet50": { "net45": {
"dependencies": { "dependencies": {
"System.Collections": "", "System.Collections": "",
"System.Runtime": "", "System.Runtime": "",
@ -18,6 +17,15 @@
"System.Xml.Linq": "" "System.Xml.Linq": ""
} }
}, },
"aspnet50": {
"dependencies": {
"System.Collections": "",
"System.Runtime": "",
"System.Xml": "",
"System.Xml.Linq": "",
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
}
},
"aspnetcore50": { "aspnetcore50": {
"dependencies": { "dependencies": {
"System.Collections": "4.0.10.0", "System.Collections": "4.0.10.0",
@ -36,7 +44,8 @@
"System.Runtime": "4.0.20.0", "System.Runtime": "4.0.20.0",
"System.Runtime.Extensions": "4.0.10.0", "System.Runtime.Extensions": "4.0.10.0",
"System.Runtime.InteropServices": "4.0.20.0", "System.Runtime.InteropServices": "4.0.20.0",
"System.Threading.Tasks": "4.0.10.0" "System.Threading.Tasks": "4.0.10.0",
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
} }
} }
} }