2016-07-01 32 views
12

Sau khi tạo dự án ASP.Net Core Web Application (.Net Core) mới trong Visual Studio 2015 Update 3 và được chọn điều này trong kho lưu trữ git của Visual Studio Team Services. Tôi đang sử dụng phiên bản phát hành của .Net Core và ASP.Net Core.Không thể xây dựng ứng dụng Web ASP.Net lõi mặc định (.NET Core) trên Visual Studio Team Services sử dụng Hosted Agent

bây giờ tôi đang cố gắng để xây dựng này bằng cách sử dụng VSTS hệ thống xây dựng sử dụng một định nghĩa xây dựng dựa trên hướng dẫn này: https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnetcore-to-azure

Tuy nhiên, việc xây dựng không thành công trên bước dotnet restore với các bản ghi hiển thị dưới đây (phần đầu tiên không bao gồm, đây là từ nơi nó bắt đầu thất bại).

Tôi đang làm gì sai? Tôi có cần chuẩn bị các Đại lý được lưu trữ hiện tại theo bất kỳ cách nào để làm việc này với bản phát hành ASP.Net Core v1.0.0 không?

2016-07-01T06:58:23.7437947Z log : Restoring packages for tool 'BundlerMinifier.Core' in C:\a\1\s\src\FjordTours.BasicApp\project.json... 
2016-07-01T06:58:23.7457953Z info : GET https://api.nuget.org/v3-flatcontainer/bundlerminifier.core/index.json 
2016-07-01T06:58:24.2167463Z info : OK https://api.nuget.org/v3-flatcontainer/bundlerminifier.core/index.json 469ms 
2016-07-01T06:58:24.2188952Z info : GET https://api.nuget.org/v3-flatcontainer/bundlerminifier.core/2.0.238/bundlerminifier.core.2.0.238.nupkg 
2016-07-01T06:58:24.4460947Z info : OK https://api.nuget.org/v3-flatcontainer/bundlerminifier.core/2.0.238/bundlerminifier.core.2.0.238.nupkg 226ms 
2016-07-01T06:58:24.4500936Z info : GET https://api.nuget.org/v3-flatcontainer/nuglify/index.json 
2016-07-01T06:58:24.7169172Z info : OK https://api.nuget.org/v3-flatcontainer/nuglify/index.json 266ms 
2016-07-01T06:58:24.7184197Z info : GET https://api.nuget.org/v3-flatcontainer/nuglify/1.5.0/nuglify.1.5.0.nupkg 
2016-07-01T06:58:24.9458237Z info : OK https://api.nuget.org/v3-flatcontainer/nuglify/1.5.0/nuglify.1.5.0.nupkg 226ms 
2016-07-01T06:58:25.0165432Z log : Installing NUglify 1.5.0. 
2016-07-01T06:58:25.0175433Z log : Installing BundlerMinifier.Core 2.0.238. 
2016-07-01T06:58:26.3365438Z log : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\a\1\s\src\FjordTours.BasicApp\project.json... 
2016-07-01T06:58:27.5785417Z error: Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:27.5815442Z error: Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports: 
2016-07-01T06:58:27.5815442Z error: - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:27.5828217Z error: - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:27.5835753Z error: One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:27.5845450Z log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\a\1\s\src\FjordTours.BasicApp\project.json... 
2016-07-01T06:58:27.5855447Z info : GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration.tools/index.json 
2016-07-01T06:58:27.8429648Z info : OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration.tools/index.json 257ms 
2016-07-01T06:58:27.8452904Z info : GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration.tools/1.0.0-preview2-final/microsoft.aspnetcore.server.iisintegration.tools.1.0.0-preview2-final.nupkg 
2016-07-01T06:58:28.0722938Z info : OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration.tools/1.0.0-preview2-final/microsoft.aspnetcore.server.iisintegration.tools.1.0.0-preview2-final.nupkg 226ms 
2016-07-01T06:58:28.1392401Z info : GET https://api.nuget.org/v3-flatcontainer/microsoft.dotnet.projectmodel/index.json 
2016-07-01T06:58:28.4376727Z info : OK https://api.nuget.org/v3-flatcontainer/microsoft.dotnet.projectmodel/index.json 298ms 
2016-07-01T06:58:28.4406725Z info : GET https://api.nuget.org/v3-flatcontainer/microsoft.dotnet.projectmodel/1.0.0-rc3-003121/microsoft.dotnet.projectmodel.1.0.0-rc3-003121.nupkg 
2016-07-01T06:58:28.6676393Z info : OK https://api.nuget.org/v3-flatcontainer/microsoft.dotnet.projectmodel/1.0.0-rc3-003121/microsoft.dotnet.projectmodel.1.0.0-rc3-003121.nupkg 227ms 
2016-07-01T06:58:28.6946386Z log : Installing Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121. 
2016-07-01T06:58:28.6956390Z log : Installing Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final. 
2016-07-01T06:58:32.3480344Z error: Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports: 
2016-07-01T06:58:32.3500341Z error: - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.3500341Z error: - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.3510431Z error: One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:32.7120347Z error: Package Microsoft.AspNetCore.Mvc 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.AspNetCore.Mvc 1.0.0 supports: 
2016-07-01T06:58:32.7130338Z error: - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.7140347Z error: - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.7140347Z error: Package Microsoft.ApplicationInsights.AspNetCore 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.ApplicationInsights.AspNetCore 1.0.0 supports: 
2016-07-01T06:58:32.7140347Z error: - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.7150344Z error: - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.7150344Z error: Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.7160344Z error: Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports: 
2016-07-01T06:58:32.7160344Z error: - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.7160344Z error: - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.7174190Z error: One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:32.7174190Z info : Committing restore... 
2016-07-01T06:58:32.7210345Z log : Writing lock file to disk. Path: C:\a\1\s\src\FjordTours.BasicApp\project.lock.json 
2016-07-01T06:58:32.9154998Z log : C:\a\1\s\src\FjordTours.BasicApp\project.json 
2016-07-01T06:58:32.9174999Z log : Restore failed in 44621ms. 
2016-07-01T06:58:32.9274991Z NuGet Config files used: 
2016-07-01T06:58:32.9294993Z Errors in C:\a\1\s\src\FjordTours.BasicApp\project.json 
2016-07-01T06:58:32.9294993Z  Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9305008Z  Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports: 
2016-07-01T06:58:32.9305008Z  - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.9315007Z  - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9315007Z  One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:32.9325003Z  Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports: 
2016-07-01T06:58:32.9325003Z  - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.9325003Z  - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9335002Z  One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:32.9335002Z  Package Microsoft.AspNetCore.Mvc 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.AspNetCore.Mvc 1.0.0 supports: 
2016-07-01T06:58:32.9345003Z  - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.9345003Z  - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9355002Z  Package Microsoft.ApplicationInsights.AspNetCore 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.ApplicationInsights.AspNetCore 1.0.0 supports: 
2016-07-01T06:58:32.9355002Z  - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.9355002Z  - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9365007Z  Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9365007Z  Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports: 
2016-07-01T06:58:32.9374999Z  - net451 (.NETFramework,Version=v4.5.1) 
2016-07-01T06:58:32.9374999Z  - netstandard1.6 (.NETStandard,Version=v1.6) 
2016-07-01T06:58:32.9385006Z  One or more packages are incompatible with .NETCoreApp,Version=v1.0. 
2016-07-01T06:58:32.9385006Z  C:\Users\buildguest\AppData\Roaming\NuGet\NuGet.Config 
2016-07-01T06:58:32.9385006Z  C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config 
2016-07-01T06:58:32.9395005Z Feeds used: 
2016-07-01T06:58:32.9395005Z  https://api.nuget.org/v3/index.json 
2016-07-01T06:58:32.9405006Z  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ 
2016-07-01T06:58:32.9514998Z Installed: 
2016-07-01T06:58:32.9525024Z  159 package(s) to C:\a\1\s\src\FjordTours.BasicApp\project.json 

