0
votes

I have following projects on solution and this works perfectly fine on my local.

enter image description here

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

  2. command line - tool dotnet, argument - 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. 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. 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'. [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] Generating MSBuild file 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. 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. Errors in d:\a\3\s\business\business.csproj Unable to resolve 'd:\a\3\s\portablelibrary\portablelibrary.csproj' for '.NETStandard,Version=v1.1'. Errors in d:\a\3\s\mainconsole\mainconsole.csproj Unable to resolve 'd:\a\3\s\portableextensibility\portableextensibility.csproj' for '.NETCoreApp,Version=v1.1'. Unable to resolve 'd:\a\3\s\portablelibrary\portablelibrary.csproj' for '.NETCoreApp,Version=v1.1'.

enter image description here

2
does dotnet build work on your local machine? I believe it doesn't.Martin Ullrich
It works. as I think? I copied portable from C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Portable to C:\Program Files\dotnet\sdk\1.0.4\Microsoft\PortableAvi Kenjale
So in this case, msbuild (commandline) and dotnet build both works.Avi Kenjale
you'd have to script that copy for the build servers as well.. msbuild should work automatically on the build servers without copyingMartin Ullrich
@MartinUllrich, Yes I agreed. However MSBuild fails, too.Avi Kenjale

2 Answers

0
votes

Since the solution contains PCL libraries which currently cannot be built using the dotnet cli, the project has to be built through msbuild instead of the dotnet based commands.

0
votes

Here is the corrected configuration:

Build Definition

enter image description here

Queue options

enter image description here

Result

enter image description here