Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet.Protocol disappears from bin in version 3.0.4 or greater #414

Closed
joelverhagen opened this issue Apr 18, 2020 · 2 comments
Closed

NuGet.Protocol disappears from bin in version 3.0.4 or greater #414

joelverhagen opened this issue Apr 18, 2020 · 2 comments
Assignees

Comments

@joelverhagen
Copy link

Repro steps

  1. Open Visual Studio (I have 16.5.3)
  2. Create a new Azure Function project.
  3. Install the latest version of NuGet.Protocol (I have 5.5.1)
  4. Update the Microsoft.NET.Sdk.Functions package to 3.0.4 (My template had 3.0.3)
  5. Add a bit of code to reference the package.
  6. Start the function locally (Ctrl+ F5)

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.");
        }
    }
}

Excepted

App should start, and find NuGet.Protocol.

This is what I see when I am using Microsoft.NET.Sdk.Functions 3.0.3:

image

NuGet.Protocol should be in the bin directory.

image

Actual

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

image

[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)
image

@simonness
Copy link

@joelverhagen I bumped into a very similar issue, see Azure/azure-functions-host#5894 for a temporary workaround.

@ghost
Copy link

ghost commented Nov 17, 2020

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants