c0micrage
c0micrage

Reputation: 1180

WebAPI Core, set a custom nuget/packge folder

I am trying to figure out how to override the package folder from the user folder to a custom folder location like inside my project folder

I have a webapi Core project with an appSetting.json

I read a few posts and may suggests using nuget.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <clear />
    <add key="globalPackagesFolder" value="d:\\packages" />
  </config>
</configuration>

I added in my WebAPI project which show along side with appsetting.json.

When I build the project, I see no package folder.

I also read about packages.config but I can't find that file anywhere.

Any help is appreciated.

Thanks

Upvotes: 0

Views: 59

Answers (1)

Mr Qian
Mr Qian

Reputation: 23760

The nuget.config file should be placed in a directory one level above the project and then it will work.

For an example, the ConsoleApp152 folder is the folder which contains all your project files. And nuget.config file should be placed at the one level above the project files.

enter image description here

When you finish it, please close VS and then restart your project to enable this setting. And it will act on all projects in the directory level where the current nuget.config file is located and also all projects in the subordinate directories.

Upvotes: 1

Related Questions