Set CompatibilityVersion for templates (#240)

Addresses #235
This commit is contained in:
Jass Bagga 2018-01-18 16:11:09 -08:00 committed by GitHub
parent 785424eeaf
commit 767a857635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 87 additions and 66 deletions

View File

@ -4,44 +4,44 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Package Versions"> <PropertyGroup Label="Package Versions">
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15670</InternalAspNetCoreSdkPackageVersion> <InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15670</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreAllPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreAllPackageVersion> <MicrosoftAspNetCoreAllPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion> <MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion> <MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion> <MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion> <MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
<MicrosoftAspNetCoreCookiePolicyPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreCookiePolicyPackageVersion> <MicrosoftAspNetCoreCookiePolicyPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreCookiePolicyPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion> <MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreHttpsPolicyPackageVersion> <MicrosoftAspNetCoreHttpsPolicyPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreHttpsPolicyPackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion> <MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityUIPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreIdentityUIPackageVersion> <MicrosoftAspNetCoreIdentityUIPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreIdentityUIPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreMvcPackageVersion> <MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion> <MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>
<MicrosoftAspNetCorePackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCorePackageVersion> <MicrosoftAspNetCorePackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCorePackageVersion>
<MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion> <MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>
<MicrosoftAspNetCoreSpaServicesPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreSpaServicesPackageVersion> <MicrosoftAspNetCoreSpaServicesPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreSpaServicesPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreStaticFilesPackageVersion> <MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview1-28092</MicrosoftAspNetCoreTestingPackageVersion> <MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview1-28112</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>15.3.409</MicrosoftBuildFrameworkPackageVersion> <MicrosoftBuildFrameworkPackageVersion>15.3.409</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.3.409</MicrosoftBuildUtilitiesCorePackageVersion> <MicrosoftBuildUtilitiesCorePackageVersion>15.3.409</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview1-28092</MicrosoftEntityFrameworkCoreDesignPackageVersion> <MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview1-28112</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<MicrosoftEntityFrameworkCoreSqlitePackageVersion>2.1.0-preview1-28092</MicrosoftEntityFrameworkCoreSqlitePackageVersion> <MicrosoftEntityFrameworkCoreSqlitePackageVersion>2.1.0-preview1-28112</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview1-28092</MicrosoftEntityFrameworkCoreSqlServerPackageVersion> <MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview1-28112</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion>2.1.0-preview1-28092</MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion> <MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion>2.1.0-preview1-28112</MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview1-28092</MicrosoftEntityFrameworkCoreToolsPackageVersion> <MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview1-28112</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview1-28092</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion> <MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview1-28112</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsProcessSourcesPackageVersion>2.1.0-preview1-28092</MicrosoftExtensionsProcessSourcesPackageVersion> <MicrosoftExtensionsProcessSourcesPackageVersion>2.1.0-preview1-28112</MicrosoftExtensionsProcessSourcesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion> <MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-26102-01</MicrosoftNETCoreApp21PackageVersion> <MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-26115-03</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion> <MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
<MicrosoftVisualStudioWebBrowserLinkPackageVersion>2.1.0-preview1-28092</MicrosoftVisualStudioWebBrowserLinkPackageVersion> <MicrosoftVisualStudioWebBrowserLinkPackageVersion>2.1.0-preview1-28112</MicrosoftVisualStudioWebBrowserLinkPackageVersion>
<MicrosoftVisualStudioWebCodeGenerationDesignPackageVersion>2.1.0-preview1-28092</MicrosoftVisualStudioWebCodeGenerationDesignPackageVersion> <MicrosoftVisualStudioWebCodeGenerationDesignPackageVersion>2.1.0-preview1-28112</MicrosoftVisualStudioWebCodeGenerationDesignPackageVersion>
<MicrosoftVisualStudioWebCodeGenerationToolsPackageVersion>2.1.0-preview1-28092</MicrosoftVisualStudioWebCodeGenerationToolsPackageVersion> <MicrosoftVisualStudioWebCodeGenerationToolsPackageVersion>2.1.0-preview1-28112</MicrosoftVisualStudioWebCodeGenerationToolsPackageVersion>
<NETStandardLibraryPackageVersion>2.0.0</NETStandardLibraryPackageVersion> <NETStandardLibraryPackageVersion>2.0.0</NETStandardLibraryPackageVersion>
<SeleniumFirefoxWebDriverPackageVersion>0.19.0</SeleniumFirefoxWebDriverPackageVersion> <SeleniumFirefoxWebDriverPackageVersion>0.19.0</SeleniumFirefoxWebDriverPackageVersion>
<SeleniumSupportPackageVersion>3.7.0</SeleniumSupportPackageVersion> <SeleniumSupportPackageVersion>3.7.0</SeleniumSupportPackageVersion>
<SeleniumWebDriverMicrosoftDriverPackageVersion>16.16299.0</SeleniumWebDriverMicrosoftDriverPackageVersion> <SeleniumWebDriverMicrosoftDriverPackageVersion>16.16299.0</SeleniumWebDriverMicrosoftDriverPackageVersion>
<SeleniumWebDriverPackageVersion>3.7.0</SeleniumWebDriverPackageVersion> <SeleniumWebDriverPackageVersion>3.7.0</SeleniumWebDriverPackageVersion>
<SystemSecurityPermissionsPackageVersion>4.5.0-preview1-26102-01</SystemSecurityPermissionsPackageVersion> <SystemSecurityPermissionsPackageVersion>4.5.0-preview1-26112-01</SystemSecurityPermissionsPackageVersion>
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion> <XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion> <XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion> <XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -23,7 +24,7 @@ namespace AureliaSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection 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. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -23,7 +24,7 @@ namespace KnockoutSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection 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. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -23,7 +24,7 @@ namespace VueSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection 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. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Http;
#endif #endif
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
#if (OrganizationalAuth) #if (OrganizationalAuth)
using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Authorization;
#endif #endif
@ -65,24 +66,24 @@ namespace Company.WebApplication1
#else #else
options.UseSqlite( options.UseSqlite(
Configuration.GetConnectionString("DefaultConnection"), Configuration.GetConnectionString("DefaultConnection"),
sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1"))); sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1")
));
#endif #endif
services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128) services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<IdentityDbContext>() .AddEntityFrameworkStores<IdentityDbContext>()
.AddDefaultUI() .AddDefaultUI()
.AddDefaultTokenProviders(); .AddDefaultTokenProviders();
#elseif (OrganizationalAuth || IndividualB2CAuth) #elif (OrganizationalAuth || IndividualB2CAuth)
services.AddAuthentication(sharedOptions => services.AddAuthentication(sharedOptions =>
{ {
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
}) })
#if (OrganizationalAuth) #if (OrganizationalAuth)
.AddAzureAd(options => Configuration.Bind("AzureAd", options)) .AddAzureAd(options => Configuration.Bind("AzureAd", options))
#elseif (IndividualB2CAuth) #elif (IndividualB2CAuth)
.AddAzureAdB2C(options => Configuration.Bind("AzureAdB2C", options)) .AddAzureAdB2C(options => Configuration.Bind("AzureAdB2C", options))
#endif #endif
.AddCookie(); .AddCookie();
@ -93,9 +94,10 @@ namespace Company.WebApplication1
{ {
options.Conventions.AuthorizeFolder("/Account/Manage"); options.Conventions.AuthorizeFolder("/Account/Manage");
options.Conventions.AuthorizePage("/Account/Logout"); options.Conventions.AuthorizePage("/Account/Logout");
}); })
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
#elseif (OrganizationalAuth) #elif (OrganizationalAuth)
services.AddMvc(options => services.AddMvc(options =>
{ {
var policy = new AuthorizationPolicyBuilder() var policy = new AuthorizationPolicyBuilder()
@ -106,9 +108,10 @@ namespace Company.WebApplication1
.AddRazorPagesOptions(options => .AddRazorPagesOptions(options =>
{ {
options.Conventions.AllowAnonymousToFolder("/Account"); options.Conventions.AllowAnonymousToFolder("/Account");
}); })
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
#else #else
services.AddMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
#endif #endif
} }

View File

@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
#endif #endif
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
#if (IndividualLocalAuth) #if (IndividualLocalAuth)
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
#endif #endif
@ -42,32 +43,33 @@ namespace Company.WebApplication1
{ {
#if (IndividualLocalAuth) #if (IndividualLocalAuth)
services.AddDbContext<IdentityDbContext>(options => services.AddDbContext<IdentityDbContext>(options =>
#if (UseLocalDB) #if (UseLocalDB)
options.UseSqlServer( options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection"), Configuration.GetConnectionString("DefaultConnection"),
sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1") sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1")
)); ));
#else #else
options.UseSqlite( options.UseSqlite(
Configuration.GetConnectionString("DefaultConnection"), Configuration.GetConnectionString("DefaultConnection"),
sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1"))); sqlOptions => sqlOptions.MigrationsAssembly("Company.WebApplication1")
#endif ));
#endif
services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128) services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<IdentityDbContext>() .AddEntityFrameworkStores<IdentityDbContext>()
.AddDefaultUI() .AddDefaultUI()
.AddDefaultTokenProviders(); .AddDefaultTokenProviders();
#elseif (OrganizationalAuth || IndividualB2CAuth) #elif (OrganizationalAuth || IndividualB2CAuth)
services.AddAuthentication(sharedOptions => services.AddAuthentication(sharedOptions =>
{ {
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
}) })
#if (OrganizationalAuth) #if (OrganizationalAuth)
.AddAzureAd(options => Configuration.Bind("AzureAd", options)) .AddAzureAd(options => Configuration.Bind("AzureAd", options))
#elseif (IndividualB2CAuth) #elif (IndividualB2CAuth)
.AddAzureAdB2C(options => Configuration.Bind("AzureAdB2C", options)) .AddAzureAdB2C(options => Configuration.Bind("AzureAdB2C", options))
#endif #endif
.AddCookie(); .AddCookie();
@ -78,7 +80,7 @@ namespace Company.WebApplication1
options.CheckConsentNeeded = context => true; options.CheckConsentNeeded = context => true;
}); });
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. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -7,6 +7,7 @@ open System.Threading.Tasks
open Microsoft.AspNetCore.Builder open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.HttpsPolicy open Microsoft.AspNetCore.HttpsPolicy
open Microsoft.AspNetCore.Mvc
open Microsoft.Extensions.Configuration open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection open Microsoft.Extensions.DependencyInjection
@ -18,7 +19,7 @@ type Startup private () =
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
member this.ConfigureServices(services: IServiceCollection) = member this.ConfigureServices(services: IServiceCollection) =
// Add framework services. // Add framework services.
services.AddMvc() |> ignore services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1) |> ignore
// 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.
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) = member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
#if (OrganizationalAuth || IndividualB2CAuth) #if (OrganizationalAuth || IndividualB2CAuth)
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -35,12 +36,12 @@ namespace Company.WebApplication1
}) })
#if (IndividualB2CAuth) #if (IndividualB2CAuth)
.AddAzureAdB2CBearer(options => Configuration.Bind("AzureAdB2C", options)); .AddAzureAdB2CBearer(options => Configuration.Bind("AzureAdB2C", options));
#elseif (OrganizationalAuth) #elif (OrganizationalAuth)
.AddAzureAdBearer(options => Configuration.Bind("AzureAd", options)); .AddAzureAdBearer(options => Configuration.Bind("AzureAd", options));
#endif #endif
#endif #endif
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. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -7,6 +7,7 @@ open System.Threading.Tasks
open Microsoft.AspNetCore.Builder open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.HttpsPolicy open Microsoft.AspNetCore.HttpsPolicy
open Microsoft.AspNetCore.Mvc
open Microsoft.Extensions.Configuration open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection open Microsoft.Extensions.DependencyInjection
@ -18,7 +19,7 @@ type Startup private () =
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
member this.ConfigureServices(services: IServiceCollection) = member this.ConfigureServices(services: IServiceCollection) =
// Add framework services. // Add framework services.
services.AddMvc() |> ignore services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1) |> ignore
// 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.
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) = member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.AngularCli; using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -18,7 +19,7 @@ namespace AngularSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// In production, the Angular files will be served from this directory // In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration => services.AddSpaStaticFiles(configuration =>

