I set up CI for my ASP.NET Core 1.1 project which uses Azure AD B2C (from this example - https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp). So here's what I have in .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
...
</ItemGroup>
<ItemGroup>
<PackageReference Include="BuildWebCompiler" Version="1.11.326" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.Identity.Client" Version="1.1.0-preview" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>
</Project>
When I go to VSTS I see the following log with errors:
Starting: Build
******************************************************************************
Task : .NET Core Description : Build, test and publish using dotnet core command-line. Version : 1.0.2 Author : Microsoft Corporation
Help : More Information
"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\MMLServices\MMLServices.csproj --configuration release Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build\BuildWebCompiler.targets(15,9): error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build..\tools\WebCompiler.exe. 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 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\MMLServices\MMLServices.csproj]
Build FAILED.
C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build\BuildWebCompiler.targets(15,9): error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build..\tools\WebCompiler.exe. 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 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\MMLServices\MMLServices.csproj] 0 Warning(s) 1 Error(s)
Time Elapsed 00:00:03.66 Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1 Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\MMLServices\MMLServices.csproj
So, how can I fix this?
UPDATE:
I added debug=true
, here's the log after that (Publish task):
2017-06-20T15:23:36.6048010Z [command]"C:\Program Files\dotnet\dotnet.exe" publish d:\a\1\s\MMLServices\MMLServices.csproj --configuration release --output d:\a\1\a\MMLServices 2017-06-20T15:23:36.7748032Z Microsoft (R) Build Engine version 15.1.1012.6693 2017-06-20T15:23:36.7758030Z Copyright (C) Microsoft Corporation. All rights reserved. 2017-06-20T15:23:36.7758030Z 2017-06-20T15:23:37.3732835Z C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build\BuildWebCompiler.targets(15,9): error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\buildguest.nuget\packages\buildwebcompiler\1.11.326\build..\tools\WebCompiler.exe. 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 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\MMLServices\MMLServices.csproj] 2017-06-20T15:23:37.3943585Z ##[debug]rc:1 2017-06-20T15:23:37.3943585Z ##[debug]success:false 2017-06-20T15:23:37.3973597Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1 2017-06-20T15:23:37.3973597Z ##[debug]Processed: ##vso[task.issue type=error;]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1 2017-06-20T15:23:37.4003593Z ##[debug]task result: Failed 2017-06-20T15:23:37.4003593Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\MMLServices\MMLServices.csproj 2017-06-20T15:23:37.4003593Z ##[debug]Processed: ##vso[task.issue type=error;]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\MMLServices\MMLServices.csproj 2017-06-20T15:23:37.4034692Z ##[debug]Processed: ##vso[task.complete result=Failed;]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\MMLServices\MMLServices.csproj 2017-06-20T15:23:37.4073330Z ##[section]Finishing: Publish