Reputation: 3411
The Nuget Restore from VSO's build pipeline failed due to some nuget packages that are not compatible with netcoreapp2.1
. However, when I looked through all the csproj files in the solution, none of the csproj files have these nuget packages. I might have installed these before but right now it's definitely not here.
Here's the csproj file that is mentioned in the error message.
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi" Version="5.2.6" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
Here's the Nuget.Config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
Please advise how to fix this issue.
EDIT=====================================================
After removing the nuget package from Microsoft.AspNet.WebApi
, the NugetRestore
passed, but Build solution
failed. It shows a different error
[error]C:\Program Files\dotnet\sdk\2.2.104\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(208,5):
Error NETSDK1004: Assets file 'd:\agentwrok\18\s....\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
This is the configuration for Build Solution
Upvotes: 1
Views: 812
Reputation: 76910
VSO Build Pipeline's Nuget Restore Failed
Just like Volodymyr commented, you should not use the package Microsoft.AspNet.WebApi
for the .net core project. That is because this package is targeted at .NETFramework, not .NET Core/.NETStandard. It is not compatible with .NET Core.
When you check the package Microsoft.AspNet.WebApi
on nuget.org, you will notice that this package has a dependency on Microsoft.AspNet.WebApi.WebHost
, which only targets the .NET Framework:
And the sub-dependency Microsoft.AspNet.WebApi.Core of the package Microsoft.AspNet.WebApi.WebHost
also only targets the .NET Framework:
So, the reason for this issue is that the package Microsoft.AspNet.WebApi
and its dependencies are not compatible with .NET Core framework.
Hope this helps.
Upvotes: 3