Các global.json (như được tạo ra bởi ASP.Net Lõi Web Application (Net Core) mẫu):

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

Các project.json (như được tạo ra bởi ASP.Net lõi ứng dụng Web (Net Core) mẫu):

{ 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.0", 
     "type": "platform" 
    }, 
    "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": { 
    "BundlerMinifier.Core": "2.0.238", 
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", 
    "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", 
     "Views", 
     "Areas/**/Views", 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 

    "scripts": { 
    "prepublish": [ "bower install", "dotnet bundle" ], 
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 
    } 
} 
+0

Tôi đã thực hiện theo các hướng dẫn đó nhưng sử dụng thay thế Tác nhân được lưu trữ. Chúng tôi muốn sử dụng các Đại lý được lưu trữ vì chúng tôi hiện không có tùy chọn để sử dụng các đại lý xây dựng tại chỗ. – TomRay74

+0

Trên tab chung, bạn đã thêm "Nhu cầu" nào? –

+0

Tôi không thêm bất kỳ nhu cầu nào. Tôi nên thêm gì? Vì tôi đang sử dụng các Đại lý được lưu trữ, tôi dường như không thể thêm bất kỳ nhu cầu nào. Ngoài ra, theo các tài liệu được đề cập ở trên nhu cầu chỉ cần được thêm vào các đại lý xây dựng tùy chỉnh nhưng xin vui lòng sửa tôi nếu tôi sai. – TomRay74

