Added a sample web project

This commit is contained in:
David Fowler 2014-02-14 03:03:02 -08:00
parent 5a22d9b52c
commit 125ca080b5
9 changed files with 140 additions and 12 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
EndProject
@ -49,6 +49,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Startu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor.Host.Test.net45", "test\Microsoft.AspNet.Mvc.Razor.Host.Test\Microsoft.AspNet.Mvc.Razor.Host.Test.net45.csproj", "{537CC0EE-4B62-4789-9AE9-94BE28E0D25A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample.Web.net45", "samples\MvcSample.Web\MvcSample.Web.net45.csproj", "{688ABC8B-BFA9-4CFF-9458-A466FEBB0448}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -119,6 +121,10 @@ Global
{537CC0EE-4B62-4789-9AE9-94BE28E0D25A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{537CC0EE-4B62-4789-9AE9-94BE28E0D25A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{537CC0EE-4B62-4789-9AE9-94BE28E0D25A}.Release|Any CPU.Build.0 = Release|Any CPU
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448}.Debug|Any CPU.Build.0 = Debug|Any CPU
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448}.Release|Any CPU.ActiveCfg = Release|Any CPU
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -141,6 +147,7 @@ Global
{BA88E212-5889-48DC-823F-A3A67DDEF123} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
{43ECCFDF-E646-4766-B339-F5CCD69DD6C3} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
{501817DD-8143-4A50-888D-99896A82CD12} = {222CA408-93EE-473A-9325-D04989EC9FEF}
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448} = {222CA408-93EE-473A-9325-D04989EC9FEF}
{A7D7CD66-A407-4144-8AB7-07F895F87137} = {CE037E26-9EB5-48E2-B73B-06C6FF6CC9F5}
{42195A56-42C0-4CFF-A982-B6E24EFC6356} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{537CC0EE-4B62-4789-9AE9-94BE28E0D25A} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}

View File

@ -0,0 +1,12 @@
using Microsoft.AspNet.Mvc;
namespace MvcSample.Web
{
public class HomeController
{
public string Index()
{
return "Hello World from MVC. Change the controller and save without rebuilding!!";
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.DependencyInjection;
using Microsoft.AspNet.Mvc.Routing;
using Microsoft.AspNet.Mvc.Startup;
using Microsoft.AspNet.Routing.Owin;
using Microsoft.AspNet.Routing.Template;
namespace MvcSample.Web
{
public class Startup
{
public void Configuration(IBuilder app)
{
string appRoot = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
var mvcServices = new MvcServices(appRoot);
var router = app.UseRouter();
var endpoint = ActivatorUtilities.CreateInstance<RouteEndpoint>(mvcServices.Services);
router.Add(new TemplateRoute(
endpoint,
"{controller}/{action}",
new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase) { { "controller", "Home" }, { "action", "Index" } }));
}
}
}

View File

@ -0,0 +1,15 @@
{
"version" : "0.1-alpha-*",
"dependencies": {
"Helios" : "0.1-alpha-*",
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*",
"Microsoft.AspNet.Routing" : "0.1-alpha-*",
"Microsoft.AspNet.Mvc" : "",
"Microsoft.AspNet.Mvc.Startup" : ""
},
"configurations": {
"net45": { },
"k10" : { }
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>

View File

@ -26,18 +26,18 @@ namespace MvcSample
private void ConfigureMvc(IBuilder builder)
{
// HACK appbase doesn't seem to work. When in VS we're pointing at bin\Debug\Net45, so move up 3 directories
string appRoot = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "..", "..", ".."));
string appRoot = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
var mvcServices = new MvcServices(appRoot);
var router = builder.UseRouter();
var endpoint = ActivatorUtilities.CreateInstance<RouteEndpoint>(mvcServices.Services);
router.Add(new TemplateRoute(
endpoint,
"{controller}/{action}",
new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase){ { "controller", "Home"}, { "action", "Index" } }));
endpoint,
"{controller}/{action}",
new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase) { { "controller", "Home" }, { "action", "Index" } }));
}
}
}

View File

@ -1,16 +1,10 @@
{
"version" : "0.1-alpha-*",
"dependencies": {
"Microsoft.AspNet.FileSystems": "0.1-alpha-*",
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*",
"Microsoft.AspNet.Razor" : "0.1-alpha-*",
"Microsoft.AspNet.Routing" : "0.1-alpha-*",
"Microsoft.AspNet.Mvc" : "",
"Microsoft.AspNet.Mvc.ModelBinding" : "",
"Microsoft.AspNet.Mvc.Rendering" : "",
"Microsoft.AspNet.Mvc.Razor" : "",
"Microsoft.AspNet.Mvc.Razor.Host" : "",
"Microsoft.AspNet.Mvc.Startup" : ""
},
"configurations": {