Azure Functions - Microsoft.NET.Sdk.Functions U1100 Error

I'm trying to setup Visual Studio Code so I can modify Azure Functions but seem to be hitting some issues. The guide that I'm using is the official MS documentation that is found here.

When I go to run the code for the first time, I get the following error:

U1100: Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 4.0.1)' for 'net6.0

I've seen a few similar posts where users ran into this issue but it was on older versions and didn't find an obvious answer for my setup. This entire install if new so there shouldn't be any issues from that perspective.

Any help would be greatly appreciated.

Below is my csproj file.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <RootNamespace>Azure_Functions</RootNamespace>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Solution 1:

I had the same issue as you.

Try the following command from the terminal:

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

It helped me.