我为使用Azure AD B2C的ASP.NET Core 1.1项目设置了CI(来自此示例 - https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp)。这就是我在.csproj文件中的内容:
<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>
当我转到VSTS时,我看到以下日志有错误:
开始:构建
*************** *********
任务:.NET Core 描述:使用dotnet core命令行构建,测试和发布。 版本:1.0.2 作者:微软公司
帮助: More Information
&#34; C:\ Program Files \ dotnet \ dotnet.exe&#34; build d:\ a \ 1 \ s \ MMLServices \ MMLServices.csproj - 配置版本 Microsoft(R)Build Engine版本15.1.1012.6693 版权所有(C)Microsoft Corporation。保留所有权利。
C:\ Users \ buildguest.nuget \ packages \ buildwebcompiler \ _ 1.11.326 \ build \ BuildWebCompiler.targets(15,9):错误MSB4062:&#34; WebCompiler.CompilerBuildTask&#34;无法从程序集C:\ Users \ buildguest.nuget \ packages \ buildwebcompiler \ _ 1.11.326 \ build .. \ tools \ WebCompiler.exe加载任务。无法加载文件或程序集&#39; Microsoft.Build.Utilities.v4.0,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a&#39;。该系统找不到指定的文件。确认声明是否正确,程序集及其所有依赖项是否可用,以及该任务是否包含实现Microsoft.Build.Framework.ITask的公共类。 [d:\一个\ 1 \ S \ MMLServices \ MMLServices.csproj]
构建失败。
C:\ Users \ buildguest.nuget \ packages \ buildwebcompiler \ _ 1.11.326 \ build \ BuildWebCompiler.targets(15,9):错误MSB4062:&#34; WebCompiler.CompilerBuildTask&#34;无法从程序集C:\ Users \ buildguest.nuget \ packages \ buildwebcompiler \ _ 1.11.326 \ build .. \ tools \ WebCompiler.exe加载任务。无法加载文件或程序集&#39; Microsoft.Build.Utilities.v4.0,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a&#39;。该系统找不到指定的文件。确认声明是否正确,程序集及其所有依赖项是否可用,以及该任务是否包含实现Microsoft.Build.Framework.ITask的公共类。 [d:\一个\ 1 \ S \ MMLServices \ MMLServices.csproj] 0警告 1个错误
时间流逝00:00:03.66 错误:C:\ Program Files \ dotnet \ dotnet.exe失败,返回码为:1 Dotnet命令在以下项目中以非零退出代码失败:d:\ a \ 1 \ s \ MMLServices \ MMLServices.csproj
那么,我该如何解决这个问题?
更新
我添加了debug=true
,此后的日志(发布任务):
2017-06-20T15:23:36.6048010Z [command]&#34; C:\ Program Files \ dotnet \ dotnet.exe&#34;发布d:\ a \ 1 \ s \ MMLServices \ MMLServices.csproj - 配置版本 - 输出d:\ a \ 1 \ a \ MMLServices 2017-06-20T15:23:36.7748032Z Microsoft(R)Build Engine版本15.1.1012.6693 2017-06-20T15:23:36.7758030Z版权所有(C)Microsoft Corporation。版权所有。 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):错误MSB4062:&#34; WebCompiler.CompilerBuildTask&#34;无法从程序集C:\ Users \ buildguest.nuget \ packages \ buildwebcompiler \ _ 1.11.326 \ build .. \ tools \ WebCompiler.exe加载任务。无法加载文件或程序集&#39; Microsoft.Build.Utilities.v4.0,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a&#39;。该系统找不到指定的文件。确认声明是否正确,程序集及其所有依赖项是否可用,以及该任务是否包含实现Microsoft.Build.Framework.ITask的公共类。 [d:\一个\ 1 \ S \ MMLServices \ MMLServices.csproj] 2017-06-20T15:23:37.3943585Z ## [debug] rc:1 2017-06-20T15:23:37.3943585Z ## [debug]成功:false 2017-06-20T15:23:37.3973597Z ## [错误]错误:C:\ Program Files \ dotnet \ dotnet.exe失败,返回码:1 2017-06-20T15:23:37.3973597Z ## [debug]已处理:## vso [task.issue type = error;]错误:C:\ Program Files \ dotnet \ dotnet.exe失败,返回码:1 2017-06-20T15:23:37.4003593Z ## [debug]任务结果:失败 2017-06-20T15:23:37.4003593Z ## [错误] Dotnet命令在以下项目中以非零退出代码失败:d:\ a \ 1 \ s \ MMLServices \ MMLServices.csproj 2017-06-20T15:23:37.4003593Z ## [debug]已处理:## vso [task.issue type = error;] Dotnet命令在以下项目中以非零退出代码失败:d:\ a \ 1 \小号\ MMLServices \ MMLServices.csproj 2017-06-20T15:23:37.4034692Z ## [debug]已处理:## vso [task.complete result = Failed;] Dotnet命令在以下项目中以非零退出代码失败:d:\ a \ 1 \小号\ MMLServices \ MMLServices.csproj 2017-06-20T15:23:37.4073330Z ## [section]整理:发布
答案 0 :(得分:0)
问题与使用BuildWebCompiler包进行donet构建有关。您可以改为使用Visual Studio Build任务:
更新:
关于发布,您可以参考这些步骤(不能使用dotnet发布):
样品:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<PublishFramework>netcoreapp1.1</PublishFramework>
<ProjectGuid>6ecb453c-aea3-44af-8185-059fbac7b56c</ProjectGuid>
<DesktopBuildPackageLocation>E:\yy\WebApp-OpenIDConnect-DotNet.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>Default Web Site/tt</DeployIisAppPath>
<PublishDatabaseSettings>
<Objects xmlns="" />
</PublishDatabaseSettings>
</PropertyGroup>
</Project>
/p:DeployOnBuild=true /p:PublishProfile=[publish profile];DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp-OpenIDConnect-DotNet.zip"
答案 1 :(得分:0)
好吧,我删除了Build定义并添加了一个新定义 - 这次使用ASP.NET Core(.NET Framework)模板,一切正常。