Created
February 6, 2014 02:32
-
-
Save davidalpert/8837476 to your computer and use it in GitHub Desktop.
An MSBuild script to download all packages referenced from a set of .NET solution's packages.config files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<SolutionDir>.</SolutionDir> | |
</PropertyGroup> | |
<!-- This targets file sets a handful of nuget-related properties. --> | |
<Import Project=".nuget/NuGet.targets"/> | |
<!-- This builds an ItemGroup with all the packages.config file in the solution folder. --> | |
<ItemGroup> | |
<PackageConfigFiles Include="$(SolutionDir.Trim('\\'))\**\packages.config"/> | |
</ItemGroup> | |
<!-- The Inputs and Outputs attributes tell MSBuild to batch this target across each | |
item in the input itemgroup. --> | |
<Target Name="InstallAllPackages" Inputs="@(PackageConfigFiles)" | |
Outputs="%(Identity).ignore"> | |
<PropertyGroup> | |
<PackagesConfig>%(PackageConfigFiles.Identity)</PackagesConfig> | |
<!-- The following RestoreCommand node is copied from the included NuGet.targets file. | |
It must be included in a propertygroup here so that it gets properly populated | |
with each packages.config file as MSBuild batches this target across | |
@(PackageConfigFiles). | |
--> | |
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand> | |
</PropertyGroup> | |
<Message Text="Found: $(PackagesConfig)"/> | |
<Message Text="Installing..."/> | |
<Message Text=""/> | |
<Exec Command="$(RestoreCommand)"/> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment