Questions tagged [.net-core-2.0]

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

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

343 questions
77
votes
1 answer

Error message "CS5001 Program does not contain a static 'Main' method suitable for an entry point"

Unable to execute the following code error CS5001 Program does not contain a static 'Main' method suitable for an entry point What does this error message mean? class Program { static async Task MainAsync(string[] args) { …
001
  • 55,049
  • 82
  • 210
  • 324
69
votes
14 answers

Error NU1605 Detected package downgrade

I am experiencing the following NU1605 dependency errors in my netcoreapp2.0 console application: NU1605 Detected package downgrade: System.Diagnostics.Debug from 4.3.0 to 4.0.11. Reference the package directly from the project to select a…
Dave New
  • 34,265
  • 48
  • 183
  • 366
63
votes
1 answer

Upgrading to .NET Core 2.0: PackageTargetFallback and AssetTargetFallback cannot be used together

When upgrading a project that is compiling and running fine on .NET Core 1.0 or 1.1, updating the target framework to .NET Core 2.0 (netcoreapp2.0) causes the build to fail with the following error: error NU1003: PackageTargetFallback and…
Martin Ullrich
  • 78,211
  • 20
  • 211
  • 189
33
votes
2 answers

Configuration for console apps .net Core 2.0

In .net Core 1 we could do this: IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .Build(); And that gave use the Configuration object that we could then use in our…
zaitsman
  • 7,571
  • 4
  • 35
  • 64
28
votes
3 answers

C# Add Accept header to HttpClient

What is the difference between these two calls? My end goal is to have Accept: application/json sent over the wire, not to append to some default set of other MIME types. HttpClient client = new…
evilSnobu
  • 19,691
  • 5
  • 31
  • 62
27
votes
1 answer

Project 'ClassLibrary1.csproj' targets 'netcoreapp2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'

I have two class library project with the following setting: ClassLibrary1 --> Target framework-->.NET Core 2.1 ClassLibrary2 --> Target framework-->.NET Framework 4.7.2 Now I referenced the ClassLibrary1 project in ClassLibrary2 project. It was…
santosh kumar patro
  • 5,491
  • 12
  • 48
  • 105
26
votes
2 answers

LocalDB is not supported on this Platform

I'm trying to launch .Net Core 2.0 application on Ubuntu 17.04. I developed it on Windows 10 before and it works well. The problem is that when I run dotnet ef database update I get the next exception: System.PlatformNotSupportedException: LocalDB…
YTerle
  • 2,208
  • 5
  • 21
  • 37
23
votes
5 answers

The DbContext of type cannot be pooled because it does not have a single public constructor accepting a single parameter of type DbContextOptions

I am trying to upgrade our current .Net Core application from 1.1 to 2.0 and am getting this runtime error: "The DbContext of type 'CoreContext' cannot be pooled because it does not have a single public constructor accepting a single parameter of…
Jeff Keslinke
  • 4,008
  • 5
  • 25
  • 48
23
votes
3 answers

.net-core-2.0 azure app service 502.5 error

Getting a 502.5 error after CI deployment to azure app service. When running dotnet {myproject}.dll on the debug console this is the error I get: Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly…
ktice12
  • 391
  • 2
  • 9
21
votes
3 answers

Which C# version .NET Core uses?

I know that C# version depends on .NET Framework. But .NET Core which version uses? Particularly .NET Core 2? C#7?
Alexan
  • 6,893
  • 13
  • 69
  • 89
21
votes
6 answers

.NET Core 2.0 missing from my Visual Studio

So I've installed the official .NET Core 2.0 SDK and when I'm in Visual Studio i get heaps of errors and the target framework is not listed :( It's like .NET Core 2.0 isn't installed. and here's the .csproj file:
Pure.Krome
  • 78,923
  • 102
  • 356
  • 586
21
votes
5 answers

VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

I'm getting Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0. Works fine…
Liero
  • 19,054
  • 16
  • 100
  • 195
19
votes
4 answers

Unable to load DLL 'libdl' when using System.Drawing.Common NuGet package on AWS Lambda

We have a thumbnail generator lambda function which I'm trying to update to .NET Core 2.0, but I've encountered the following error when using Microsoft's System.Drawing.Common NuGet package: TypeInitializationException The type initializer for…
Llama
  • 25,925
  • 5
  • 49
  • 68
14
votes
2 answers

VS 2017 .Net Core 2.0 Console Application Publish Fail

I've been trying to publish a .Net Core 2.0 Console Application using Visual Studio 2017 Community Edition but it always fails (it runs perfectly inside VS2017). This is my CSPROJ:
14
votes
5 answers

How to include a library in .NET Core 2.0

I don't know much about .NET yet, so I guess I'm missing something obvious. I created a library (targeted as a DLL file, set for .NET standard 2.0), packaged it both as a DLL file and as a NuGet package. Now I want to use the library in another…
MrMid
  • 301
  • 1
  • 3
  • 11
1
2 3
22 23