-
[C#] nuget.ConfigC#/기초 2024. 7. 19. 11:45
솔루션 root폴더에 nuget.config 파일생성value = " 패키지소스 상대경로 지정"
피드 추가 방법.
Global Package Source
The global package source lives in %appdata%\nuget\nuget.config and looks like this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="NuGet Package Source" value="https://api.nuget.org/v3/index.json" /> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> <add key="Local NuGet" value="c:\projects\nuget" /> </packageSources> <apikeys> ... </apikeys> </configuration>
This configuration is set when you make changes to your package source configuration in most IDE tools like Visual Studio, Rider, OmniSharp etc.
Solution Local Package Source
But you can also override this global nuget.config file with a local nuget.config in your local Solution Root folder. So to override or add additional package sources I can create a local file, add it to the Solution Root Folder and then add a package source like this:
<configuration> <packageSources> <!-- package source is additive --> <add key="Westwind.WebStore Local" value="./SupportPackages" /> </packageSources> </configuration>
3. Project별 추가
Project Specific PackageSource
Another even easier way to add a package source at the project level is to use <RestoreAdditionalProjectSources> in an individual .NET project, right inside of your project file.
So in my Westwind.Webstore.Business project I can now reference a project relative path:
<PropertyGroup> <TargetFramework>net6.0</TargetFramework> <Version>0.1.2</Version> <RestoreAdditionalProjectSources>./_SupportPackages</RestoreAdditionalProjectSources> </PropertyGroup>
Referencing a Local Private NuGet Package in your Solution
I recently needed to add a local reference to my project and I couldn't quite figure out the best way to do it in a transparent way to consumers of the repository, so that they wouldn't have to explicitly configure additional build settings in order to fin
weblog.west-wind.com
728x90'C# > 기초' 카테고리의 다른 글
[C#] regsvr32 레지스트리 DLL 등록 (0) 2024.07.23 [C#] DllImport (0) 2024.07.23 [C#] gRPC Unit Test (0) 2024.07.04 [C#] Delay, sleep, wait (0) 2024.06.14 [C#] 콘솔 창 없이 실행 (0) 2024.06.12 댓글