Skip to content

Commit 9278467

Browse files
committed
Add new mvc core web application project for the monolithic development
1 parent b416203 commit 9278467

62 files changed

Lines changed: 23569 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eShopWeb.sln

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26206.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopWeb", "src\Web\WebMonolithic\eShopWeb\eShopWeb.csproj", "{CA5B730B-7195-4E29-B030-A2007E004B98}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|Any CPU = Release|Any CPU
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.ActiveCfg = Debug|x64
21+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.Build.0 = Debug|x64
22+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.ActiveCfg = Debug|x86
23+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.Build.0 = Debug|x86
24+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.ActiveCfg = Release|x64
27+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.Build.0 = Release|x64
28+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.ActiveCfg = Release|x86
29+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.Build.0 = Release|x86
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
EndGlobal

src/Web/WebMonolithic/eShopWeb.sln

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26206.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopWeb", "eShopWeb\eShopWeb.csproj", "{CA5B730B-7195-4E29-B030-A2007E004B98}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|Any CPU = Release|Any CPU
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.ActiveCfg = Debug|x64
21+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.Build.0 = Debug|x64
22+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.ActiveCfg = Debug|x86
23+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.Build.0 = Debug|x86
24+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.ActiveCfg = Release|x64
27+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.Build.0 = Release|x64
28+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.ActiveCfg = Release|x86
29+
{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.Build.0 = Release|x86
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
EndGlobal
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "wwwroot/lib"
3+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace eShopWeb.Controllers
8+
{
9+
public class HomeController : Controller
10+
{
11+
public IActionResult Index()
12+
{
13+
return View();
14+
}
15+
16+
public IActionResult About()
17+
{
18+
ViewData["Message"] = "Your application description page.";
19+
20+
return View();
21+
}
22+
23+
public IActionResult Contact()
24+
{
25+
ViewData["Message"] = "Your contact page.";
26+
27+
return View();
28+
}
29+
30+
public IActionResult Error()
31+
{
32+
return View();
33+
}
34+
}
35+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Hosting;
7+
8+
namespace eShopWeb
9+
{
10+
public class Program
11+
{
12+
public static void Main(string[] args)
13+
{
14+
var host = new WebHostBuilder()
15+
.UseKestrel()
16+
.UseContentRoot(Directory.GetCurrentDirectory())
17+
.UseIISIntegration()
18+
.UseStartup<Startup>()
19+
.UseApplicationInsights()
20+
.Build();
21+
22+
host.Run();
23+
}
24+
}
25+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:58298/",
7+
"sslPort": 0
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"eShopWeb": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development"
23+
},
24+
"applicationUrl": "http://localhost:58299"
25+
}
26+
}
27+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+

2+
ASP.NET MVC core dependencies have been added to the project.
3+
However you may still need to do make changes to your project.
4+
5+
1. Suggested changes to Startup class:
6+
1.1 Add a constructor:
7+
public IConfigurationRoot Configuration { get; }
8+
9+
public Startup(IHostingEnvironment env)
10+
{
11+
var builder = new ConfigurationBuilder()
12+
.SetBasePath(env.ContentRootPath)
13+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
14+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
15+
.AddEnvironmentVariables();
16+
Configuration = builder.Build();
17+
}
18+
1.2 Add MVC services:
19+
public void ConfigureServices(IServiceCollection services)
20+
{
21+
// Add framework services.
22+
services.AddMvc();
23+
}
24+
25+
1.3 Configure web app to use use Configuration and use MVC routing:
26+
27+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
28+
{
29+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
30+
loggerFactory.AddDebug();
31+
32+
if (env.IsDevelopment())
33+
{
34+
app.UseDeveloperExceptionPage();
35+
}
36+
else
37+
{
38+
app.UseExceptionHandler("/Home/Error");
39+
}
40+
41+
app.UseStaticFiles();
42+
43+
app.UseMvc(routes =>
44+
{
45+
routes.MapRoute(
46+
name: "default",
47+
template: "{controller=Home}/{action=Index}/{id?}");
48+
});
49+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.Extensions.Configuration;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace eShopWeb
12+
{
13+
public class Startup
14+
{
15+
public Startup(IHostingEnvironment env)
16+
{
17+
var builder = new ConfigurationBuilder()
18+
.SetBasePath(env.ContentRootPath)
19+
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
20+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
21+
.AddEnvironmentVariables();
22+
Configuration = builder.Build();
23+
}
24+
25+
public IConfigurationRoot Configuration { get; }
26+
27+
// This method gets called by the runtime. Use this method to add services to the container.
28+
public void ConfigureServices(IServiceCollection services)
29+
{
30+
// Add framework services.
31+
services.AddMvc();
32+
}
33+
34+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
36+
{
37+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
38+
loggerFactory.AddDebug();
39+
40+
if (env.IsDevelopment())
41+
{
42+
app.UseDeveloperExceptionPage();
43+
app.UseBrowserLink();
44+
}
45+
else
46+
{
47+
app.UseExceptionHandler("/Home/Error");
48+
}
49+
50+
app.UseStaticFiles();
51+
52+
app.UseMvc(routes =>
53+
{
54+
routes.MapRoute(
55+
name: "default",
56+
template: "{controller=Home}/{action=Index}/{id?}");
57+
});
58+
}
59+
}
60+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@{
2+
ViewData["Title"] = "About";
3+
}
4+
<h2>@ViewData["Title"].</h2>
5+
<h3>@ViewData["Message"]</h3>
6+
7+
<p>Use this area to provide additional information.</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@{
2+
ViewData["Title"] = "Contact";
3+
}
4+
<h2>@ViewData["Title"].</h2>
5+
<h3>@ViewData["Message"]</h3>
6+
7+
<address>
8+
One Microsoft Way<br />
9+
Redmond, WA 98052-6399<br />
10+
<abbr title="Phone">P:</abbr>
11+
425.555.0100
12+
</address>
13+
14+
<address>
15+
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
16+
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
17+
</address>

0 commit comments

Comments
 (0)