简体   繁体   中英

IOptions<Applications> does not contain definition 'Options' in ASP.NET 5 Beta 8

Problem

I am having trouble with upgrading my beta7 application to beta8. I orginally had over 50 errors, but I have basically gotten it down to two persistent errors remaining that I have been unable to resolve. One is with Options.

Options Missing Error

Here is the error:

Error CS1061 'IOptions<ApplicationSettings>' does not contain a definition for 'Options' and no extension method 'Options' accepting a first argument of type 'IOptions<ApplicationSettings>' could be found (are you missing a using directive or an assembly reference?) SampleProject.DNX 4.5.1

Here is the code:

private IOptions<ApplicationSettings> _applicationSettings;

// Authenticate user credentials against Active Directory
bool isAuthenticated = await Authentication.ValidateCredentialsAsync(
                domainController: _applicationSettings.Options.DomainController,
                port: _applicationSettings.Options.DomainControllerSslPort,
                domain: _applicationSettings.Options.DomainController,
                username: model.eID,
                password: model.Password);

The specific problem above is with _applicationSettings.Options.DomainController

Attempts:

I tried the following things:

  • I tried using intellisense and GitHub to find where 'Options' for IOptions went, but I have been unsuccessful.
  • I also tried dnu restore just to be sure the upgrade didn't do something strange with my project.json lock.

Now that beta8 is feature complete, I may rewrite significant portions of my project. However, for now I need to resolve these errors so that I can compile the project again. Any help, assistance, and advice rendered would be greatly appreciated.

Note : I edited this to one question based on feedback

The Options property of IOptions<T> was renamed to Value . Try:

_applicationSettings.Value

Also see this issue .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM