1

在我们将 Web 应用程序升级到 asp.net core 1.0 后,我们无法在 Appveyor 中成功构建。

有几个nuget包问题,第一个错误是:

Microsoft.AspNetCore.Mvc 1.0.0 与 .NETCoreApp 不兼容,版本=v1.0。

在使用的提要中https://www.nuget.org/api/v2,我们认为应该使用V3 version来构建核心 1.0 Web 项目。

我们的假设是否正确,我们如何强制 appveyor 使用 v3 api 而不是 v2?

我们如何成功构建我们的 asp.net core 1.0 项目?


更新

我们的假设似乎不正确,使用命令

nuget sources update -Name nuget.org -Source https://api.nuget.org/v3/index.json

新的 v3 提要已成功使用,但构建仍然失败并出现相同的错误。


来自构建服务器的 dotnet 信息:

.NET 命令行工具 (1.0.0-preview2-003121)

产品信息:

  • 版本:1.0.0-preview2-003121
  • 提交 SHA-1 哈希:已删除

运行环境:

  • 操作系统名称:Windows
  • 操作系统版本:6.3.9600
  • 操作系统平台:Windows
  • 摆脱:win81-x64

还有我们的 project.json:

{
"dependencies": {
    "Microsoft.NETCore.App": {
        "version": "1.0.0",
        "type": "default"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "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"
},

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

"frameworks": {
    "netcoreapp1.0": {}
},

"buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "compile": {
        "exclude": [
            "wwwroot",
            "node_modules"
        ]
    }
},

"runtimes": {
    "win10-x64": {}
},

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

//"publishExclude": [
//    "**.user",
//    "**.vspscc"
//],

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

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

和 global.json

{
    "projects": [ "src", "test" ],
    "sdk": {
        "version": "1.0.0-preview2-003121"
    }
}
4

1 回答 1

1

尝试在构建期间使用以下命令更新 nuget 源:

nuget sources update -Name nuget.org -Source https://api.nuget.org/v3/index.json
于 2016-06-29T17:31:02.913 回答