c# - dotnet 新项目无法恢复它的依赖项

标签 c# asp.net-core-mvc visual-studio-2015

我想使用 mvc6 创建一个网络应用程序并在 ASP.NET 网络应用程序(.Net 框架) 中搜索 ASP.NET 5 预览模板 我不能找到它,我在谷歌中进一步搜索。大多数解决方案都说要安装 ASP.NET Core 以获取预览模板,而我以某种方式通过安装 ASP.NET Core 获得了它。我正在创建一个新项目,如下所示。

enter image description here

enter image description here

在这一步之后,它正在为我创建新项目,但随后这些事情发生在我的新项目上。

enter image description here

我项目中的所有依赖项都出现类似这样的错误:

NU1002 The dependency System.Runtime.Handles 4.0.1 does not support framework .NETCoreApp,Version=v1.0.

这是我的 project.json

project.json
{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",

    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

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

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

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

这是我的 nuget.config(C:\Users\Charitha\AppData\Roaming\NuGet):

<configuration>
  <packageSources>
   <add key="dotnet.cli" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
    <add key="dotnet.core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="RC2" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
    <add key="AspNetCI" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
</configuration>

I have aleady installed

  • .NET Core Tools for Visual Studio
  • DotNetCore.1.0.0-VS2015Tools.Preview2

如有任何帮助,我们将不胜感激。谢谢

最佳答案

由于您指向的是软件包的发布版本,因此您的 NuGet.Config应该如下所示:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

如果您想要全局更改 Nuget.config 文件内容,则可以在应用程序本地创建一个 NuGet.Config 文件,并确保添加 <clear />作为 <packageSources> 下的第一个元素节点,以便您丢弃任何继承的源。

关于c# - dotnet 新项目无法恢复它的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38328413/

相关文章:

security - .net 核心安全 header 中间件不向外部 http 请求添加 header

c# - 使用 EmbeddedFileProvider 搜索 View 的优先级

azure - VS2015 NuGet无法安装Microsoft.WindowsAzure.ConfigurationManager或ServiceBus

c# - 程序集中写的程序集的入口点信息在哪里?

c# - 如何在用户打开文件时锁定对文件的访问?

c# - 将图标放入 XAML 椭圆

c# - 在 'TContext' 上找不到无参数构造函数

visual-studio - Xamarin - 如何将启动屏幕图像居中(iOS)?

java - Visual Studio 2015 .jar 引用

c# - 远程服务器返回错误 : (403) Forbidden