在VSTS托管的VS2017代理中,带有.NET Core1.1构建的Angular4.1失败 [英] Angular4.1 with .NET Core1.1 build fails in VSTS Hosted VS2017 agent

查看:86
本文介绍了在VSTS托管的VS2017代理中,带有.NET Core1.1构建的Angular4.1失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个安装在.NET Core 1.1上的Angular 4.1.1应用程序,我最近从VS2015 w / update 3迁移到VS2017。我的csproj可以在本地计算机上构建并正常运行,但是在通过其托管的VS2017代理在VSTS上建立构建时失败。

I have an Angular 4.1.1 app sitting on .NET Core 1.1 which I recently migrated from VS2015 w/update 3 to VS2017. My csproj builds and runs fine on my local machine but fails when setting up a build on VSTS via their hosted VS2017 agent.

失败发生在构建步骤和这是日志文件中指示原因的部分:

The failure occurs during the "Build" step and here is the portion of the log file indicating the reason:

Installed:
2017-05-27T14:23:05.5884539Z       301 package(s) to d:\a\1\s\src\MyApp.Web\MyApp.Web.csproj
2017-05-27T14:23:05.6244543Z ##[section]Finishing: Restore
2017-05-27T14:23:05.6254542Z ##[section]Starting: Build
2017-05-27T14:23:05.6264541Z ==============================================================================
2017-05-27T14:23:05.6264541Z Task         : .NET Core
2017-05-27T14:23:05.6264541Z Description  : Build, test and publish using dotnet core command-line.
2017-05-27T14:23:05.6264541Z Version      : 1.0.1
2017-05-27T14:23:05.6264541Z Author       : Microsoft Corporation
2017-05-27T14:23:05.6264541Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2017-05-27T14:23:05.6264541Z ==============================================================================
2017-05-27T14:23:05.9804666Z [command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\src\MyApp.Web\Gitrub.Web.csproj --configuration release
2017-05-27T14:23:09.2404951Z Microsoft (R) Build Engine version 15.1.1012.6693
2017-05-27T14:23:09.2404951Z Copyright (C) Microsoft Corporation. All rights reserved.
2017-05-27T14:23:09.2404951Z 
2017-05-27T14:23:14.7693001Z C:\Users\buildguest\.nuget\packages\microsoft.typescript.msbuild\2.2.2\tools\microsoft.TypeScript.targets(168,5): error MSB4062: The "TypeScript.Tasks.FindConfigFiles" task could not be loaded from the assembly C:\Users\buildguest\.nuget\packages\microsoft.typescript.msbuild\2.2.2\tools\TypeScript.tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [d:\a\1\s\src\MyApp.Web\MyApp.Web.csproj]
2017-05-27T14:23:15.0284154Z 
2017-05-27T14:23:15.0284154Z Build FAILED.
2017-05-27T14:23:15.0284154Z 
2017-05-27T14:23:15.0284154Z C:\Users\buildguest\.nuget\packages\microsoft.typescript.msbuild\2.2.2\tools\microsoft.TypeScript.targets(168,5): error MSB4062: The "TypeScript.Tasks.FindConfigFiles" task could not be loaded from the assembly C:\Users\buildguest\.nuget\packages\microsoft.typescript.msbuild\2.2.2\tools\TypeScript.tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [d:\a\1\s\src\MyApp.Web\MyApp.Web.csproj]
2017-05-27T14:23:15.0284154Z     0 Warning(s)
2017-05-27T14:23:15.0284154Z     1 Error(s)
2017-05-27T14:23:15.0294178Z 
2017-05-27T14:23:15.0294178Z Time Elapsed 00:00:05.73
2017-05-27T14:23:15.0564018Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2017-05-27T14:23:15.0564018Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\src\MyApp.Web\MyApp.Web.csproj

我在VSTS网站上注意到,Typescript不包含在VS2017托管代理(对于托管代理最高为v2.0.6)支持的范围内,认为这可能是导致上述错误的原因,但是在将应用程序迁移到VS2017之前,我已经能够在'Hosted'代理上成功运行构建,同时使用的是SAME版本(2.2),现在我正尝试部署..

I noticed on the VSTS Site that Typescript isn't included as part of what is supported by the VS2017 Hosted agent (and up to v2.0.6 for 'Hosted' agent) and I thought this might be the reason for the above error, however I've been able run successful builds on the 'Hosted' agent before I migrated my app to VS2017, while using the SAME version (2.2) of typescript I am trying to deploy now..

我很感谢任何能帮助我解决这个问题的人。这是我的csproj供参考:

I'd appreciate anyone who can help me solve this. Here is my csproj for reference:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>MyApp.Web</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>MyApp.Web</PackageId>
    <RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
    <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <None Update="wwwroot\**\*">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.TypeScript.Compiler" Version="2.2.1" />
    <PackageReference Include="Microsoft.TypeScript.MSBuild" Version="2.2.2" />
  </ItemGroup>

</Project>

推荐答案

改为使用 Microsoft.TypeScript.MSBuild 2.3.3 。 (在2.2.2中有问题)。

Using Microsoft.TypeScript.MSBuild 2.3.3 instead. (have the issue with 2.2.2).

这是我的csproj(无需添加Microsoft.TypeScript.Compiler程序包)

This is my csproj (do not need to add Microsoft.TypeScript.Compiler package)

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.TypeScript.MSBuild" Version="2.3.3" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
  </ItemGroup>

</Project>

注意:根据我的测试,TypeScript 2.1适用于Hosted VS2017代理。

Note: Based on my test, Typescript 2.1 is available for Hosted VS2017 agent.

这篇关于在VSTS托管的VS2017代理中,带有.NET Core1.1构建的Angular4.1失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