3

I have a application built on ASPNET Core RC1, which is using string typed configuration Options, and I am trying to migrate to RC2.

But the following code is not working anymore:

services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));

According to ASPNET Core docs, it was supposed to converted this way:

services.Configure<AppSettings>(Configuration);

But this is also not working. The only overload available for the Configure extensions method accepts only a Action as parameter, and I don't want to have to parse the entire configuration myself.

What would be the right way to migrate this code?

ecsousa
  • 158
  • 6
  • This isn't working for me either; and adding the ConfigurationExtensions package doesn't help. I can reference (via Configuration in startup) the whole path (i.e. "MyOptions:SubKey:SubKey"), but using GetSection() on "MyOptions" returns a value of null. – SergioL Jun 08 '16 at 20:37

1 Answers1

4

Try adding Microsoft.Extensions.Options.ConfigurationExtensions package.

adem caglin
  • 22,700
  • 10
  • 58
  • 78
  • A comment helped me. See @Couch's comment on http://stackoverflow.com/a/37293489/5426333 .It contains a link https://github.com/aspnet/Home/issues/1193 – adem caglin May 23 '16 at 06:20
  • Thanks, it was missing the package. – ecsousa May 24 '16 at 16:58
  • Wow i spent days trying to upgrade to RC2 (Identity Framework with EF6 doesnt yet work for RC2) https://github.com/aspnet/Announcements is a good page to follow for breaking changes between releases – Shrage Smilowitz May 24 '16 at 23:29