2017-05-27 89 views
0

我有一個Angular 4.1.1應用程序坐在.NET Core 1.1,我最近從VS2015 W /更新3遷移到VS2017。我的csproj在我的本地機器上構建並運行良好,但在通過託管的VS2017代理設置VSTS上的構建時失敗。Angular4.1與.NET Core1.1構建失敗VSTS託管VS2017代理

未能在「生成」步驟發生在這裏是日誌文件的指示原因的部分:即打字稿不

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網站發現包括作爲VS2017託管代理支持的一部分(對於'託管'代理最多支持v2.0.6),我認爲這可能是上述錯誤的原因,但是我已經能夠成功構建'在我將應用程序遷移到VS2017之前託管'代理,同時使用我打字稿的相同版本(2.2)試圖部署現在..

我會很感激任何人可以幫助我解決這個問題。這裏是我參考的csproj:

<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>

回答

0

我最近安裝了類似的構建和遇到了這個同樣的問題。我能夠通過爲「dotnet恢復」添加.NET Core步驟來解決此問題。

+0

感謝您的回覆。我不確定你指的是什麼。在「構建」步驟之前有一個「恢復」步驟,這一步很好。除此之外,我沒有關注.. –

0

改爲使用Microsoft.TypeScript.MSBuild 2.3.3。 (有2.2.2的問題)。

這是我的csproj(不需要添加Microsoft.TypeScript.Compiler包)

<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> 

注:根據我的測試,打字稿2.1可用於託管VS2017劑。

+0

感謝您的回覆。將Microsoft.Typescript.MSBuild更新爲2.3.3會在VSTS中產生不同的構建錯誤,如「無法找到模塊'@ angular/core'」和所有其他角度模塊。但是,升級到2.3.3後,我仍然可以在我的機器上構建並運行良好。思考? –

+0

你可以在onedrive上共享一個簡單的應用程序嗎? –

+0

如果您直接使用typescript 2.1,結果如何? (刪除Microsoft.Typescript.MSBuild和Microsoft.TypeScript.Compiler軟件包) –