MikiBelavista
MikiBelavista

Reputation: 2728

How to create NuGet.config for my project?

I have a small project(I will add some files later). In VS,From Tools->NuGet Package Manager enter image description here

dir in my repo

Mode                 LastWriteTime         Length Name                                                                                  
----                 -------------         ------ ----                                                                                  
d-----         8/22/2021   3:28 PM                bin                                                                                   
d-----         8/22/2021   6:11 PM                obj                                                                                   
-a----         8/22/2021   6:12 PM           9563 Appointments.csproj                                                                   
-a----         8/20/2021   1:57 PM            344 Appointments.csproj.user                                                              
------         7/27/2021   7:13 AM           2100 Appointments.sln                                                                      
------         7/27/2021   7:13 AM           1749 Package.appxmanifest                                                                  
------         7/27/2021   7:13 AM           1985 SampleConfiguration.cs                                                                
------         7/27/2021   7:13 AM          12184 Scenario1_Define.xaml.cs                                                              
------         7/27/2021   7:13 AM           2334 Scenario2_Add.xaml.cs                                                                 
------         7/27/2021   7:13 AM           3991 Scenario3_Replace.xaml.cs                                                             
------         7/27/2021   7:13 AM           3387 Scenario4_Remove.xaml.cs                                                              
------         7/27/2021   7:13 AM           1475 Scenario5_Show.xaml.cs                                                                
------         7/27/2021   7:13 AM           6284 Scenario6_Recurrence.xaml.cs 

Nuget Packages for Solution

enter image description here

How to create a NuGet.config file in my repo?

Upvotes: 6

Views: 20763

Answers (1)

zivkan
zivkan

Reputation: 14981

Assuming you have the .NET (Core) SDK installed, and therefore have the dotnet CLI available, run dotnet new nugetconfig in the directory you want the nuget.config file created.

I also recommend using the dotnet cli with the --config-file argument, and/or nuget.exe with the -ConfigFile argument, to edit the file, or edit it with a text editor. The Visual Studio options dialog is not sophisticated enough to know which nuget.config file you want to add a source to (and doesn't provide a gui to edit any setting other than source), so you might find sources and added and deleted from nuget.config files you didn't intend if you use it.

Upvotes: 20

Related Questions