Specify Windows User when using nuget on a shared folder

152 views Asked by At

I'm scripting the update of some nuget packages to my shared folder (MSBuild 15):

\\myserver\packages

I changed the Windows User that have access to this shared folder to be: NugetUser.

I can access the share from Explorer, using the NugetUser credentials.

But when I use:

nuget add new_package.1.0.0.nupkg -source \\myserver\packages

or:

nuget init c:\packages \\myserver\packages

I cannot drop the packages on the share because I have no permission. How can I specify the user from the script?

My script is a simple batch file:

@echo off

nuget init .\packages \\myserver\packages

:END
echo "End"
pause
1

There are 1 answers

0
Rafa On BEST ANSWER

I found following solution:

@echo off

net use \\myserver\packages /user:myserver\User password
nuget init .\packages \\myserver\packages

:END
echo "End"
pause