Skip to content

Commit

Permalink
Update app to ASP.NET Core 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaddie committed Jun 29, 2018
1 parent a526c57 commit 2ff91f3
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 37 deletions.
3 changes: 2 additions & 1 deletion README.md
@@ -1,2 +1,3 @@
# TagHelpersDemo
An ASP.NET Core MVC application demonstrating the use of tag helpers

An ASP.NET Core MVC app demonstrating the use of [Tag Helpers](https://docs.microsoft.com/aspnet/core/mvc/views/tag-helpers/intro)
7 changes: 4 additions & 3 deletions TagHelpersDemo.Tests/TagHelpersDemo.Tests.csproj
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.2" />
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="2.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions TagHelpersDemo.sln
Expand Up @@ -9,11 +9,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
global.json = global.json
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagHelpersDemo.Tests", "TagHelpersDemo.Tests\TagHelpersDemo.Tests.csproj", "{823B7081-4304-4D16-A2D8-28B30F1CEB7A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TagHelpersDemo.Tests", "TagHelpersDemo.Tests\TagHelpersDemo.Tests.csproj", "{823B7081-4304-4D16-A2D8-28B30F1CEB7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
9 changes: 4 additions & 5 deletions TagHelpersDemo/Program.cs
Expand Up @@ -5,12 +5,11 @@ namespace TagHelpersDemo
{
public class Program
{
public static void Main(string[] args) =>
BuildWebHost(args).Run();
public static void Main(string[] args) =>
CreateWebHostBuilder(args).Build().Run();

public static IWebHost BuildWebHost(string[] args) =>
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
.UseStartup<Startup>();
}
}
15 changes: 5 additions & 10 deletions TagHelpersDemo/Startup.cs
@@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using TagHelpersDemo.Services;

namespace TagHelpersDemo
Expand All @@ -14,31 +14,26 @@ public class Startup

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<ICardSuitService, CardSuitService>();

// Add framework services.
services.AddMvc();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();

if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
Expand Down
9 changes: 3 additions & 6 deletions TagHelpersDemo/TagHelpersDemo.csproj
@@ -1,15 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<ProjectUISubcaption>.NET Core 2.0</ProjectUISubcaption>
<TargetFramework>netcoreapp2.1</TargetFramework>
<ProjectUISubcaption>.NET Core 2.1</ProjectUISubcaption>
</PropertyGroup>
<ItemGroup>
<Compile Update="Views\Shared\Partials\CardViewModel.cs" DependentUpon="_Card.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions TagHelpersDemo/appsettings.Development.json
@@ -1,10 +1,9 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
}
6 changes: 3 additions & 3 deletions TagHelpersDemo/appsettings.json
@@ -1,8 +1,8 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}
},
"AllowedHosts": "*"
}
5 changes: 0 additions & 5 deletions global.json

This file was deleted.

0 comments on commit 2ff91f3

Please sign in to comment.