dotnet / website-feedback

This repo is for dot.net feedback including get started tutorial issues from the site.
MIT License
0 stars 1 forks source link

e\MyMicroservice.csproj : error NU1100: Unable to resolve 'Swashbuckle.AspNetCore (>= 6.6.2)' for 'net8.0'. #276

Closed amarpreetbhatia closed 1 day ago

amarpreetbhatia commented 2 weeks ago

URL

https://dotnet.microsoft.com/en-us/learn/aspnet/microservice-tutorial/run

Operating system

windows

More information about your system

OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64

Description

got error on running dotnet new webapi -o MyMicroservice --no-https on this command but the MyMicroservice folder created. However not able to run the dotnet run as got below error: "\MyMicroservice.csproj : error NU1100: Unable to resolve 'Swashbuckle.AspNetCore (>= 6.6.2)' for 'net8.0'"

run this tutorial on latest LTS version download from website: "dotnet --version 8.0.403 "

dotnet --info

dotnet --info .NET SDK: Version: 8.0.403 Commit: c64aa40a71 Workload version: 8.0.400-manifests.18f19b92 MSBuild version: 17.11.9+a69bbaaf5

Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.403\

.NET workloads installed: Configured to use loose manifests when installing new manifests. There are no installed workloads to display.

Host: Version: 8.0.10 Architecture: x64 Commit: 81cabf2857

.NET SDKs installed: 8.0.403 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

mairaw commented 2 weeks ago

Can you try running dotnet restore and dotnet build?

You can also try checking the instructions listed at https://github.com/dotnet/core/issues/6193#issuecomment-827395026

Did you install chocolatey by any chance? Sometimes we see this issue.

github-actions[bot] commented 2 days ago

This issue is stale because there has been no response to a request for more information for 7 days.

amarpreetbhatia commented 1 day ago

Can you try running dotnet restore and dotnet build?

You can also try checking the instructions listed at dotnet/core#6193 (comment)

Did you install chocolatey by any chance? Sometimes we see this issue.

Hi, thanks for the reply. Yes, I did run the dotnet restore and dotnet build commands, but they had no impact.

And yes, I have Chocolatey installed on my machine. I just tried removing the Chocolatey environment variable and did a fresh attempt following these steps: https://dotnet.microsoft.com/en-us/learn/aspnet/microservice-tutorial/create

But I'm still getting the same NU1100 error. Is there any property or NuGet registry I need to set up on my machine?

mairaw commented 1 day ago

Check the contents of %appdata%\NuGet\NuGet.Config, it's probably empty.

If it's empty, you then wanna try adding a source like dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

Please share the contents of your NuGet.config for us to try to help you

amarpreetbhatia commented 1 day ago

Check the contents of %appdata%\NuGet\NuGet.Config, it's probably empty.

If it's empty, you then wanna try adding a source like dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

Please share the contents of your NuGet.config for us to try to help you

Thank you so much, That was the issue, my NuGet.Config was missing packagesources and after adding source as suggested dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org , it works fine :) that updated file %appdata%\NuGet\NuGet.Config Image

Image

mairaw commented 1 day ago

awesome, great to hear! Closing the issue then but let us know if you have any other issues.