简体   繁体   English

如何为我的项目创建 NuGet.config?

[英]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在 VS 中,从工具->NuGet Package 管理器在此处输入图像描述

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 Nuget 解决方案包

在此处输入图像描述

How to create a NuGet.config file in my repo?如何在我的仓库中创建一个 NuGet.config 文件?

Assuming you have the .NET (Core) SDK installed, and therefore have the do.net CLI available, run do.net new nugetconfig in the directory you want the nuget.config file created.假设您安装了 .NET(核心)SDK,因此可以使用do.net CLI,在您想要创建 nuget.config 文件的目录中运行do.net new nugetconfig

I also recommend using the do.net cli and/or nuget.exe to edit the file, or edit it with a text editor.我还建议使用 do.net cli 和/或 nuget.exe 来编辑文件,或使用文本编辑器进行编辑。 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. Visual Studio 选项对话框不够复杂,无法知道要将源添加到哪个 nuget.config 文件(并且不提供 gui 来编辑源以外的任何设置),因此您可能会找到源并从中添加和删除nuget.config 文件,如果你使用它,你不打算这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM