恢复 Options.ConfigurationExtensions 包时出错

Error while restoring Options.ConfigurationExtensions package

我正在尝试实现此 link 中提到的选项模式 - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration#options-example

为此,首先在我的 project.json

中添加以下内容
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"

但是我在恢复这个包时遇到错误- ConfigurationExtensions Error

我完整的project.json是这样的-

{
  "dependencies": {
    "Glimpse": "2.0.0-beta1",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Identity": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
    "Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.0.0",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    }
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "net461": { }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config",
      "Views",
      "Areas/**/Views",
      "appsettings.json"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

我的环境是 - VS2015 update3、.net core SDK 1.0.0 和 preview2 工具

我的项目模板是 - ASP.NET 核心应用程序(.NET 框架 4.6.1)

有人可以指导我吗?


如果我创建新项目,我可以默认看到 ConfigurationExtensions

"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"

但是当我在 RC1 期间创建的现有项目中添加它时,它给我错误消息-

Error NU1001 The dependency Microsoft.Extensions.Options.ConfigurationExtensions >= 1.0.0 could not be resolved.

请帮我解决这个问题。

我正在尝试从 VS2015 恢复包 通过右键单击参考 > 恢复包

但是不知何故,VS2015 没有恢复这个特定的包。

然后我尝试了 dotnet restore 命令并且成功了。

将此添加为自我回答,这可能会对将来的人有所帮助。