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