Azure-functions-durable-extension: NuGet restore fails on VSTS when using .NET Framework

Created on 4 Sep 2018  路  3Comments  路  Source: Azure/azure-functions-durable-extension

Description:
NuGet packages referenced by Microsoft.Azure.WebJobs.Extensions.DurableTask fail to correctly restore on VSTS when using .NET Framework. (works fine in Visual Studio)

The following 2 packages do not have a version compatible with .NETFramework:

  • Microsoft.Extensions.Options 2.1.1
  • Microsoft.Extensions.Configuration.Abstractions 2.1.1

Steps to reproduce:
An Azure Functions V1 project with a DurableTask extension installed.
Target Framework must be set to .NETFramework (tested with v4.7.2).
Run nuget restore command for the solution.
The command will fail as described above and report an error in the logs shown below.

Version:
Microsoft.Azure.WebJobs.Extensions.DurableTask v1.6.0

Log:

Package Microsoft.Extensions.Configuration.Abstractions 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.Extensions.Configuration.Abstractions 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
Package Microsoft.Extensions.Options 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.Extensions.Options 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
One or more packages are incompatible with .NETFramework,Version=v4.7.2.)

Most helpful comment

Issues was with the NuGet.exe version. For restore to succeed NuGet.exe >=4.3 needs to be used.
Adding NuGet Tool Installer task to the build definition allowed package restore to succeed (as specified here: #5164).

All 3 comments

.NET Framework 4.6.1 and beyond is compatible with .NET Standard 2.0, so having these dependencies should not be an issue. Our AppVeyor CI is able to restore and build our .NET Framework 4.x test project just fine too. I ran nuget restore on one of the sample projects which I upgraded to 1.6.0 and got this output:

C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled>nuget restore
MSBuild auto-detection: using msbuild version '15.8.168.64424' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'.
Restoring packages for C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled\VSSample.csproj...
Restoring packages for C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\VSSample.Tests.csproj...
Committing restore...
Tool assets file has not changed. Skipping assets file write. Path: C:\Users\cgillum\.nuget\packages\.tools\dotnet-xunit\2.3.1\netcoreapp2.1\project.assets.json
Restore completed in 228.36 ms for C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\VSSample.Tests.csproj.
Committing restore...
Committing restore...
Generating MSBuild file C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\obj\VSSample.Tests.csproj.nuget.g.props.
Generating MSBuild file C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled\obj\VSSample.csproj.nuget.g.props.
Generating MSBuild file C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\obj\VSSample.Tests.csproj.nuget.g.targets.
Generating MSBuild file C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled\obj\VSSample.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\obj\project.assets.json
Writing lock file to disk. Path: C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled\obj\project.assets.json
Restore completed in 3.03 sec for C:\Code\GitHub\azure-functions-durable-extension\samples\VSSample.Tests\VSSample.Tests.csproj.
Restore completed in 3.03 sec for C:\Code\GitHub\azure-functions-durable-extension\samples\precompiled\VSSample.csproj.

NuGet Config files used:
    C:\Users\cgillum\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
    C:\LocalNuGet
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
    https://api.nuget.org/v3/index.json
    https://www.myget.org/F/azure-appservice-staging/api/v3/index.json

Let me know if you think there might be something I'm doing which is covering up an issue.

Issues was with the NuGet.exe version. For restore to succeed NuGet.exe >=4.3 needs to be used.
Adding NuGet Tool Installer task to the build definition allowed package restore to succeed (as specified here: #5164).

Update your NuGet installer to version 2.*. After that NuGet.exe will auto-update to version 4.3

Was this page helpful?
0 / 5 - 0 ratings