Skip to content

Commit

Permalink
Upgrade Contacts project to ASP.NET Core 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
elanderson committed Jun 5, 2018
1 parent 5758873 commit 0d5b219
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
30 changes: 3 additions & 27 deletions ASP.NET Core Basics/src/Contacts/Contacts.csproj
Original file line number Original file line Diff line number Diff line change
@@ -1,38 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">


<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Contacts</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Contacts</PackageId>
<UserSecretsId>aspnet-Contacts-cd2c7b27-e79c-43c7-b3ef-1ecb04374b70</UserSecretsId> <UserSecretsId>aspnet-Contacts-cd2c7b27-e79c-43c7-b3ef-1ecb04374b70</UserSecretsId>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81</AssetTargetFallback>
</PropertyGroup> </PropertyGroup>


<ItemGroup> <ItemGroup>
<None Update="wwwroot\**\*;Views\**\*;Areas\**\Views"> <PackageReference Include="Microsoft.AspNetCore.App" />
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0" PrivateAssets="All" />
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="BundlerMinifier.Core" Version="2.4.337" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>


<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="bower install" />
<Exec Command="dotnet bundle" />
</Target>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

</Project> </Project>
7 changes: 3 additions & 4 deletions ASP.NET Core Basics/src/Contacts/Program.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
BuildWebHost(args).Run(); CreateWebHostBuilder(args).Build().Run();
} }


public static IWebHost BuildWebHost(string[] args) => public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>();
.Build();
} }
} }
4 changes: 3 additions & 1 deletion ASP.NET Core Basics/src/Contacts/Startup.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Contacts.Models; using Contacts.Models;
using Contacts.Services; using Contacts.Services;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;


namespace Contacts namespace Contacts
Expand Down Expand Up @@ -57,6 +58,8 @@ public void ConfigureServices(IServiceCollection services)
{ {
c.SwaggerDoc("v1", new Info { Title = "Contacts API", Version = "v1"}); c.SwaggerDoc("v1", new Info { Title = "Contacts API", Version = "v1"});
}); });

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
} }


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand All @@ -69,7 +72,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(); app.UseDatabaseErrorPage();
app.UseBrowserLink();
} }
else else
{ {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<p> <p>
@foreach (var provider in Model.OtherLogins) @foreach (var provider in Model.OtherLogins)
{ {
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button> <button type="submit" class="btn btn-default" name="provider" value="@provider.DisplayName" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
} }
</p> </p>
</div> </div>
Expand Down

0 comments on commit 0d5b219

Please sign in to comment.