简体   繁体   English

带有PCL的.NET Core 1.1应用程序,无法在Team Service上构建

[英].NET Core 1.1 app with PCL, unable to build on Team services

I have following projects on solution and this works perfectly fine on my local. 我有以下有关解决方案的项目,这在我的本地环境中效果很好。

在此处输入图片说明

However when I check code in Team service and create build it fails. 但是,当我在团队服务中检查代码并创建构建时,它失败。

mainconsole.csproj

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>    
    <PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\business\business.csproj" />
    <ProjectReference Include="..\portableextensibility\portableextensibility.csproj" />
    <ProjectReference Include="..\portablelibrary\portablelibrary.csproj" />
  </ItemGroup>
</Project>    

Build tasks: 构建任务:

  1. command line - tool dotnet , argument - restore 命令行-工具dotnet ,参数- restore

  2. command line - tool dotnet , argument - build 命令行-工具dotnet ,参数- build

Build fails: 构建失败:

d:\\a\\3\\s\\portablelibrary\\portablelibrary.csproj(43,3): error MSB4019: The imported project "C:\\Program Files\\dotnet\\sdk\\1.0.4\\Microsoft\\Portable\\v4.5\\Microsoft.Portable.CSharp.targets" was not found. d:\\ a \\ 3 \\ s \\ portablelibrary \\ portablelibrary.csproj(43,3):错误MSB4019:导入的项目“ C:\\ Program Files \\ dotnet \\ sdk \\ 1.0.4 \\ Microsoft \\ Portable \\ v4.5 \\ Microsoft找不到“ .Portable.CSharp.targets”。 Confirm that the path in the declaration is correct, and that the file exists on disk. 确认声明中的路径正确,并且文件在磁盘上。 d:\\a\\3\\s\\portableextensibility\\portableextensibility.csproj(42,3): error MSB4019: The imported project "C:\\Program Files\\dotnet\\sdk\\1.0.4\\Microsoft\\Portable\\v4.5\\Microsoft.Portable.CSharp.targets" was not found. d:\\ a \\ 3 \\ s \\ portableextensibility \\ portableextensibility.csproj(42,3):错误MSB4019:导入的项目“ C:\\ Program Files \\ dotnet \\ sdk \\ 1.0.4 \\ Microsoft \\ Portable \\ v4.5 \\ Microsoft找不到“ .Portable.CSharp.targets”。 Confirm that the path in the declaration is correct, and that the file exists on disk. 确认声明中的路径正确,并且文件在磁盘上。

C:\\Program Files\\dotnet\\sdk\\1.0.4\\NuGet.targets(97,5): error : Unable to resolve 'd:\\a\\3\\s\\portableextensibility\\portableextensibility.csproj' for '.NETCoreApp,Version=v1.1'. C:\\ Program Files \\ dotnet \\ sdk \\ 1.0.4 \\ NuGet.targets(97,5):错误:无法为'.NETCoreApp,Version解析'd:\\ a \\ 3 \\ s \\ portableextensibility \\ portableextensibility.csproj' = 1.1' 版。 [d:\\a\\3\\s\\dotnetcompatibility.sln] C:\\Program Files\\dotnet\\sdk\\1.0.4\\NuGet.targets(97,5): error : Unable to resolve 'd:\\a\\3\\s\\portablelibrary\\portablelibrary.csproj' for '.NETCoreApp,Version=v1.1'. [d:\\ a \\ 3 \\ s \\ dotnetcompatibility.sln] C:\\ Program Files \\ dotnet \\ sdk \\ 1.0.4 \\ NuGet.targets(97,5):错误:无法解析'd:\\ a \\ 3 \\ s \\ portablelibrary \\ portablelibrary.csproj',表示“ .NETCoreApp,Version = v1.1”。 [d:\\a\\3\\s\\dotnetcompatibility.sln] Generating MSBuild file d:\\a\\3\\s\\mainconsole\\obj\\mainconsole.csproj.nuget.g.props. [d:\\ a \\ 3 \\ s \\ dotnetcompatibility.sln]生成MSBuild文件d:\\ a \\ 3 \\ s \\ mainconsole \\ obj \\ mainconsole.csproj.nuget.g.props。 Generating MSBuild file d:\\a\\3\\s\\mainconsole\\obj\\mainconsole.csproj.nuget.g.targets. 生成MSBuild文件d:\\ a \\ 3 \\ s \\ mainconsole \\ obj \\ mainconsole.csproj.nuget.g.targets。 Writing lock file to disk. 将锁定文件写入磁盘。 Path: d:\\a\\3\\s\\mainconsole\\obj\\project.assets.json Restore failed in 37.7 sec for d:\\a\\3\\s\\mainconsole\\mainconsole.csproj. 路径:d:\\ a \\ 3 \\ s \\ mainconsole \\ obj \\ project.assets.json对于d:\\ a \\ 3 \\ s \\ mainconsole \\ mainconsole.csproj,还原在37.7秒内失败。 Errors in d:\\a\\3\\s\\business\\business.csproj Unable to resolve 'd:\\a\\3\\s\\portablelibrary\\portablelibrary.csproj' for '.NETStandard,Version=v1.1'. d:\\ a \\ 3 \\ s \\ business \\ business.csproj中的错误无法为'.NETStandard,Version = v1.1'解析'd:\\ a \\ 3 \\ s \\ portablelibrary \\ portablelibrary.csproj'。 Errors in d:\\a\\3\\s\\mainconsole\\mainconsole.csproj Unable to resolve 'd:\\a\\3\\s\\portableextensibility\\portableextensibility.csproj' for '.NETCoreApp,Version=v1.1'. d:\\ a \\ 3 \\ s \\ mainconsole \\ mainconsole.csproj中的错误无法为'.NETCoreApp,Version = v1.1'解析'd:\\ a \\ 3 \\ s \\ portableextensibility \\ portableextensibility.csproj'。 Unable to resolve 'd:\\a\\3\\s\\portablelibrary\\portablelibrary.csproj' for '.NETCoreApp,Version=v1.1'. 无法为'.NETCoreApp,Version = v1.1'解析'd:\\ a \\ 3 \\ s \\ portablelibrary \\ portablelibrary.csproj'。

在此处输入图片说明

由于该解决方案包含当前无法使用dotnet cli构建的PCL库,因此必须通过msbuild而不是基于dotnet的命令来构建项目。

Here is the corrected configuration: 这是更正的配置:

Build Definition 构建定义

在此处输入图片说明

Queue options 队列选项

在此处输入图片说明

Result 结果

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM