Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).
nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]
nuget setapikey [apikey] -source [feedUrl] -configFile [configFilePath]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath]
Don't bother putting the above nuget.config files into source control as they'll only work on the machine and the account that created the configs.
To be able to share credentials, use the -StorePasswordInClearText option:
nuget setapikey [apikey] -source [feedUrl] -configFile [configFilePath]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath] -StorePasswordInClearText
So currently I've added the following in my NuGet.targets file:
That works fine for VS and TeamCity.
Now, I'm trying to do the same with Windows Azure Websites, using Git deploys but it doesn't want to execute this properly, the command exited with code 1, but since I have no control over the environment I don't know what went wrong exactly.
Unable to find any package source(s) matching name: MyPrivateFeed.
C:\DWASFiles\Sites\someSite\VirtualDirectory0\site\repository.nuget\nuget.targets(91,7): warning : "DeleteSection" cannot be called on a NullSettings. [C:\DWASFiles\Sites\someSite\VirtualDirectory0\site\repository\My.Site.Project\My.Site.Project.csproj]
C:\DWASFiles\Sites\someSite\VirtualDirectory0\site\repository.nuget\nuget.targets(91,7): warning MSB3073: The command ""C:\DWASFiles\Sites\someSite\VirtualDirectory0\site\repository.nuget\nuget.exe" sources add -Name MyPrivateFeed -source http://www.myget.org/F/MyPrivateFeed -UserName myUser -Password myPass" exited with code 1. [C:\DWASFiles\Sites\someSite\VirtualDirectory0\site\repository\My.Site.Project\My.Site.Project.csproj]