From 5ea11e396d85b7aed07c0feeb8f4da64b88512d3 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sat, 15 Feb 2014 01:20:32 -0800 Subject: [PATCH] Added first core clr enabled sample. --- samples/MvcSample.Web/HomeController.cs | 9 +++++++-- samples/MvcSample.Web/Startup.cs | 7 ++++++- samples/MvcSample.Web/Views/Home/Test.cshtml | 1 + samples/MvcSample.Web/web.config | 4 +++- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 samples/MvcSample.Web/Views/Home/Test.cshtml diff --git a/samples/MvcSample.Web/HomeController.cs b/samples/MvcSample.Web/HomeController.cs index 427e1e9c32..42854ec242 100644 --- a/samples/MvcSample.Web/HomeController.cs +++ b/samples/MvcSample.Web/HomeController.cs @@ -2,11 +2,16 @@ namespace MvcSample.Web { - public class HomeController + public class HomeController : Controller { public string Index() { - return "Hello World from MVC. Change the controller and save without rebuilding!!"; + return "Hello from the new MVC"; + } + + public IActionResult Test() + { + return View(); } } } \ No newline at end of file diff --git a/samples/MvcSample.Web/Startup.cs b/samples/MvcSample.Web/Startup.cs index 5814be2e8b..d6ab3c79ff 100644 --- a/samples/MvcSample.Web/Startup.cs +++ b/samples/MvcSample.Web/Startup.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reflection; using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.DependencyInjection; using Microsoft.AspNet.Mvc.Routing; @@ -13,7 +14,11 @@ namespace MvcSample.Web { public void Configuration(IBuilder app) { - string appRoot = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; +#if NET45 + var appRoot = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; +#else + var appRoot = (string)typeof(AppDomain).GetRuntimeMethod("GetData", new[] { typeof(string) }).Invoke(AppDomain.CurrentDomain, new object[] { "APPBASE" }); +#endif var mvcServices = new MvcServices(appRoot); diff --git a/samples/MvcSample.Web/Views/Home/Test.cshtml b/samples/MvcSample.Web/Views/Home/Test.cshtml new file mode 100644 index 0000000000..4f466c7c3f --- /dev/null +++ b/samples/MvcSample.Web/Views/Home/Test.cshtml @@ -0,0 +1 @@ +Hello From Razor \ No newline at end of file diff --git a/samples/MvcSample.Web/web.config b/samples/MvcSample.Web/web.config index 787aa09c3f..7bab44e5cd 100644 --- a/samples/MvcSample.Web/web.config +++ b/samples/MvcSample.Web/web.config @@ -1,6 +1,8 @@  - + + +