View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -19,7 +20,7 @@ namespace ReactSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// In production, the React files will be served from this directory // In production, the React files will be served from this directory
services.AddSpaStaticFiles(configuration => services.AddSpaStaticFiles(configuration =>

View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -19,7 +20,7 @@ namespace ReactReduxSpa
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// In production, the React files will be served from this directory // In production, the React files will be served from this directory
services.AddSpaStaticFiles(configuration => services.AddSpaStaticFiles(configuration =>

View File

@ -14,7 +14,8 @@ namespace Templates.Test
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public void EmptyWebTemplate_Works_NetFramework() public void EmptyWebTemplate_Works_NetFramework()
=> EmptyWebTemplateImpl("net461"); => EmptyWebTemplateImpl("net461");

View File

@ -14,7 +14,8 @@ namespace Templates.Test
} }
[ConditionalTheory] [ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(null)] [InlineData(null)]
[InlineData("F#")] [InlineData("F#")]
public void MvcTemplate_NoAuth_Works_NetFramework(string languageOverride) public void MvcTemplate_NoAuth_Works_NetFramework(string languageOverride)
@ -55,7 +56,8 @@ namespace Templates.Test
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public void MvcTemplate_IndividualAuth_Works_NetFramework() public void MvcTemplate_IndividualAuth_Works_NetFramework()
=> MvcTemplate_IndividualAuthImpl("net461"); => MvcTemplate_IndividualAuthImpl("net461");

View File

@ -14,7 +14,8 @@ namespace Templates.Test
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public void RazorPagesTemplate_NoAuth_Works_NetFramework() public void RazorPagesTemplate_NoAuth_Works_NetFramework()
=> RazorPagesTemplate_NoAuthImpl("net461"); => RazorPagesTemplate_NoAuthImpl("net461");
@ -47,7 +48,8 @@ namespace Templates.Test
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public void RazorPagesTemplate_IndividualAuth_Works_NetFramework() public void RazorPagesTemplate_IndividualAuth_Works_NetFramework()
=> RazorPagesTemplate_IndividualAuthImpl("net461"); => RazorPagesTemplate_IndividualAuthImpl("net461");

View File

@ -11,7 +11,8 @@ namespace Templates.Test.SpaTemplateTest
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
// Just use 'angular' as representative for .NET 4.6.1 coverage, as // Just use 'angular' as representative for .NET 4.6.1 coverage, as
// the client-side code isn't affected by the .NET runtime choice // the client-side code isn't affected by the .NET runtime choice
public void AngularTemplate_Works_NetFramework() public void AngularTemplate_Works_NetFramework()

View File

@ -14,7 +14,8 @@ namespace Templates.Test
} }
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public void WebApiTemplate_Works_NetFramework() public void WebApiTemplate_Works_NetFramework()
=> WebApiTemplateImpl("net461"); => WebApiTemplateImpl("net461");