NuGet.Protocol (I have 5.5.1)This is the code I used.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;
namespace WhyNoNuGet
{
public static class Function1
{
[FunctionName("Function1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req)
{
var repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json");
await repository.GetResourceAsync<FindPackageByIdResource>();
return new OkObjectResult("Done.");
}
}
}
App should start, and find NuGet.Protocol.
This is what I see when I am using Microsoft.NET.Sdk.Functions 3.0.3:

NuGet.Protocol should be in the bin directory.

The app shows error on start-up with 3.0.4, 3.0.5, and 3.0.6 (I tried them all)

[4/18/2020 8:51:43 AM] The 'Function1' function is in error: Unable to load one or more of the requested types.
[4/18/2020 8:51:43 AM] Could not load file or assembly 'NuGet.Protocol, Version=5.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
[4/18/2020 8:51:43 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'. System.Private.CoreLib: Could not load file or assembly 'NuGet.Protocol, Version=5.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Note that the bin directory is much more empty with 3.0.4 and on (note there is no NuGet.Protocol)

@joelverhagen I bumped into a very similar issue, see https://github.com/Azure/azure-functions-host/issues/5894 for a temporary workaround.
I had the exact same problem with Microsoft.NET.Sdk.Functions 3.0.9 and NuGet.Protocol 5.8.0.
The workaround suggested in Azure/azure-functions-host#5894 did help:
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
Thanks a lot @simonness :+1:
Most helpful comment
I had the exact same problem with
Microsoft.NET.Sdk.Functions3.0.9 andNuGet.Protocol5.8.0.The workaround suggested in Azure/azure-functions-host#5894 did help:
Thanks a lot @simonness :+1: