Skip to content

Commit 3ce63c4

Browse files
committed
updated NuGet.
1 parent 9fb84fb commit 3ce63c4

File tree

3 files changed

+103
-32
lines changed

3 files changed

+103
-32
lines changed

.nuget/NuGet.exe

1.04 MB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 98 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,69 @@
33
<PropertyGroup>
44
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
55

6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
629
<!-- Windows specific commands -->
7-
<NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
8-
<PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
9-
<PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
1032

33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
1134
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
12-
<NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath>
13-
<PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig>
14-
<PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir>
15-
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
1649
<!-- NuGet command -->
17-
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
1853
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
19-
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
2055

2156
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
2257

23-
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
24-
<PackageSources>""</PackageSources>
25-
26-
<!-- Enable the restore command to run before builds -->
27-
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
2860

29-
<!-- Property that enables building a package from a project -->
30-
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
3163

3264
<!-- Commands -->
33-
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
34-
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
3567

36-
<!-- Make the build depend on restore packages -->
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
3769
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
3870
RestorePackages;
3971
$(BuildDependsOn);
@@ -48,24 +80,65 @@
4880

4981
<Target Name="CheckPrerequisites">
5082
<!-- Raise an error if we're unable to locate nuget.exe -->
51-
<Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
5290
</Target>
5391

54-
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
5597
<Exec Command="$(RestoreCommand)"
5698
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
57-
99+
58100
<Exec Command="$(RestoreCommand)"
59101
LogStandardErrorAsError="true"
60102
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
61103
</Target>
62104

63105
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
64-
<Exec Command="$(BuildCommand)"
106+
<Exec Command="$(BuildCommand)"
65107
Condition=" '$(OS)' != 'Windows_NT' " />
66-
108+
67109
<Exec Command="$(BuildCommand)"
68110
LogStandardErrorAsError="true"
69111
Condition=" '$(OS)' == 'Windows_NT' " />
70112
</Target>
71-
</Project>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

Pathoschild.FluentHttpClient.sln

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.21005.1
4+
VisualStudioVersion = 12.0.30110.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{B1D02CCF-5DF5-4678-AD54-243DEFB92032}"
77
EndProject
@@ -16,16 +16,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scaffolding", "Scaffolding"
1616
README.md = README.md
1717
EndProjectSection
1818
EndProject
19-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B49EF8E8-15DB-4FCB-9080-4800C92A5BF8}"
19+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Formatters", "Formatters\Formatters.csproj", "{CE9BD284-6128-48F5-BBAA-76B58B2F6A62}"
20+
EndProject
21+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1A832B8D-1B0A-47DB-964A-2168C8AA3CF4}"
2022
ProjectSection(SolutionItems) = preProject
23+
.nuget\NuGet.Config = .nuget\NuGet.Config
2124
.nuget\NuGet.exe = .nuget\NuGet.exe
2225
.nuget\NuGet.targets = .nuget\NuGet.targets
2326
Packages.dgml = Packages.dgml
2427
packages\repositories.config = packages\repositories.config
2528
EndProjectSection
2629
EndProject
27-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Formatters", "Formatters\Formatters.csproj", "{CE9BD284-6128-48F5-BBAA-76B58B2F6A62}"
28-
EndProject
2930
Global
3031
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3132
Debug|Any CPU = Debug|Any CPU
@@ -80,7 +81,4 @@ Global
8081
GlobalSection(SolutionProperties) = preSolution
8182
HideSolutionNode = FALSE
8283
EndGlobalSection
83-
GlobalSection(NestedProjects) = preSolution
84-
{B49EF8E8-15DB-4FCB-9080-4800C92A5BF8} = {E4A79030-4C0D-40D9-9A44-7321A74140FF}
85-
EndGlobalSection
8684
EndGlobal

0 commit comments

Comments
 (0)