How to configure where the command line tool NuGet.exe looks for packages

We successfully created a pair of local package repositories using the NuGet.Server package and placed them on the local IIS web server. We can connect from the package manager and not install any problems. Thus, they work fine.

So that we do not need to check our folder folder, we include the following command line in every project file that includes NuGet links. This works if NuGet.exe is in the path of the CI build agent.

However, I would like to move the original configuration from the command line to each project file and place it in only one place, preferably when other nasty developers cannot change it;)

<Target Name="BeforeBuild">
    <Exec Command="nuget install $(ProjectDir)packages.config -s 
       http://domain:80/DataServices/Packages.svc/;
        http://domain:81/DataServices/Packages.svc/ 
       -o $(SolutionDir)packages" />
</Target>

Is there a better way?

+5
2

- NuGetPowerTools digitaltrust http://blog.davidebbo.com

NuGetPowerTools , , . , .nuget, . NuGet.exe . , , - , .

.

  • NuGet.exe , dev, . C:\tools\nuget\
  • Path
  • % APPDATA%\NuGet\NuGet.Config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <packageSources>
        <add key="LocalRepositoryName" value="http://Domain/DataServices/Packages.svc/" /> 
    </packageSources> 
    

    packageSources, NuGet , .

  • .

    <Target Name="BeforeBuild">
        <Exec Command="nuget install $(ProjectDir)packages.config 
        -o $(SolutionDir)packages" />
    </Target>
    

, , , , csproj. , , .

+5

, ;-) NuGetPowerTools. Install-Package NuGetPowerTools .nuget $(SolutionDir), nuget.exe, nuget msbuild ( ).

Enable-PackageRestore msbuild , , - . ( .nuget, !).

, nuget nuget msbuild ( .nuget), , .

Cheers, Xavier

+13

All Articles