2016-12-19 104 views
0

我很努力地找出什麼是使用團隊城市與csproj引用建立一個.NET核心項目的問題,我實際上是新手相關的團隊城市進程,但我已經閱讀了另一個類似的問題,但沒有任何解決方法適用於我。 這是消息市隊表示:構建錯誤團隊城市.NET核心與.NET庫參考

error NU1001: The dependency Microsoft.ApplicationInsights.AspNetCore >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(4, 39): error NU1001: The dependency Microsoft.AspNetCore.Mvc >= 1.0.1 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(11, 50): error NU1001: The dependency Microsoft.AspNetCore.Server.Kestrel >= 1.0.1 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(13, 64): error NU1001: The dependency Microsoft.Extensions.Configuration.FileExtensions >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(14, 54): error NU1001: The dependency Microsoft.Extensions.Configuration.Json >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(16, 51): error NU1001: The dependency Microsoft.Extensions.Logging.Console >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(17, 49): error NU1001: The dependency Microsoft.Extensions.Logging.Debug >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(18, 67): error NU1001: The dependency Microsoft.Extensions.Options.ConfigurationExtensions >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(24, 43): error NU1001: The dependency Microsoft.AspNetCore.Session >= 1.0.0 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(25, 34): error NU1001: The dependency Swashbuckle >= 6.0.0-beta901 could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(27, 25): error NU1001: The dependency ***.Utilities - .net 4.5.0 project*** could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(30, 24): error NU1001: The dependency ***.Data - .net 4.5.2 project *** could not be resolved. 
• C:\BuildAgent\work\1e2a73a15b18c502\ProjectFolder\ProjectCore\project.json(33, 28): error NU1001: The dependency ***.Domain - .net 4.5.2 project*** could not be resolved. 

這是我project.json

{ 
    "dependencies": { 
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.1", 
    "Microsoft.AspNetCore.Mvc.Abstractions": "1.1.0", 
    "Microsoft.AspNetCore.Mvc.Core": "1.1.0", 
    "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.0", 
    "Microsoft.AspNetCore.Http": "1.1.0", 
    "Microsoft.AspNetCore.Routing": "1.1.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "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", 
    "FluentNHibernate": "2.0.3", 
    "Newtonsoft.Json": "9.0.1", 
    "Microsoft.AspNetCore.Http.Features": "1.1.0", 
    "Microsoft.AspNet.WebApi.Client": "5.2.3", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
    "Microsoft.AspNetCore.Session": "1.0.0", 
    "Swashbuckle": "6.0.0-beta901" 

    }, 

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

    "frameworks": { 
    "net452": { 
     "dependencies": { 
     "***.Utilities": { 
      "target": "project" 
     }, 
     "***.Data": { 
      "target": "project" 
     }, 
     "***.Domain": { 
      "target": "project" 
     } 
     } 
    } 
    }, 

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

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

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

有人能幫助我嗎?我對什麼可能是問題沒有想法。

在此先感謝

+1

這看起來像構建服務器無法與NuGet源進行通信。生成服務器是否可以訪問互聯網?它是使用默認的NuGet源代碼還是您有爲該解決方案定義的自定義NuGet源代碼? –

+0

我們在同一個解決方案中有另一個項目,都是純.NET ......這個新項目是.NET Core,是唯一一個在構建過程中給出錯誤的,據我所知,我們使用默認的NuGet包......我真的被困在這個過程中,可能我會在接下來的幾天裏試圖弄清楚如何解決它。 –

回答

0

我剛剛碰到類似的問題跑了.NET核心項目引用完整的.NET Framework 4.6.1。

首先,檢查構建服務器上是否安裝了正確的.NET核心版本。
實際.NET核心版本可以找到here

然後檢查NuGet.exe版本,並根據需要將其升級到3.5.0。

然後,根據此SO Answer,下載並安裝正確的.NET Framework目標配置文件,並重新啓動TeamCity代理和服務器服務。 (此步驟導致我的構建失敗)

最後,重新構建您的解決方案。 TeamCity應該成功恢復軟件包並構建解決方案。

希望這會有所幫助。

+0

其實我解決了我的問題,添加一個構建步驟來手動執行Nuget'restore'命令。在我發佈的時候,這是實現它的唯一方法。謝謝! –