Questions tagged [.net-core-2.1]

Use this tag for questions specifically related to .NET Core 2.1, in addition to using the '.NET Core' tag.

See the tag .net-core for more information or What's new in .NET Core 2.1?

172 questions
53
votes
10 answers

This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.1 target framework

When I try to publish my application to the web server after upgrading to .NET Core 2.1 from 2.0, I get this message: "This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1…
Jim S
  • 1,029
  • 3
  • 10
  • 16
29
votes
3 answers

Blazor, ASP.NET Core Hosted vs Server Side in ASP.NET Core

I am trying my hands on blazor.Net which is an experimental framework. I already developed a small project in this Framework and its awesome. But after recent update in Blazor Language Service on 14 November I am seeing two options in Template…
Tanwer
  • 1,193
  • 4
  • 20
  • 36
24
votes
2 answers

How to use HttpClientHandler with HttpClientFactory in .NET Core

I want to use the HttpClientFactory that is available in .NET Core 2.1 but I also want to use the HttpClientHandler to utilize the AutomaticDecompression property when creating HttpClients. I am struggling because the .AddHttpMessageHandler<> takes…
16
votes
3 answers

An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\

I'm updating a VS2017 to use ASP.NET Core 2.1 (installing dot.net core sdk 2.1 and Microsoft.Net.Compilers 2.8.2) and I am receiving some warnings about analyzers not being able to be created after creating a new ASP.net core mvc 2.1…
14
votes
3 answers

The specified framework 'Microsoft.NETCore.App', version '2.1' was not found

I am developing an Angular 6 application in dotNet Core 2.1. Everything is working flawlessly, until I got to setting up EFCore. All my models are defined and context created. Running dotnet ef migrations add InitialCreate gives me the "The…
WJK
  • 593
  • 2
  • 5
  • 19
14
votes
4 answers

Debugging Swashbuckle Error - Failed to load API Definition

Is there any way to get a stack trace or inner exceptions on Swashbuckle/Swagger errors? At some point, it stopped working. I'm not sure if it was when I upgraded from .Net Core 2.0 to 2.1, but I'm pretty sure it was still working after that. When I…
14
votes
6 answers

Concatenate ReadOnlySpan

Ok, .NET Core 2.1 has landed. With it we've gotten a new way to work with string data being ReadOnlySpan. It's great at splitting string data, but what about combining the spans back together? var hello = "Hello".AsSpan(); var space = "…
hazzik
  • 12,193
  • 7
  • 42
  • 82
13
votes
1 answer

How to use Rijndael algorithm with 256 long block size in dotnet core 2.1

I'm trying to encrypt a string with RijndaelManaged in order to send it to a third-party service. I've implemented the procedure in older versions of .Net framework (4.5, 4.6.x) like below: RijndaelManaged rm= new RijndaelManaged(); rm.KeySize =…
thirdDeveloper
  • 764
  • 9
  • 25
12
votes
2 answers

Can I get a pointer to a Span?

I have a (ReadOnly)Span from which I want to decode a string. Only in .NET Core 2.1 I have the new overload to decode a string from it without needing to copy the bytes: Encoding.GetString(ReadOnlySpan bytes); In .NET Standard 2.0 and…
Ray
  • 5,849
  • 3
  • 42
  • 75
12
votes
3 answers

IHttpClientFactory in .NET Core 2.1 Console App references System.Net.Http

Tools Visual Studio 2017 Professional (15.8.7) dotnetcore SDK 2.1.403 Scenario I'm attempting to create a console app using the dotnet core framework. The console app needs to make API requests. I've read about the new IHttpClientFactory…
GreenyMcDuff
  • 2,396
  • 6
  • 23
  • 54
12
votes
2 answers

Re-target .NET Core to net471, net 472

My .Netcore 2.0 project can target net471. But when I upgraded to .NET 2.1, I can't retarget net471 or net472 Can I retarget in the latest version of .the NET core? Severity Code Description Project File Line Suppression State Error NU1202 Package…
Hung Quach
  • 1,786
  • 2
  • 13
  • 25
11
votes
1 answer

.NET Core X509Certificate2 usage (under Windows/IIS, Docker, Linux)

I am really trying a long time to use certificates in .NET Core API. Basically where I need to use them is in a .NET Core web api running on IIS and docker. Certificates I need to use are for: Microsoft.AspNetCore.DataProtection public void…
monty
  • 5,629
  • 11
  • 44
  • 74
11
votes
3 answers

HttpClient with .Net Core 2.1 hangs

Given the following .Net Core 2.1 Console App... using System; using System.Diagnostics; using System.Net.Http; using System.Net.Http.Headers; namespace TestHttpClient { class Program { static void Main(string[] args) { …
Jim
  • 4,718
  • 3
  • 29
  • 46
10
votes
4 answers

Serilog and .NET Core 2.1 HostBuilder Configuration

I'm using the .NET Core 2.1 HostBuilder class to set up and run a GRPC server and am having trouble getting SeriLog properly configured so that it is used by the .NET Core logging pipeline as well as available (via dependency injection) elsewhere in…
Mr. T
  • 3,128
  • 2
  • 21
  • 41
9
votes
2 answers

.NET Core 2.1 Override Automatic Model Validation

In the latest .NET Core 2.1, an automatic validation for the model state validation is introduced (https://blogs.msdn.microsoft.com/webdev/2018/02/02/asp-net-core-2-1-roadmap/#mvc). Previously I could override the validation error response by the…
Kes
  • 296
  • 3
  • 13
1
2 3
11 12