Trả lời

6

bạn nên thay thế "công cụ" trong project.json của bạn như thế này:

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

một số gói cần phải nhập netstandard1.6 nhưng Microsoft.VisualStudio.Web.CodeGeneration.Tools nhu cầu netstandard1.6portable-net45+win8+wp8+wpa81

+1

Tuyệt vời, điều đó đã giúp tôi loại bỏ hầu hết các lỗi. Nhưng tôi vẫn nhận được các lỗi tương tự cho các gói khác, một số trong chúng không được khai báo rõ ràng trong 'project.json', chẳng hạn như' Microsoft.DotNet.ProjectModel.Loader'. Làm thế nào tôi có thể tìm hiểu cách giải quyết những vấn đề đó? – paulroho

+0

Tôi cũng đã có lỗi với Microsoft.DotNet.ProjectModel.Loader nhưng trong trường hợp của tôi thay thế phần công cụ như mô tả trong câu trả lời của neodim đã giải quyết nó cho tôi. – TomRay74

+0

Là một nút phụ, bạn không còn cần nhập khẩu với preview2 nữa. Hãy thử làm sạch bộ nhớ cache của bạn ('nuget.exe locals -clear all') – Pawel

1

tôi gặp phải vấn đề tương tự với dotnet restore bằng cách sử dụng tổ chức đại lý xây dựng trong VSTS. Dựa trên nhận xét từ @svick, tôi chạy dotnet --version để kiểm tra những gì được cài đặt trên tác nhân được lưu trữ. Kể từ hôm nay, nó vẫn là 1.0.0-preview1-002702 và không phải là phiên bản được tham chiếu của 1.0.0-preview2-003121.

2016-07-04T06:17:47.5047693Z ##[warning]File name doesn't indicate a full path to a executable file. 
2016-07-04T06:17:47.5057787Z Executing the following command-line. (workingFolder = C:\a\1\s) 
2016-07-04T06:17:47.5057787Z dotnet --version 
2016-07-04T06:17:47.5067748Z Error message highlight pattern: 
2016-07-04T06:17:47.5067748Z Warning message highlight pattern: 
2016-07-04T06:17:48.9679166Z 1.0.0-preview1-002702 

Phần mềm chính thức cho các đại lý xây dựng được lưu trữ có thể được tìm thấy tại https://www.visualstudio.com/en-us/docs/build/agents/hosted-pool. Đặc biệt, chú ý nó vẫn hiển thị Visual Studio 2015 Update 2. Hy vọng rằng, điều này được cập nhật sớm.

+0

Kể từ ngày 13 tháng 7 năm 2016, các đại lý xây dựng được lưu trữ trên VSTS đã được cập nhật để bao gồm ".NET Core 1.0 with Preview 2 Tooling". Xem https://blogs.msdn.microsoft.com/visualstudioalm/2016/07/13/july-hosted-build-pool-image-updates/ –

Các vấn đề liên quan