While i'm trying to invoke AddCommandLine() function on ConfigurationBuilder am getting syntax error that specifying
Project was of .NetStandard 2.0
Environment:
code snippet :
var config = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
Note: Tried to use ConfigurationBuilder from Microsoft.Extensions.Configuration
When getting the following error:
'IConfigurationBuilder' does not contain a definition for 'AddCommandLine' and no extension method 'AddCommandLine' accepting a first argument of type 'IConfigurationBuilder'
Run the following on the Nuget Package Manager Console in Visual Studio
Install-Package -ProjectName MyProj Microsoft.Extensions.Configuration.CommandLine
Or run the following using the dotnet cli:
dotnet add myproj.csproj package Microsoft.Extensions.Configuration.CommandLine
Reference errors for various extensions may be common when working with GenericHost
When working with GenericHost it may be an option to add a metapackage such as:
Microsoft.AspNetCore.App metapackage for ASP.NET Core 2.1
Documenting original answer by Kirk Larkin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With