.net-core-2.0

How do I download a package from the command line with .NET Core from nuget?

南楼画角 提交于 2019-12-10 19:28:06
问题 Microsoft packages .NET Core on Linux for Ubuntu. I'm currently using that. I now want to install Json.NET which instructs me to use the Package Manager console and run, PM> Install-Package Newtonsoft.Json I'm wondering how I do that Linux. I see that there is a Nuget CLI, but it doesn't seem like that's available on .NET Core. Moreover the docs say On Mac and Linux, install Mono 4.4.2 or later. How do I simply install a package on Linux? What's the .NET equivalent of npm/cpan/pip/gem? When I

GetExternalLoginInfoAsync returns null dotnet core 2.0

…衆ロ難τιáo~ 提交于 2019-12-10 18:36:24
问题 I'm trying to setup Facebook authentication with dot-net core 2.0, but in my ExternalLoginCallbackAsync method, I'm always getting null as a response I have followed the documentation and so far this is what I've done: in my ConfigureServices in the startup file: services.AddAuthentication( options => options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme); services.AddAuthentication().AddFacebook( f => { f.AppId = Configuration["facebook-app-id"]; f.AppSecret =

Storing Azure Vault Client ID and Client Secret

主宰稳场 提交于 2019-12-10 13:36:51
问题 I am using .NET Core 2.0 and ASP.NET Core 2.0 for application development. The "test" application is a .NET Core Console application. The core code I am writing is a class library. Once proper testing. I choose to do this since I won't be putting this to use for awhile (it's replacing older ASPNET code). Anyway, since I have to work with a LOT of API keys for various services I decided to use Microsoft Azure Key Vault for storing the keys. I have this all setup and understand how this works.

Missing extension method AddJwtBearerAuthentication() for IServiceCollection in .NET Core 2.0

混江龙づ霸主 提交于 2019-12-10 13:17:22
问题 I have updated my project from Core 1.1 to Core 2.0 using instructions from https://blogs.msdn.microsoft.com/webdev/2017/08/14/announcing-asp-net-core-2-0/ (updated target framework to .NET Core 2.0 and used metapackage Microsoft.AspNetCore.All). I have updated all possible nuget packages to latest versions as well. In .NET Core 1.1 i was adding JWT Bearer Authentication this way: app.UseJwtBearerAuthentication(); // from Startup.Configure() As per http://www.talkingdotnet.com/whats-new-in

How to pass dependencies to a custom .NET Core ILoggerProvider

北战南征 提交于 2019-12-10 10:06:04
问题 I am creating a custom .NET Core ILoggerProvider that requires some dependencies to be passed into its constructor. I believe I am using a fairly common pattern to initialize my logging implementation; it looks something like this: var services = new ServiceCollection(); // Register some services here services.AddLogging(builder => { builder.AddProvider(new DebugLoggerProvider()); }); var provider = services.BuildServiceProvider(); I want to add my new provider within the AddLogging block, in

.NET Core 2 and SwashBuckle Swagger UI is not Displaying

限于喜欢 提交于 2019-12-09 16:35:42
问题 I have followed a few tutorials and have gotten this to work at work but for some reason I am not able to get the UI to display but the Swagger Json is created. Last tutorial I looked at is here. My setup is like so: Nuget Package: Swashbuckle.AspNetCore(1.0.0) ConfigureServices Method: services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { Title = "MediatR Example", Version = "v1", Description = "Trying out the MediatR library to simplify Request and Response logic.",

ASP.NET Core 2.0 Redirecting user from AuthorizationHandler, HandleRequirementAsync method

Deadly 提交于 2019-12-09 03:43:00
问题 I am trying to implement AuthorizationHandler in .net core 2.0 where i need to authorize the user and based on the condition wanted to redirect to different action methods within my application validation works ok but how i can redirect user to the Access Denied or Login page when authorization failed. protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, HasPermissionRequirement requirement) { var controllerContext = context.Resource as

Error NU1605 Detected package downgrade

怎甘沉沦 提交于 2019-12-08 14:30:12
问题 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 different version. MyProject -> Colorful.Console 1.2.6 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Diagnostics.Debug (>= 4.3.0) MyProject -> System.Diagnostics.Debug (>= 4.0.11) NU1605 Detected package downgrade: System

MVC Net Core with Docker Containers Benefits

一个人想着一个人 提交于 2019-12-08 10:52:05
问题 I am creating a simple MVC Net Core app with C# backend, and ASP CSS/html/Razor front end. It is a simple start project where customers can create orders, buy books, and place into a shopping cart. How would Docker images support this? Or would this be an overkill for MVC. 回答1: It's not overkill. It's actually quite simple and the dockerization brings a lot of advantages. Read for example the .Net Core dockerization page on Docker docs: https://docs.docker.com/engine/examples/dotnetcore/ Some

Sonarqube vsts task exception on coverage for .net core 2 app

安稳与你 提交于 2019-12-08 05:04:41
问题 I believe this is more a bug report than a support question, but may be i can workaround it. I am building & testing a .net core 2 app: the vstest step is configured as below: A trx file and a binary .coverage files are produced. If Code coverage checkbox is disabled, build works. If enabled like in the picture it fails with the following error: SonarQube Scanner for MSBuild 3.0.2 Default properties file was found at C:\agent\_work\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403