Azure / Azure/Azure-Functions

dotnet restore on Azure Functions projects ignores local NuGet.config

Open
#2,445 6 comments 2 reactions 1 assignee Claimed by @bhagyshricompany View on GitHub
bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Azure Functions project cannot be properly restored if there is no machine-level package source defined.

# Steps to reproduce:

- edit `%appdata%\NuGet\NuGet.Config` and remove all package sources
- if there are other global config files defined, remove the package sources from them
- create a new azure functions project and add a nuget config file, in the solution or project folder, with the correct package sources. You can use the default one that references nuget.org
- run `dotnet restore` (it has to be `dotnet restore` since `nuget restore` works)

# Actual behavior

The following errors are returned:
```
error NU1100: Unable to resolve 'Microsoft.NETCore.Targets (>= 3.0.0)' for 'net6.0'.
error NU1100: Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 4.0.1)' for 'net6.0'.
```

# Expected behavior

`dotnet restore` should consider the local nuget configuration file and use it.

# Additional notes

As far as I can tell, the problem only appears when referencing:
```

```

# Workaround

Ensure that `%appdata%\NuGet\NuGet.Config` has a valid package source defined.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.