.net-core

VSCode Asp.Net core command line arguments when debugging?

巧了我就是萌 提交于 2021-02-08 09:07:28
问题 Just been reading this article from Scott Allen. The approach to specify command line arguments to .net core seems intersing, but how do we pass those arguments from VS Code when running with debugger (Normally using F5 command if launch.json is setup)? e.g dotnet run dropdb migratedb seeddb 回答1: Copying over answer from comment In your launch.json , try adding: "args": ["dropdb", "migratedb", "seeddb"] to the target launch configuration. 来源: https://stackoverflow.com/questions/41189755

“Go to Implementation” ending up with “The symbol has no implementations”

佐手、 提交于 2021-02-08 06:46:42
问题 When right clicking on e.g. a method in Visual Studio and selecting Go To Implementation it tells me The symbol has no implementations I tried with services.AddDbContext<RazorPagesMovieContext>(options => options.UseSqlServer(Configuration.GetConnectionString("RazorPagesMovieContext"))); where AddDbContext is actually part of Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions Is it possible to get Go To Implementation working, as .NET Core and ASP.NET Core are

“Go to Implementation” ending up with “The symbol has no implementations”

為{幸葍}努か 提交于 2021-02-08 06:46:32
问题 When right clicking on e.g. a method in Visual Studio and selecting Go To Implementation it tells me The symbol has no implementations I tried with services.AddDbContext<RazorPagesMovieContext>(options => options.UseSqlServer(Configuration.GetConnectionString("RazorPagesMovieContext"))); where AddDbContext is actually part of Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions Is it possible to get Go To Implementation working, as .NET Core and ASP.NET Core are

Setting a date and revision number as variables in tfs 2017

纵然是瞬间 提交于 2021-02-08 06:43:28
问题 I want to create a variable named NugetVersionNumber with the value a date format of $(Date:yyyy.MM.dd)$(Rev:.rr) with the revision at the end. e.g. 2018.8.23.1 How do I set a process variable to construct this format without changing the build.buildnumber variable? 回答1: It's not able to directly use $(Date:yyyy.MM.dd)$(Rev:.rr) as a user-defined variables. (Date:yyyyMMdd) is a token of build number format not a general variable. The only way to do this is setting your build number with (Date

Chunked large JSON POST using .NET HttpClient?

懵懂的女人 提交于 2021-02-08 06:41:30
问题 I am sending data for up to 10K users in JSON format to a http endpoint in a .NET Core MVC server app. The JSON is built slowly user by user and is custom (JSON.NET just isn't usable for me). I use a HttpClient and I basically want to send the JSON chunk by chunk so I don't have to accumulate it all at once and sit with a multi-megabyte string in memory for each request, hurting my large object heap. I cannot find and equivalent for HttpWebRequest.GetRequestStream that was used earlier.

How can I change the default build output directory in Visual Studio Code

烈酒焚心 提交于 2021-02-08 06:27:38
问题 I'm new to Visual Studio Code. I want to define the output directory in my csproj. I don't know where to change in Visual Studio Code the destination folder to locate the dll files generated. 回答1: VSCode uses dotnet CLI and particularly for building the dotnet build command. Among others, it has the following option -o|--output <OUTPUT_DIRECTORY> Directory in which to place the built binaries. Assuming your building task is defined in .vscode/tasks.json file: { "version": "2.0.0", "tasks": [

How to continue on first successful task, throw exception if all tasks fail

风格不统一 提交于 2021-02-08 05:22:45
问题 I am currently working on a web API that requires that I perform several different checks for rights and perform async operations to see if a user is allowed to make an API call. If the user can pass just one of the checks, they may continue, otherwise I need to throw an exception and boot them back out of the API with a 403 error. I'd like to do something similar to this: public async Task<object> APIMethod() { var tasks = new[] { CheckOne(), CheckTwo(), CheckThree() }; // On first success,

Why is writing ConfigureAwait(false) on every line with await always recommended and do I really need it?

佐手、 提交于 2021-02-08 05:17:08
问题 The question is not about what ConfigureAwait does. But rather why literally everywhere I see something like As a general rule, yes. ConfigureAwait(false) should be used for every await unless the method needs its context. I.e. they propose that I should write await Method1().ConfigureAwait(false); await Method2().ConfigureAwait(false); // Do something else // ... await Method3().ConfigureAwait(false); await Method4().ConfigureAwait(false); But in such case wouldn't be clearer just resetting

Why is writing ConfigureAwait(false) on every line with await always recommended and do I really need it?

三世轮回 提交于 2021-02-08 05:15:46
问题 The question is not about what ConfigureAwait does. But rather why literally everywhere I see something like As a general rule, yes. ConfigureAwait(false) should be used for every await unless the method needs its context. I.e. they propose that I should write await Method1().ConfigureAwait(false); await Method2().ConfigureAwait(false); // Do something else // ... await Method3().ConfigureAwait(false); await Method4().ConfigureAwait(false); But in such case wouldn't be clearer just resetting

Is there a way to serve a Blazor app from a specific controller action in a MVC app?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:13:40
问题 I'd like to set up a controller action in a already existing ASP.NET Core 3.0 MVC project to serve a Blazor app. I've seen something similar with other SPA frameworks in the past, the View for the action just includes contains the script tag with the bundle, there's usually some other setup like having the SPA build placed on wwwroot for the MVC project. Looking at the Blazor app it seems similar to some extent, where the index.html file includes the wasm script. But I'm honestly not sure