From badb6ce8e5333816862557e0cb5c657b817ca8c1 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Sat, 11 Mar 2017 20:49:51 -0800 Subject: [PATCH] Remove net451 as a cross-compile target --- build/dependencies.props | 1 + samples/MvcSandbox/MvcSandbox.csproj | 4 +- ...crosoft.AspNetCore.Mvc.Abstractions.csproj | 7 +-- ...icrosoft.AspNetCore.Mvc.ApiExplorer.csproj | 2 +- .../BindAttribute.cs | 2 +- .../ChallengeResult.cs | 4 +- .../ForbidResult.cs | 4 +- .../Infrastructure/ActionContextAccessor.cs | 23 -------- .../Internal/ActionSelectionDecisionTree.cs | 3 -- .../Internal/AmbiguousActionException.cs | 12 +++-- .../Internal/ClientValidatorCache.cs | 3 +- .../Internal/EmptyArray.cs | 19 ------- .../Internal/FilterFactory.cs | 2 +- .../Internal/NonDisposableStream.cs | 52 ++++++++++--------- .../Internal/PrefixContainer.cs | 2 +- .../Internal/TaskCache.cs | 4 -- .../Internal/ValidatorCache.cs | 3 +- .../Microsoft.AspNetCore.Mvc.Core.csproj | 2 +- .../ModelBinding/Binders/ArrayModelBinder.cs | 2 +- .../Microsoft.AspNetCore.Mvc.Cors.csproj | 2 +- ...soft.AspNetCore.Mvc.DataAnnotations.csproj | 2 +- ...soft.AspNetCore.Mvc.Formatters.Json.csproj | 2 +- .../Internal/FormattingUtilities.cs | 7 ++- ...osoft.AspNetCore.Mvc.Formatters.Xml.csproj | 2 +- ...mlDataContractSerializerOutputFormatter.cs | 5 +- .../LocalizedHtmlString.cs | 4 +- ...crosoft.AspNetCore.Mvc.Localization.csproj | 2 +- ...Microsoft.AspNetCore.Mvc.Razor.Host.csproj | 2 +- .../Compilation/ViewsFeatureProvider.cs | 3 ++ .../Internal/CSharpCompiler.cs | 6 ++- .../Internal/CompilerCacheResult.cs | 2 +- .../DefaultRoslynCompilationService.cs | 7 +-- .../Internal/SymbolsUtility.cs | 5 +- .../LanguageViewLocationExpander.cs | 4 -- .../Microsoft.AspNetCore.Mvc.Razor.csproj | 2 +- .../RazorViewEngine.cs | 2 +- .../DefaultPageModelActivatorProvider.cs | 2 +- .../Internal/PageActionInvoker.cs | 2 +- ...Microsoft.AspNetCore.Mvc.RazorPages.csproj | 2 +- .../Internal/CryptographyAlgorithms.cs | 4 +- .../Internal/GlobbingUrlBuilder.cs | 4 +- ...Microsoft.AspNetCore.Mvc.TagHelpers.csproj | 2 +- .../MvcViewFeaturesLoggerExtensions.cs | 2 +- .../Internal/ValidationHelpers.cs | 4 +- ...crosoft.AspNetCore.Mvc.ViewFeatures.csproj | 2 +- .../RemoteAttribute.cs | 4 +- .../ContentNegotiator/CollectionExtensions.cs | 3 ++ .../ContentNegotiationResult.cs | 3 ++ .../DefaultContentNegotiator.cs | 3 ++ .../ContentNegotiator/FormDataCollection.cs | 4 +- .../ContentNegotiator/FormattingUtilities.cs | 7 ++- .../ContentNegotiator/IContentNegotiator.cs | 3 ++ .../ListWrapperCollection.cs | 3 ++ .../ContentNegotiator/MediaTypeConstants.cs | 3 ++ .../MediaTypeFormatterMatch.cs | 3 ++ .../MediaTypeFormatterMatchRanking.cs | 3 ++ .../MediaTypeHeaderValueExtensions.cs | 3 ++ .../MediaTypeWithQualityHeaderComparer.cs | 3 ++ .../ParsedMediaTypeHeaderValue.cs | 3 ++ .../StringWithQualityHeaderValueComparer.cs | 3 ++ .../HttpRequestMessageExtensions.cs | 6 ++- ...oft.AspNetCore.Mvc.WebApiCompatShim.csproj | 2 +- .../Microsoft.AspNetCore.Mvc.csproj | 2 +- ...ft.AspNetCore.Mvc.Abstractions.Test.csproj | 4 +- ...oft.AspNetCore.Mvc.ApiExplorer.Test.csproj | 4 +- .../ActionContextAccessorTests.cs | 5 +- .../Internal/AttributeRoutingTest.cs | 2 - ...efaultAssemblyPartDiscoveryProviderTest.cs | 2 +- .../Microsoft.AspNetCore.Mvc.Core.Test.csproj | 4 +- .../NonDisposableStreamTest.cs | 31 +++++------ .../Microsoft.AspNetCore.Mvc.Cors.Test.csproj | 4 +- ...AspNetCore.Mvc.DataAnnotations.Test.csproj | 4 +- .../JsonOutputFormatterTests.cs | 10 +++- ...AspNetCore.Mvc.Formatters.Json.Test.csproj | 4 +- ....AspNetCore.Mvc.Formatters.Xml.Test.csproj | 4 +- .../XmlSerializerInputFormatterTest.cs | 2 +- .../CompilationOptionsTests.cs | 14 ++--- .../ErrorPageTests.cs | 2 +- ...soft.AspNetCore.Mvc.FunctionalTests.csproj | 8 +-- .../WebApiCompatShimBasicTest.cs | 5 +- ...oft.AspNetCore.Mvc.IntegrationTests.csproj | 4 +- ...ft.AspNetCore.Mvc.Localization.Test.csproj | 4 +- ...soft.AspNetCore.Mvc.Razor.Host.Test.csproj | 6 ++- .../Compilation/ViewsFeatureProviderTest.cs | 7 ++- ...Microsoft.AspNetCore.Mvc.Razor.Test.csproj | 6 ++- ...soft.AspNetCore.Mvc.RazorPages.Test.csproj | 4 +- ...soft.AspNetCore.Mvc.TagHelpers.Test.csproj | 4 +- .../Microsoft.AspNetCore.Mvc.Test.csproj | 6 ++- ...Microsoft.AspNetCore.Mvc.TestCommon.csproj | 2 +- ...pNetCore.Mvc.TestDiagnosticListener.csproj | 2 +- ...ft.AspNetCore.Mvc.ViewFeatures.Test.csproj | 4 +- .../DefaultContentNegotiatorTest.cs | 37 ++++++++----- .../HttpRequestMessageExtensionsTest.cs | 5 +- ...AspNetCore.Mvc.WebApiCompatShimTest.csproj | 9 ++-- .../Mocks/MockContentNegotiator.cs | 8 +-- .../Mocks/MockMediaTypeMapping.cs | 5 +- .../ApiExplorerWebSite.csproj | 4 +- .../ApplicationModelWebSite.csproj | 4 +- .../WebSites/BasicWebSite/BasicWebSite.csproj | 4 +- ...ControllersFromServicesClassLibrary.csproj | 2 +- .../ControllersFromServicesWebSite.csproj | 4 +- test/WebSites/CorsWebSite/CorsWebSite.csproj | 4 +- .../ErrorPageMiddlewareWebSite.csproj | 4 +- .../WebSites/FilesWebSite/FilesWebSite.csproj | 4 +- .../FiltersWebSite/FiltersWebSite.csproj | 4 +- .../FormatterWebSite/FormatterWebSite.csproj | 4 +- .../HtmlGenerationWebSite.csproj | 4 +- ...ft.AspNetCore.Mvc.TestConfiguration.csproj | 2 +- ...PageExecutionInstrumentationWebSite.csproj | 4 +- .../RazorPagesWebSite.csproj | 4 +- ...wsConsumingCompilationOptionsController.cs | 2 +- .../WebSites/RazorWebSite/RazorWebSite.csproj | 12 ++--- .../Services/FrameworkSpecificHelper.cs | 24 +++++---- test/WebSites/RazorWebSite/Startup.cs | 4 +- .../_Partial.cshtml | 8 +-- .../RoutingWebSite/RoutingWebSite.csproj | 4 +- .../SecurityWebSite/SecurityWebSite.csproj | 4 +- .../SimpleWebSite/SimpleWebSite.csproj | 4 +- .../TagHelpersWebSite.csproj | 4 +- .../UserClassLibrary/UserClassLibrary.csproj | 2 +- .../VersioningWebSite.csproj | 4 +- .../WebApiCompatShimWebSite.csproj | 8 +-- .../XmlFormattersWebSite.csproj | 4 +- 123 files changed, 357 insertions(+), 296 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Mvc.Core/Internal/EmptyArray.cs diff --git a/build/dependencies.props b/build/dependencies.props index 59ea12affc..58bd358063 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -8,6 +8,7 @@ 1.6.1 1.0.0-* 1.3.0 + 2.0.0-* 15.0.0 5.2.2 2.2.0 diff --git a/samples/MvcSandbox/MvcSandbox.csproj b/samples/MvcSandbox/MvcSandbox.csproj index aa438fcd96..c32cb34695 100644 --- a/samples/MvcSandbox/MvcSandbox.csproj +++ b/samples/MvcSandbox/MvcSandbox.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj b/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj index 1da4a659e8..ae25deb3b1 100644 --- a/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Abstractions/Microsoft.AspNetCore.Mvc.Abstractions.csproj @@ -6,7 +6,7 @@ ASP.NET Core MVC abstractions and interfaces for action invocation and dispatching, authorization, action filters, formatters, model binding, routing, validation, and more. Commonly used types: Microsoft.AspNetCore.Mvc.IActionResult - net451;netstandard1.3 + netstandard1.3 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc @@ -14,15 +14,12 @@ Microsoft.AspNetCore.Mvc.IActionResult + - - - - diff --git a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj index 5b8cb55cf1..ea40cb52f0 100644 --- a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj +++ b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/Microsoft.AspNetCore.Mvc.ApiExplorer.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC API explorer functionality for discovering metadata such as the list of controllers and actions, and their URLs and allowed HTTP methods. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc diff --git a/src/Microsoft.AspNetCore.Mvc.Core/BindAttribute.cs b/src/Microsoft.AspNetCore.Mvc.Core/BindAttribute.cs index 9a69dc91d9..a4490703c7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/BindAttribute.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/BindAttribute.cs @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Mvc { if (string.IsNullOrEmpty(original)) { - return EmptyArray.Instance; + return Array.Empty(); } var split = original.Split(',').Select(piece => piece.Trim()).Where(piece => !string.IsNullOrEmpty(piece)); diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs b/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs index 9881c332d6..f0ba4407ce 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/ChallengeResult.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc /// Initializes a new instance of . /// public ChallengeResult() - : this(EmptyArray.Instance) + : this(Array.Empty()) { } @@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc /// used to perform the authentication /// challenge. public ChallengeResult(AuthenticationProperties properties) - : this(EmptyArray.Instance, properties) + : this(Array.Empty(), properties) { } diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs b/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs index 9fbcf18137..0b4f9d4a29 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/ForbidResult.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc /// Initializes a new instance of . /// public ForbidResult() - : this(EmptyArray.Instance) + : this(Array.Empty()) { } @@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc /// used to perform the authentication /// challenge. public ForbidResult(AuthenticationProperties properties) - : this(EmptyArray.Instance, properties) + : this(Array.Empty(), properties) { } diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionContextAccessor.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionContextAccessor.cs index cad93b48bd..c12acdc36c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionContextAccessor.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ActionContextAccessor.cs @@ -1,34 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET451 -using System; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Messaging; -#else using System.Threading; -#endif namespace Microsoft.AspNetCore.Mvc.Infrastructure { public class ActionContextAccessor : IActionContextAccessor { -#if NET451 - private static readonly string Key = typeof(ActionContext).FullName + AppDomain.CurrentDomain.Id; - - public ActionContext ActionContext - { - get - { - var handle = CallContext.LogicalGetData(Key) as ObjectHandle; - return handle != null ? (ActionContext)handle.Unwrap() : null; - } - set - { - CallContext.LogicalSetData(Key, new ObjectHandle(value)); - } - } -#else private static readonly AsyncLocal _storage = new AsyncLocal(); public ActionContext ActionContext @@ -36,6 +14,5 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure get { return _storage.Value; } set { _storage.Value = value; } } -#endif } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelectionDecisionTree.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelectionDecisionTree.cs index f76a3662a6..2a92cd9e6e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelectionDecisionTree.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ActionSelectionDecisionTree.cs @@ -3,9 +3,6 @@ using System; using System.Collections.Generic; -#if NET451 -using System.ComponentModel; -#endif using System.Linq; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs index a9b5cee11a..cb8c844360 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/AmbiguousActionException.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -#if NET451 +#if NET46 using System.Runtime.Serialization; #endif @@ -11,8 +11,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal /// /// An exception which indicates multiple matches in action selection. /// -#if NET451 +#if NET46 [Serializable] +#elif NETSTANDARD1_6 +#else +#error target frameworks need to be updated #endif public class AmbiguousActionException : InvalidOperationException { @@ -21,11 +24,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal { } -#if NET451 +#if NET46 protected AmbiguousActionException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#elif NETSTANDARD1_6 +#else +#error target frameworks need to be updated #endif } } diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs index b77470c23b..83472b5a15 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ClientValidatorCache.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; @@ -104,7 +105,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal if (count == 0) { - return EmptyArray.Instance; + return Array.Empty(); } var validators = new IClientModelValidator[count]; diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/EmptyArray.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/EmptyArray.cs deleted file mode 100644 index f8e0972989..0000000000 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/EmptyArray.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if !NET451 -using System; -#endif - -namespace Microsoft.AspNetCore.Mvc.Internal -{ - public static class EmptyArray - { - public static TElement[] Instance { get; } = -#if NET451 - new TElement[0]; -#else - Array.Empty(); -#endif - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs index 7a7666dde7..07780cd096 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/FilterFactory.cs @@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal if (count == 0) { - return EmptyArray.Instance; + return Array.Empty(); } else { diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs index 16604e6ced..b6a32bb017 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/NonDisposableStream.cs @@ -107,7 +107,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal { return _innerStream.ReadAsync(buffer, offset, count, cancellationToken); } -#if NET451 + +#if NET46 /// public override IAsyncResult BeginRead( byte[] buffer, @@ -124,6 +125,31 @@ namespace Microsoft.AspNetCore.Mvc.Internal { return _innerStream.EndRead(asyncResult); } + + /// + public override IAsyncResult BeginWrite( + byte[] buffer, + int offset, + int count, + AsyncCallback callback, + object state) + { + return _innerStream.BeginWrite(buffer, offset, count, callback, state); + } + + /// + public override void EndWrite(IAsyncResult asyncResult) + { + _innerStream.EndWrite(asyncResult); + } + + /// + public override void Close() + { + } +#elif NETSTANDARD1_6 +#else +#error target frameworks need to be updated. #endif /// public override int ReadByte() @@ -166,35 +192,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal { return _innerStream.WriteAsync(buffer, offset, count, cancellationToken); } -#if NET451 - /// - public override IAsyncResult BeginWrite( - byte[] buffer, - int offset, - int count, - AsyncCallback callback, - object state) - { - return _innerStream.BeginWrite(buffer, offset, count, callback, state); - } - /// - public override void EndWrite(IAsyncResult asyncResult) - { - _innerStream.EndWrite(asyncResult); - } -#endif /// public override void WriteByte(byte value) { _innerStream.WriteByte(value); } -#if NET451 - /// - public override void Close() - { - } -#endif + /// protected override void Dispose(bool disposing) { diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs index e984f8830b..36b8e65493 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/PrefixContainer.cs @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal if (_originalValues.Count == 0) { - _sortedValues = EmptyArray.Instance; + _sortedValues = Array.Empty(); } else { diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs index 4cc9c124fa..46f4b56e1c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs @@ -15,10 +15,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal /// We're caching this in a static readonly field to make it more inlinable and avoid the volatile lookup done /// by Task.CompletedTask. /// -#if NET451 - public static readonly Task CompletedTask = Task.FromResult(0); -#else public static readonly Task CompletedTask = Task.CompletedTask; -#endif } } diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs index c41d9d3293..61fcfe0c15 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/ValidatorCache.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; @@ -103,7 +104,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal if (count == 0) { - return EmptyArray.Instance; + return Array.Empty(); } var validators = new IModelValidator[count]; diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj b/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj index 2080474b5c..3c9f8b52ce 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Core/Microsoft.AspNetCore.Mvc.Core.csproj @@ -12,7 +12,7 @@ Microsoft.AspNetCore.Mvc.FromBodyAttribute Microsoft.AspNetCore.Mvc.FromFormAttribute Microsoft.AspNetCore.Mvc.RequireHttpsAttribute Microsoft.AspNetCore.Mvc.RouteAttribute - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ArrayModelBinder.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ArrayModelBinder.cs index 670013656e..88e2f44e8a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ArrayModelBinder.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ArrayModelBinder.cs @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders { Debug.Assert(targetType == typeof(TElement[]), "GenericModelBinder only creates this binder for arrays."); - return EmptyArray.Instance; + return Array.Empty(); } /// diff --git a/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj b/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj index a2043590b3..0994ecc541 100644 --- a/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Cors/Microsoft.AspNetCore.Mvc.Cors.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC cross-origin resource sharing (CORS) features. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;cors diff --git a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj index e15c427c61..0e028991ce 100644 --- a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj +++ b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Microsoft.AspNetCore.Mvc.DataAnnotations.csproj @@ -3,7 +3,7 @@ ASP.NET Core MVC metadata and validation system using System.ComponentModel.DataAnnotations. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj index 0182e9771b..feb26408a8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Microsoft.AspNetCore.Mvc.Formatters.Json.csproj @@ -3,7 +3,7 @@ ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;json diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs index 75fae4e024..b3fdbc768c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Internal/FormattingUtilities.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET451 +#if NET46 using System.Runtime.Serialization; #endif using System.Xml; @@ -15,8 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml.Internal { public static readonly int DefaultMaxDepth = 32; -#if NET451 +#if NET46 public static readonly XsdDataContractExporter XsdDataContractExporter = new XsdDataContractExporter(); +#elif NETSTANDARD1_6 +#else +#error target frameworks needs to be updated. #endif /// diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj index 96a7357419..83723f2440 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj @@ -3,7 +3,7 @@ ASP.NET Core MVC formatters for XML input and output using DataContractSerializer and XmlSerializer. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;xml diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs index 0862fa21c2..17f1ea667f 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/XmlDataContractSerializerOutputFormatter.cs @@ -131,9 +131,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters try { -#if NET451 +#if NET46 // Verify that type is a valid data contract by forcing the serializer to try to create a data contract FormattingUtilities.XsdDataContractExporter.GetRootElementName(type); +#elif NETSTANDARD1_6 +#else +#error target frameworks need to be updated. #endif // If the serializer does not support this type it will throw an exception. return new DataContractSerializer(type, _serializerSettings); diff --git a/src/Microsoft.AspNetCore.Mvc.Localization/LocalizedHtmlString.cs b/src/Microsoft.AspNetCore.Mvc.Localization/LocalizedHtmlString.cs index 4ecc996ded..b7deeb61cd 100644 --- a/src/Microsoft.AspNetCore.Mvc.Localization/LocalizedHtmlString.cs +++ b/src/Microsoft.AspNetCore.Mvc.Localization/LocalizedHtmlString.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Mvc.Localization /// The name of the string resource. /// The string resource. public LocalizedHtmlString(string name, string value) - : this(name, value, isResourceNotFound: false, arguments: EmptyArray.Instance) + : this(name, value, isResourceNotFound: false, arguments: Array.Empty()) { } @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.Localization /// The string resource. /// A flag that indicates if the resource is not found. public LocalizedHtmlString(string name, string value, bool isResourceNotFound) - : this(name, value, isResourceNotFound, arguments: EmptyArray.Instance) + : this(name, value, isResourceNotFound, arguments: Array.Empty()) { } diff --git a/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj b/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj index e71193eac3..8998ddc3c8 100644 --- a/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Localization/Microsoft.AspNetCore.Mvc.Localization.csproj @@ -7,7 +7,7 @@ Commonly used types: Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer<TResource> Microsoft.AspNetCore.Mvc.Localization.IViewLocalizer - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;localization diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Host/Microsoft.AspNetCore.Mvc.Razor.Host.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.Host/Microsoft.AspNetCore.Mvc.Razor.Host.csproj index e3cf8bb416..c9e2c631eb 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Host/Microsoft.AspNetCore.Mvc.Razor.Host.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Host/Microsoft.AspNetCore.Mvc.Razor.Host.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC design time hosting infrastructure for the Razor view engine. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;cshtml;razor diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs index 3b75b0606c..fd2a512b5d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs @@ -79,6 +79,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif var precompiledAssemblyName = new AssemblyName(assemblyPart.Assembly.FullName); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs index 3100ef3eab..a2c665f074 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs @@ -15,12 +15,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal private readonly CSharpParseOptions _parseOptions; private readonly RazorReferenceManager _referenceManager; private readonly DebugInformationFormat _pdbFormat = -#if NET451 +#if NET46 SymbolsUtility.SupportsFullPdbGeneration() ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; -#else +#elif NETSTANDARD1_6 DebugInformationFormat.PortablePdb; +#else +#error target frameworks need to be updated. #endif public CSharpCompiler(RazorReferenceManager manager, IOptions optionsAccessor) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilerCacheResult.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilerCacheResult.cs index a1f444721c..0bca7fc8dc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilerCacheResult.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CompilerCacheResult.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal /// The . /// true if the view is precompiled, false otherwise. public CompilerCacheResult(string relativePath, CompilationResult compilationResult, bool isPrecompiled) - : this(relativePath, compilationResult, EmptyArray.Instance) + : this(relativePath, compilationResult, Array.Empty()) { IsPrecompiled = isPrecompiled; } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRoslynCompilationService.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRoslynCompilationService.cs index 09446264ef..c99a2fc939 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRoslynCompilationService.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRoslynCompilationService.cs @@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Razor.Evolution; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -186,10 +185,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public static Assembly LoadAssembly(MemoryStream assemblyStream, MemoryStream pdbStream) { var assembly = -#if NET451 +#if NET46 Assembly.Load(assemblyStream.ToArray(), pdbStream.ToArray()); -#else +#elif NETSTANDARD1_6 System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromStream(assemblyStream, pdbStream); +#else +#error target frameworks need to be updated #endif return assembly; } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs index 15048f3ae6..78b1c2122e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET451 +#if NET46 using System; using System.Runtime.InteropServices; @@ -44,4 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal } } } +#elif NETSTANDARD1_6 +#else +#error target frameworks need to be updated #endif \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs b/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs index 30a435b53a..86dcf09adc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/LanguageViewLocationExpander.cs @@ -51,11 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor } // Using CurrentUICulture so it loads the locale specific resources for the views. -#if NET451 - context.Values[ValueKey] = Thread.CurrentThread.CurrentUICulture.Name; -#else context.Values[ValueKey] = CultureInfo.CurrentUICulture.Name; -#endif } /// diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj b/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj index 428a677d10..7c6f828add 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Razor/Microsoft.AspNetCore.Mvc.Razor.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC Razor view engine for CSHTML files. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;cshtml;razor diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs index b5f00e46b3..ab038eea3e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs @@ -470,7 +470,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor // Only need to lookup _ViewStarts for the main page. var viewStartPages = isMainPage ? GetViewStartPages(relativePath, expirationTokens) : - EmptyArray.Instance; + Array.Empty(); if (factoryResult.IsPrecompiled) { _logger.PrecompiledViewFound(relativePath); diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs index 02d7631561..720e8fc5ea 100644 --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageModelActivatorProvider.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure } var factory = ActivatorUtilities.CreateFactory(modelTypeInfo, Type.EmptyTypes); - return (context) => factory(context.HttpContext.RequestServices, EmptyArray.Instance); + return (context) => factory(context.HttpContext.RequestServices, Array.Empty()); } public virtual Action CreateReleaser(CompiledPageActionDescriptor actionDescriptor) diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs index 041be31f9d..4201c73f67 100644 --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Internal/PageActionInvoker.cs @@ -314,7 +314,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal if (CacheEntry.PageStartFactories == null || CacheEntry.PageStartFactories.Count == 0) { - pageStarts = EmptyArray.Instance; + pageStarts = Array.Empty(); } else { diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj b/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj index 6d661ad107..ad8d08b79d 100644 --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Microsoft.AspNetCore.Mvc.RazorPages.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC Razor Pages. - netstandard1.6;net451 + netstandard1.6;net46 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;cshtml;razor diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CryptographyAlgorithms.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CryptographyAlgorithms.cs index 569c34ea7b..302e522337 100644 --- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CryptographyAlgorithms.cs +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/CryptographyAlgorithms.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal return sha256; } -#else +#elif NET46 public static SHA256 CreateSHA256() { SHA256 sha256; @@ -33,6 +33,8 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal return sha256; } +#else +#error target frameworks needs to be updated. #endif } } diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs index 1092a92c10..3feb70ad57 100644 --- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Internal/GlobbingUrlBuilder.cs @@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal { if (string.IsNullOrEmpty(include)) { - return EmptyArray.Instance; + return Array.Empty(); } var cacheKey = new GlobbingUrlKey(include, exclude); @@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Internal var includeEnumerator = includeTokenizer.GetEnumerator(); if (!includeEnumerator.MoveNext()) { - return EmptyArray.Instance; + return Array.Empty(); } var options = new MemoryCacheEntryOptions(); diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj index a0eb07df65..77d31b02e1 100644 --- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj +++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Microsoft.AspNetCore.Mvc.TagHelpers.csproj @@ -3,7 +3,7 @@ ASP.NET Core MVC default tag helpers. Contains tag helpers for anchor tags, HTML input elements, caching, scripts, links (for CSS), and more. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;taghelper;taghelpers diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs index 39acf011ae..636b68e96f 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/MvcViewFeaturesLoggerExtensions.cs @@ -103,7 +103,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal { if (arguments == null || arguments.Length == 0) { - return EmptyArray.Instance; + return Array.Empty(); } var formattedArguments = new string[arguments.Length]; diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs index cf475fc652..3deb6eac35 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Internal/ValidationHelpers.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Diagnostics; -using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal return entries; } - return EmptyArray.Instance; + return Array.Empty(); } private static void Visit( diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj index ef1d65a07e..794e8e0ace 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj @@ -8,7 +8,7 @@ Commonly used types: Microsoft.AspNetCore.Mvc.Controller Microsoft.AspNetCore.Mvc.ValidateAntiForgeryTokenAttribute Microsoft.AspNetCore.Mvc.ViewComponent - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true true diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs index 0453572ab4..d0630d4b01 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/RemoteAttribute.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc public class RemoteAttribute : ValidationAttribute, IClientModelValidator { private string _additionalFields = string.Empty; - private string[] _additionalFieldsSplit = EmptyArray.Instance; + private string[] _additionalFieldsSplit = Array.Empty(); private bool _checkedForLocalizer; private IStringLocalizer _stringLocalizer; @@ -276,7 +276,7 @@ namespace Microsoft.AspNetCore.Mvc { if (string.IsNullOrEmpty(original)) { - return EmptyArray.Instance; + return Array.Empty(); } var split = original diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/CollectionExtensions.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/CollectionExtensions.cs index 547f323354..7fee5c8122 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/CollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/CollectionExtensions.cs @@ -293,4 +293,7 @@ namespace System.Collections.Generic } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ContentNegotiationResult.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ContentNegotiationResult.cs index 7439ca0fc4..b6832ccdc1 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ContentNegotiationResult.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ContentNegotiationResult.cs @@ -50,4 +50,7 @@ namespace System.Net.Http.Formatting public MediaTypeHeaderValue MediaType { get; set; } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/DefaultContentNegotiator.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/DefaultContentNegotiator.cs index 1184871d1d..b3efb91428 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/DefaultContentNegotiator.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/DefaultContentNegotiator.cs @@ -585,4 +585,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormDataCollection.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormDataCollection.cs index 6d9e3b7e8c..a56db381d9 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormDataCollection.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormDataCollection.cs @@ -40,5 +40,7 @@ namespace System.Net.Http.Formatting } } } - +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormattingUtilities.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormattingUtilities.cs index fbf5b80d35..3ce9a6e8dc 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormattingUtilities.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/FormattingUtilities.cs @@ -162,9 +162,6 @@ namespace System.Net.Http { // MaxDepth is a DOS mitigation. We don't support MaxDepth in portable libraries because it is strictly // client side. -#if NETFX_CORE - return XmlDictionaryReaderQuotas.Max; -#else return new XmlDictionaryReaderQuotas() { MaxArrayLength = int.MaxValue, @@ -173,7 +170,6 @@ namespace System.Net.Http MaxNameTableCharCount = int.MaxValue, MaxStringContentLength = int.MaxValue }; -#endif } /// @@ -241,4 +237,7 @@ namespace System.Net.Http } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/IContentNegotiator.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/IContentNegotiator.cs index bf9582d2f4..8dbe639401 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/IContentNegotiator.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/IContentNegotiator.cs @@ -38,4 +38,7 @@ namespace System.Net.Http.Formatting IEnumerable formatters); } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ListWrapperCollection.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ListWrapperCollection.cs index 8c3c4abc1c..fb57fcb33d 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ListWrapperCollection.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ListWrapperCollection.cs @@ -31,4 +31,7 @@ namespace System.Collections.ObjectModel } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeConstants.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeConstants.cs index de8c5e8896..8196434194 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeConstants.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeConstants.cs @@ -109,4 +109,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatch.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatch.cs index 3161670da2..39a227a750 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatch.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatch.cs @@ -57,4 +57,7 @@ namespace System.Net.Http.Formatting public MediaTypeFormatterMatchRanking Ranking { get; private set; } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatchRanking.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatchRanking.cs index 319372745b..4f706fada8 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatchRanking.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeFormatterMatchRanking.cs @@ -45,4 +45,7 @@ namespace System.Net.Http.Formatting MatchOnRequestMediaType, } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeHeaderValueExtensions.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeHeaderValueExtensions.cs index bffca363ec..1fa95fe6ee 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeHeaderValueExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeHeaderValueExtensions.cs @@ -118,4 +118,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeWithQualityHeaderComparer.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeWithQualityHeaderComparer.cs index e1cc2a1299..c104427c85 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeWithQualityHeaderComparer.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/MediaTypeWithQualityHeaderComparer.cs @@ -116,4 +116,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ParsedMediaTypeHeaderValue.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ParsedMediaTypeHeaderValue.cs index fc9ae86882..ef8666b650 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ParsedMediaTypeHeaderValue.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/ParsedMediaTypeHeaderValue.cs @@ -88,4 +88,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/StringWithQualityHeaderValueComparer.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/StringWithQualityHeaderValueComparer.cs index f42e2bd0bc..512e0eec9d 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/StringWithQualityHeaderValueComparer.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/ContentNegotiator/StringWithQualityHeaderValueComparer.cs @@ -75,4 +75,7 @@ namespace System.Net.Http.Formatting } } } +#elif NET46 +#else +#error target frameworks needs to be updated. #endif diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs index 4654d3ca7c..00b35c0069 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageExtensions.cs @@ -19,7 +19,7 @@ namespace System.Net.Http /// public static class HttpRequestMessageExtensions { -#if !NETSTANDARD1_6 +#if NET46 /// /// Helper method for creating an message with a "416 (Requested Range Not @@ -55,7 +55,9 @@ namespace System.Net.Http rangeNotSatisfiableResponse.Content.Headers.ContentRange = invalidByteRangeException.ContentRange; return rangeNotSatisfiableResponse; } - +#elif NETSTANDARD1_6 +#else +#error target frameworks needs to be updated. #endif /// diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj index 63e92702fc..ee153cb965 100644 --- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj +++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Microsoft.AspNetCore.Mvc.WebApiCompatShim.csproj @@ -6,7 +6,7 @@ Provides compatibility in ASP.NET Core MVC with ASP.NET Web API 2 to simplify migration of existing Web API implementations. Commonly used types: System.Web.Http.ApiController - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc;aspnetwebapi diff --git a/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj b/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj index 48b90442a3..61063774a8 100644 --- a/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj +++ b/src/Microsoft.AspNetCore.Mvc/Microsoft.AspNetCore.Mvc.csproj @@ -4,7 +4,7 @@ ASP.NET Core MVC is a web framework that gives you a powerful, patterns-based way to build dynamic websites and web APIs. ASP.NET Core MVC enables a clean separation of concerns and gives you full control over markup. - net451;netstandard1.6 + net46;netstandard1.6 $(NoWarn);CS1591 true aspnetcore;aspnetcoremvc diff --git a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj index a401944f8c..0f250b35e0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj index c551cb8319..ff1672844f 100644 --- a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionContextAccessorTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionContextAccessorTests.cs index 10173140d8..f0525ba11d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionContextAccessorTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ActionContextAccessorTests.cs @@ -6,7 +6,7 @@ using Xunit; namespace Microsoft.AspNetCore.Mvc.Infrastructure { -#if NET452 +#if NET46 public class ActionContextAccessorTests { private static void DomainFunc() @@ -38,5 +38,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure Assert.True(ReferenceEquals(context, accessor.ActionContext)); } } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs index 693e05494d..b950e455f4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Text.Encodings.Web; -#if NETCOREAPP1_1 using System.Reflection; -#endif using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultAssemblyPartDiscoveryProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultAssemblyPartDiscoveryProviderTest.cs index fadf55ab2d..e551369a34 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultAssemblyPartDiscoveryProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultAssemblyPartDiscoveryProviderTest.cs @@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal // Arrange var expected = GetLibrary("MyApplication", "Microsoft.AspNetCore.Server.Kestrel", "Microsoft.AspNetCore.Mvc"); var deps = new DependencyContext( - new TargetInfo("netcoreapp1.1", "rurntime", "signature", isPortable: true), + new TargetInfo("netcoreapp2.0", "rurntime", "signature", isPortable: true), CompilationOptions.Default, Enumerable.Empty(), new[] diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj index 74d4ef1e17..ea95a77809 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 true diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs index 866a5b099f..c9abec2447 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/NonDisposableStreamTest.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal { public class NonDisposableStreamTest { -#if !NETCOREAPP1_1 +#if NET46 [Fact] public void InnerStreamIsOpenOnClose() { @@ -23,6 +23,21 @@ namespace Microsoft.AspNetCore.Mvc.Internal // Assert Assert.True(innerStream.CanRead); } + + [Fact] + public void InnerStreamIsNotFlushedOnClose() + { + // Arrange + var stream = FlushReportingStream.GetThrowingStream(); + + var nonDisposableStream = new NonDisposableStream(stream); + + // Act & Assert + nonDisposableStream.Close(); + } +#elif NETCOREAPP2_0 +#else +#error The target frameworks need to be updated #endif [Fact] @@ -49,20 +64,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal nonDisposableStream.Dispose(); } -#if !NETCOREAPP1_1 - [Fact] - public void InnerStreamIsNotFlushedOnClose() - { - // Arrange - var stream = FlushReportingStream.GetThrowingStream(); - - var nonDisposableStream = new NonDisposableStream(stream); - - // Act & Assert - nonDisposableStream.Close(); - } -#endif - [Fact] public void InnerStreamIsNotFlushedOnFlush() { diff --git a/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj index 4287cd35a1..8510590b3f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj index f492924a6f..7da1b16445 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonOutputFormatterTests.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonOutputFormatterTests.cs index de5b4fc395..84075cd15a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonOutputFormatterTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonOutputFormatterTests.cs @@ -308,20 +308,26 @@ namespace Microsoft.AspNetCore.Mvc.Formatters { "This is a test 激光這兩個字是甚麼意思 string written using utf-8", "utf-8", true }, { "This is a test 激光這兩個字是甚麼意思 string written using utf-16", "utf-16", true }, { "This is a test 激光這兩個字是甚麼意思 string written using utf-32", "utf-32", false }, -#if !NETCOREAPP1_1 +#if NET46 // CoreCLR does not like shift_jis as an encoding. { "This is a test 激光這兩個字是甚麼意思 string written using shift_jis", "shift_jis", false }, +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif { "This is a test æøå string written using iso-8859-1", "iso-8859-1", false }, }; -#if !NETCOREAPP1_1 +#if NET46 // CoreCLR does not like iso-2022-kr as an encoding. if (!TestPlatformHelper.IsMono) { // Mono issue - https://github.com/aspnet/External/issues/28 data.Add("This is a test 레이저 단어 뜻 string written using iso-2022-kr", "iso-2022-kr", false); } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif return data; diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj index ab80dbef02..9834496fbd 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj index e523af4504..351097bb83 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs index b2bd48254e..8f1400cd0a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET452 +#if NET46 using System; using System.Collections.Generic; using System.IO; diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs index 60a7d4a39a..b82605f456 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/CompilationOptionsTests.cs @@ -22,14 +22,16 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public async Task CompilationOptions_AreUsedByViewsAndPartials() { // Arrange -#if NET452 +#if NET46 var expected = -@"This method is running from NET452 -This method is only defined in NET452"; -#elif NETCOREAPP1_1 +@"This method is running from NET46 +This method is only defined in NET46"; +#elif NETCOREAPP2_0 var expected = -@"This method is running from NETCOREAPP1_1 -This method is only defined in NETCOREAPP1_1"; +@"This method is running from NETCOREAPP2_0 +This method is only defined in NETCOREAPP2_0"; +#else +#error the target framework needs to be updated. #endif // Act diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs index 1bc3396f80..e0d196b986 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ErrorPageTests.cs @@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests // The desktop CLR does not correctly read the stack trace from portable PDBs. However generating full pdbs // is only supported on machines with CLSID_CorSymWriter available. On desktop, we'll skip this test on // machines without this component. -#if NET452 +#if NET46 if (!SymbolsUtility.SupportsFullPdbGeneration()) { return; diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index 49410ef612..f637b5b16b 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -2,16 +2,16 @@ - netcoreapp1.1;net452 - netcoreapp1.1 - $(PackageTargetFallback);portable-net451+win8 + netcoreapp2.0;net46 + netcoreapp2.0 + $(PackageTargetFallback);portable-net451+win8 $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES $(DefineConstants);FUNCTIONAL_TESTS - + x86 diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/WebApiCompatShimBasicTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/WebApiCompatShimBasicTest.cs index f8eb768320..5d43eb9f3a 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/WebApiCompatShimBasicTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/WebApiCompatShimBasicTest.cs @@ -62,8 +62,11 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests { typeof(JsonMediaTypeFormatter).FullName, typeof(XmlMediaTypeFormatter).FullName, -#if !NETCOREAPP1_1 +#if NET46 typeof(FormUrlEncodedMediaTypeFormatter).FullName, +#elif NETCOREAPP2_0 +#else +#error the target framework needs to be updated. #endif }; diff --git a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj index a270cbd6aa..adfffbff18 100644 --- a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj index e769640f2e..e75b39f30d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/Microsoft.AspNetCore.Mvc.Razor.Host.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/Microsoft.AspNetCore.Mvc.Razor.Host.Test.csproj index 2686ea0ef2..a6f04de6ed 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/Microsoft.AspNetCore.Mvc.Razor.Host.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/Microsoft.AspNetCore.Mvc.Razor.Host.Test.csproj @@ -3,12 +3,14 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 true $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES $(DefaultItemExcludes);TestFiles\** + true + true diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/ViewsFeatureProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/ViewsFeatureProviderTest.cs index f1b4783ff8..8952c6416b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/ViewsFeatureProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/ViewsFeatureProviderTest.cs @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation Assert.Empty(feature.Views); } -#if !NETCOREAPP1_1 +#if NET46 [Fact] public void PopulateFeature_DoesNotFail_IfAssemblyHasEmptyLocation() { @@ -107,6 +107,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation // Assert Assert.Empty(feature.Views); } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif private class TestableViewsFeatureProvider : ViewsFeatureProvider @@ -145,7 +148,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation } } -#if !NETCOREAPP1_1 +#if NET46 private class AssemblyWithEmptyLocation : Assembly { public override string Location => string.Empty; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj index 500a456b9a..2c665af0ca 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj @@ -3,10 +3,12 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 true $(DefineConstants);SOME_TEST_DEFINE + true + true diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj index 7c21f224f1..e310910770 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj index d44032aba3..ff27f9aff6 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj index 73fdc0853b..1f2febf230 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj @@ -2,8 +2,10 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 + true + true diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj b/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj index 260e618011..b289e2fac4 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj +++ b/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj @@ -3,7 +3,7 @@ - net452;netstandard1.6 + net46;netstandard1.6 diff --git a/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.csproj b/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.csproj index bd4a2267db..6c45a83d73 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.csproj +++ b/test/Microsoft.AspNetCore.Mvc.TestDiagnosticListener/Microsoft.AspNetCore.Mvc.TestDiagnosticListener.csproj @@ -2,7 +2,7 @@ - net452;netstandard1.6 + net46;netstandard1.6 diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj index ab858eb23b..db82914909 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/DefaultContentNegotiatorTest.cs b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/DefaultContentNegotiatorTest.cs index 6ca612bd1a..2ae3601660 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/DefaultContentNegotiatorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/DefaultContentNegotiatorTest.cs @@ -149,10 +149,13 @@ namespace System.Net.Http.Formatting { get { -#if !NETCOREAPP1_1 +#if NET46 // Only mapping and accept makes sense with q != 1.0 MediaTypeFormatterMatch matchMapping10 = CreateMatch(1.0, MediaTypeFormatterMatchRanking.MatchOnRequestWithMediaTypeMapping); MediaTypeFormatterMatch matchMapping05 = CreateMatch(0.5, MediaTypeFormatterMatchRanking.MatchOnRequestWithMediaTypeMapping); +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif MediaTypeFormatterMatch matchAccept10 = CreateMatch(1.0, MediaTypeFormatterMatchRanking.MatchOnRequestAcceptHeaderLiteral); @@ -176,9 +179,6 @@ namespace System.Net.Http.Formatting { new List() { matchType10, matchRequest10, matchAcceptAllRange10 }, matchAcceptAllRange10 }, { new List() { matchType10, matchRequest10, matchAcceptAllRange10, matchAcceptSubTypeRange10 }, matchAcceptSubTypeRange10 }, { new List() { matchType10, matchRequest10, matchAcceptAllRange10, matchAcceptSubTypeRange10, matchAccept10 }, matchAccept10 }, -#if !NETCOREAPP1_1 - { new List() { matchType10, matchRequest10, matchAcceptAllRange10, matchAcceptSubTypeRange10, matchAccept10, matchMapping10 }, matchMapping10 }, -#endif { new List() { matchAccept05, matchAccept10 }, matchAccept10 }, { new List() { matchAccept10, matchAccept05 }, matchAccept10 }, @@ -187,7 +187,8 @@ namespace System.Net.Http.Formatting { new List() { matchAcceptAllRange05, matchAcceptAllRange10 }, matchAcceptAllRange10 }, { new List() { matchAcceptAllRange10, matchAcceptAllRange05 }, matchAcceptAllRange10 }, -#if !NETCOREAPP1_1 +#if NET46 + { new List() { matchType10, matchRequest10, matchAcceptAllRange10, matchAcceptSubTypeRange10, matchAccept10, matchMapping10 }, matchMapping10 }, { new List() { matchMapping05, matchMapping10 }, matchMapping10 }, { new List() { matchMapping10, matchMapping05 }, matchMapping10 }, @@ -203,6 +204,9 @@ namespace System.Net.Http.Formatting { new List() { matchMapping05, matchAccept10 }, matchAccept10 }, { new List() { matchMapping05, matchAcceptSubTypeRange10 }, matchAcceptSubTypeRange10 }, { new List() { matchMapping05, matchAcceptAllRange10 }, matchAcceptAllRange10 }, +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif }; } @@ -251,7 +255,7 @@ namespace System.Net.Http.Formatting Assert.Null(result); } -#if !NETCOREAPP1_1 +#if NET46 [Fact] public void Negotiate_MediaTypeMappingTakesPrecedenceOverAcceptHeader() @@ -280,7 +284,9 @@ namespace System.Net.Http.Formatting Assert.Equal("application/xml", result.MediaType.MediaType); Assert.IsType(result.Formatter); } - +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif [Fact] @@ -359,7 +365,7 @@ namespace System.Net.Http.Formatting Assert.IsType(result.Formatter); } -#if !NETCOREAPP1_1 +#if NET46 [Fact] public void Negotiate_RespectsFormatterOrdering_ForXhrRequestThatDoesNotSpecifyAcceptHeaders() @@ -382,7 +388,9 @@ namespace System.Net.Http.Formatting Assert.Equal("application/json", result.MediaType.MediaType); Assert.IsType(result.Formatter); } - +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif [Fact] @@ -458,7 +466,7 @@ namespace System.Net.Http.Formatting } } -#if !NETCOREAPP1_1 +#if NET46 [Fact] public void MatchMediaTypeMapping_ReturnsMatch() @@ -485,7 +493,9 @@ namespace System.Net.Http.Formatting Assert.Equal(mockMediaTypeMapping.MatchQuality, match.Quality); Assert.Equal(MediaTypeFormatterMatchRanking.MatchOnRequestWithMediaTypeMapping, match.Ranking); } - +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif [Theory] @@ -810,7 +820,7 @@ namespace System.Net.Http.Formatting } } -#if !NETCOREAPP1_1 +#if NET46 private class MyMediaTypeMapping : MediaTypeMapping { @@ -832,6 +842,9 @@ namespace System.Net.Http.Formatting } } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif } diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/HttpRequestMessage/HttpRequestMessageExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/HttpRequestMessage/HttpRequestMessageExtensionsTest.cs index 1859119584..e7c25e655e 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/HttpRequestMessage/HttpRequestMessageExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/HttpRequestMessage/HttpRequestMessageExtensionsTest.cs @@ -278,7 +278,7 @@ namespace System.Net.Http Assert.Equal("bin/baz", response.Content.Headers.ContentType.MediaType); } -#if !NETCOREAPP1_1 +#if NET46 // API doesn't exist in CoreCLR. [Fact] public void CreateErrorResponseRangeNotSatisfiable_SetsCorrectStatusCodeAndContentRangeHeader() @@ -299,6 +299,9 @@ namespace System.Net.Http Assert.Equal(HttpStatusCode.RequestedRangeNotSatisfiable, response.StatusCode); Assert.Same(expectedContentRange, response.Content.Headers.ContentRange); } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif private static IServiceProvider CreateServices( diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj index b25bd9e403..634f0fc66c 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj @@ -3,9 +3,11 @@ - netcoreapp1.1;net452 - netcoreapp1.1 - $(PackageTargetFallback);portable-net451+win8 + netcoreapp2.0;net46 + netcoreapp2.0 + $(PackageTargetFallback);portable-net451+win8 + true + true @@ -16,6 +18,7 @@ + diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockContentNegotiator.cs b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockContentNegotiator.cs index 907a65c746..198e7ea335 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockContentNegotiator.cs +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockContentNegotiator.cs @@ -34,14 +34,16 @@ namespace System.Net.Http.Formatting.Mocks return base.SelectResponseCharacterEncoding(request, formatter); } -#if !NETCOREAPP1_1 +#if NET46 public new MediaTypeFormatterMatch MatchMediaTypeMapping(HttpRequestMessage request, MediaTypeFormatter formatter) { return base.MatchMediaTypeMapping(request, formatter); } - -#endif +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. +#endif public new MediaTypeFormatterMatch MatchAcceptHeader(IEnumerable sortedAcceptValues, MediaTypeFormatter formatter) { diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockMediaTypeMapping.cs b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockMediaTypeMapping.cs index 7c32a618ee..ede89e1c4f 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockMediaTypeMapping.cs +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Mocks/MockMediaTypeMapping.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if !NETCOREAPP1_1 +#if NET46 using System.Net.Http.Headers; @@ -35,4 +35,7 @@ namespace System.Net.Http.Formatting.Mocks } } } +#elif NETCOREAPP2_0 +#else +#error target frameworks needs to be updated. #endif diff --git a/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj b/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj index aacb2803dd..72954f3045 100644 --- a/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj +++ b/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj index ae2cb4338e..c1ed0d0e5e 100644 --- a/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj +++ b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/BasicWebSite/BasicWebSite.csproj b/test/WebSites/BasicWebSite/BasicWebSite.csproj index da7dd0ca86..d85722d2fa 100644 --- a/test/WebSites/BasicWebSite/BasicWebSite.csproj +++ b/test/WebSites/BasicWebSite/BasicWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/ControllersFromServicesClassLibrary/ControllersFromServicesClassLibrary.csproj b/test/WebSites/ControllersFromServicesClassLibrary/ControllersFromServicesClassLibrary.csproj index 49f679bd1a..594323d383 100644 --- a/test/WebSites/ControllersFromServicesClassLibrary/ControllersFromServicesClassLibrary.csproj +++ b/test/WebSites/ControllersFromServicesClassLibrary/ControllersFromServicesClassLibrary.csproj @@ -2,7 +2,7 @@ - net452;netstandard1.6 + net46;netstandard1.6 true diff --git a/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj b/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj index 2f2b5332bc..6cf3a80fa3 100644 --- a/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj +++ b/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/CorsWebSite/CorsWebSite.csproj b/test/WebSites/CorsWebSite/CorsWebSite.csproj index ec1f5de2df..f1515e989c 100644 --- a/test/WebSites/CorsWebSite/CorsWebSite.csproj +++ b/test/WebSites/CorsWebSite/CorsWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj b/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj index 60df8dc712..8fe724665a 100644 --- a/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj +++ b/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/FilesWebSite/FilesWebSite.csproj b/test/WebSites/FilesWebSite/FilesWebSite.csproj index 6d6d487a18..ce412c38f4 100644 --- a/test/WebSites/FilesWebSite/FilesWebSite.csproj +++ b/test/WebSites/FilesWebSite/FilesWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/FiltersWebSite/FiltersWebSite.csproj b/test/WebSites/FiltersWebSite/FiltersWebSite.csproj index 53f4bf4007..b3a687808f 100644 --- a/test/WebSites/FiltersWebSite/FiltersWebSite.csproj +++ b/test/WebSites/FiltersWebSite/FiltersWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/FormatterWebSite/FormatterWebSite.csproj b/test/WebSites/FormatterWebSite/FormatterWebSite.csproj index aacb2803dd..72954f3045 100644 --- a/test/WebSites/FormatterWebSite/FormatterWebSite.csproj +++ b/test/WebSites/FormatterWebSite/FormatterWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj b/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj index ae2cb4338e..c1ed0d0e5e 100644 --- a/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj +++ b/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj index bb2132f409..eeec245720 100644 --- a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj +++ b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj @@ -2,7 +2,7 @@ - net452;netstandard1.3 + netstandard1.3 diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj index dd03c7536b..364d079590 100644 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj +++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj b/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj index 3b02a31ae3..d64e1ea7c9 100644 --- a/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj +++ b/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/RazorWebSite/Controllers/ViewsConsumingCompilationOptionsController.cs b/test/WebSites/RazorWebSite/Controllers/ViewsConsumingCompilationOptionsController.cs index 18c0b2483f..91e4911673 100644 --- a/test/WebSites/RazorWebSite/Controllers/ViewsConsumingCompilationOptionsController.cs +++ b/test/WebSites/RazorWebSite/Controllers/ViewsConsumingCompilationOptionsController.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; namespace RazorWebSite.Controllers { - // Views returned by this controller use #ifdefs for defines specified in project.json + // Views returned by this controller use #ifdefs for defines specified in the project // The intent of this controller is to verify that view compilation uses the app's compilation settings. public class ViewsConsumingCompilationOptionsController : Controller { diff --git a/test/WebSites/RazorWebSite/RazorWebSite.csproj b/test/WebSites/RazorWebSite/RazorWebSite.csproj index 38656498c7..5b65c4ff2e 100644 --- a/test/WebSites/RazorWebSite/RazorWebSite.csproj +++ b/test/WebSites/RazorWebSite/RazorWebSite.csproj @@ -2,16 +2,16 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 - - $(DefineConstants);NET452_CUSTOM_DEFINE + + $(DefineConstants);NET46_CUSTOM_DEFINE - - $(DefineConstants);NETCOREAPP1_1_CUSTOM_DEFINE + + $(DefineConstants);NETCOREAPP2_0_CUSTOM_DEFINE diff --git a/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs b/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs index 0a1d416356..ec3a41166d 100644 --- a/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs +++ b/test/WebSites/RazorWebSite/Services/FrameworkSpecificHelper.cs @@ -7,24 +7,26 @@ namespace RazorWebSite { public string ExecuteOperation() { -#if NET452 - return "This method is running from NET452"; -#elif NETCOREAPP1_1 - return "This method is running from NETCOREAPP1_1"; -#endif +#if NET46 + return "This method is running from NET46"; +#elif NETCOREAPP2_0 + return "This method is running from NETCOREAPP2_0"; +#else +#error the target framework needs to be updated. +#endif } -#if NET452_CUSTOM_DEFINE - public string ExecuteNet452Operation() +#if NET46_CUSTOM_DEFINE + public string ExecuteNET46Operation() { - return "This method is only defined in NET452"; + return "This method is only defined in NET46"; } #endif -#if NETCOREAPP1_1_CUSTOM_DEFINE - public string ExecuteNetCoreApp1_1Operation() +#if NETCOREAPP2_0_CUSTOM_DEFINE + public string ExecuteNetCoreApp2_0Operation() { - return "This method is only defined in NETCOREAPP1_1"; + return "This method is only defined in NETCOREAPP2_0"; } #endif } diff --git a/test/WebSites/RazorWebSite/Startup.cs b/test/WebSites/RazorWebSite/Startup.cs index b9552dbb2d..7a112f7dd4 100644 --- a/test/WebSites/RazorWebSite/Startup.cs +++ b/test/WebSites/RazorWebSite/Startup.cs @@ -29,8 +29,8 @@ namespace RazorWebSite $"{nameof(RazorWebSite)}.EmbeddedViews")); options.FileProviders.Add(updateableFileProvider); options.ViewLocationExpanders.Add(new NonMainPageViewLocationExpander()); -#if NET452 - options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols("NET452", "NET452_CUSTOM_DEFINE"); +#if NET46 + options.ParseOptions = options.ParseOptions.WithPreprocessorSymbols("NET46", "NET46_CUSTOM_DEFINE"); #endif }) .AddViewOptions(options => diff --git a/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml b/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml index d0d0bbd744..814993581a 100644 --- a/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml +++ b/test/WebSites/RazorWebSite/Views/ViewsConsumingCompilationOptions/_Partial.cshtml @@ -1,11 +1,11 @@ @inject FrameworkSpecificHelper MyHelper @{ string value = -#if NET452_CUSTOM_DEFINE - MyHelper.ExecuteNet452Operation(); +#if NET46_CUSTOM_DEFINE + MyHelper.ExecuteNET46Operation(); #endif -#if NETCOREAPP1_1_CUSTOM_DEFINE - MyHelper.ExecuteNetCoreApp1_1Operation(); +#if NETCOREAPP2_0_CUSTOM_DEFINE + MyHelper.ExecuteNetCoreApp2_0Operation(); #endif } @value \ No newline at end of file diff --git a/test/WebSites/RoutingWebSite/RoutingWebSite.csproj b/test/WebSites/RoutingWebSite/RoutingWebSite.csproj index ae2cb4338e..c1ed0d0e5e 100644 --- a/test/WebSites/RoutingWebSite/RoutingWebSite.csproj +++ b/test/WebSites/RoutingWebSite/RoutingWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/SecurityWebSite/SecurityWebSite.csproj b/test/WebSites/SecurityWebSite/SecurityWebSite.csproj index ed325d14d4..fb021ca2ef 100644 --- a/test/WebSites/SecurityWebSite/SecurityWebSite.csproj +++ b/test/WebSites/SecurityWebSite/SecurityWebSite.csproj @@ -2,8 +2,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net46 + netcoreapp2.0 diff --git a/test/WebSites/SimpleWebSite/SimpleWebSite.csproj b/test/WebSites/SimpleWebSite/SimpleWebSite.csproj index de92e65771..ecf202d95a 100644 --- a/test/WebSites/SimpleWebSite/SimpleWebSite.csproj +++ b/test/WebSites/SimpleWebSite/SimpleWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj b/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj index debff2f85e..1f95086578 100644 --- a/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj +++ b/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 true diff --git a/test/WebSites/UserClassLibrary/UserClassLibrary.csproj b/test/WebSites/UserClassLibrary/UserClassLibrary.csproj index 74117fb14f..fc25664a87 100644 --- a/test/WebSites/UserClassLibrary/UserClassLibrary.csproj +++ b/test/WebSites/UserClassLibrary/UserClassLibrary.csproj @@ -2,6 +2,6 @@ - net452;netstandard1.3 + netstandard1.3 diff --git a/test/WebSites/VersioningWebSite/VersioningWebSite.csproj b/test/WebSites/VersioningWebSite/VersioningWebSite.csproj index ae2cb4338e..c1ed0d0e5e 100644 --- a/test/WebSites/VersioningWebSite/VersioningWebSite.csproj +++ b/test/WebSites/VersioningWebSite/VersioningWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj b/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj index 0ce106c8ee..b4877e7b25 100644 --- a/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj +++ b/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj @@ -2,9 +2,9 @@ - net452;netcoreapp1.1 - netcoreapp1.1 - $(PackageTargetFallback);portable-net451+win8 + net46;netcoreapp2.0 + netcoreapp2.0 + $(PackageTargetFallback);portable-net451+win8 @@ -17,7 +17,7 @@ - + diff --git a/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj b/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj index aacb2803dd..72954f3045 100644 --- a/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj +++ b/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj @@ -2,8 +2,8 @@ - net452;netcoreapp1.1 - netcoreapp1.1 + net46;netcoreapp2.0 + netcoreapp2.0