AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

The name 'Configuration' does not exist in the current context

Open samrae7 opened this issue 8 years ago • 6 comments

When registering the database context, if I have the code like that I get the error "The name 'Configuration' does not exist in the current context". Can anyone help?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

samrae7 avatar Aug 05 '18 22:08 samrae7

Add using Microsoft.Extensions.Configuration;

Rick-Anderson avatar Aug 06 '18 01:08 Rick-Anderson

BTW, why are you using VS Code and not VS?

Rick-Anderson avatar Aug 06 '18 01:08 Rick-Anderson

Thanks for that. I am using vscode for other projects and I prefer it. VS seems to do a lot more (like automatically adding dependencies like this I guess) and I prefer to see a bit more explicitly what's going on

samrae7 avatar Aug 07 '18 07:08 samrae7

VS doesn't automatically add dependencies, it just tells you what you need to add so you don't need to open an issue :)

Rick-Anderson avatar Aug 07 '18 16:08 Rick-Anderson

@Rick-Anderson landed here from a google search - which helped me solve my problem. I would encourage MS to actually see this as a problem. Having problems understanding what's going on using the command line tools for a tool that supposedly supports the command line and other setups / OSs... "use Visual Studio" isn't ideal.

Thanks for all your hard work. I am having fun playing around with .net on linux :).

robrohan avatar Jul 02 '21 23:07 robrohan

I agree with the above comment. Microsoft behaves as platform exclusive and act like they don't. I would like to use whatever editor I choose to use. Plus, in ASP.NET core 6; you get the method from the builder object like so: builder.Configuration.GetConnectionString("BloggingDatabase") And this solution should've been easy to search, but I had to visit a couple links to find it.

that-one-arab avatar Apr 22 '22 10:04 that-one-arab