Skip to content

Commit

Permalink
Changed NuGet.targets to use a slash instead of a space following the…
Browse files Browse the repository at this point in the history
… SolutionDir

This allows it to work with the latest version of NuGet.
Since some packages that HearThis needs require a more recent version of NuGet, I also added a conditional command to update nuget to the latest version if it already exists.
(See NuGet/Home#7657 for background)
  • Loading branch information
tombogle committed Jan 10, 2019
1 parent 2539004 commit 250c759
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .nuget/NuGet.targets
Expand Up @@ -19,7 +19,6 @@
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->

<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="http://build.palaso.org/guestAuth/app/nuget/v1/FeedService.svc/" />
</ItemGroup>
Expand All @@ -44,7 +43,7 @@
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDirectory "$(SolutionDir) " </RestoreCommand>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDirectory "$(SolutionDir)/" </RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties Configuration=$(Configuration) $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- We need to ensure packages are restored prior to assembly resolve -->
Expand All @@ -71,10 +70,11 @@
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>

<Target Name="_DownloadNuGet" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition="'$(OS)' == 'Windows_NT'" />
<Target Name="_DownloadNuGet" Condition=" '$(DownloadNuGetExe)' == 'true'">
<Exec Command="$(NuGetExePath) update -self" Condition="Exists('$(NuGetExePath)')" />
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition="'$(OS)' == 'Windows_NT' AND !Exists('$(NuGetExePath)')" />
<Exec Command="wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" WorkingDirectory="$(NuGetToolsPath)"
Condition="'$(OS)' != 'Windows_NT'" />
Condition="'$(OS)' != 'Windows_NT' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
Expand Down
2 changes: 0 additions & 2 deletions src/HearThis/HearThis.csproj
Expand Up @@ -17,8 +17,6 @@
</TargetFrameworkProfile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand Down
2 changes: 0 additions & 2 deletions src/HearThisTests/HearThisTests.csproj
Expand Up @@ -18,8 +18,6 @@
</TargetFrameworkProfile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down

2 comments on commit 250c759

@palaso-bob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity HearThis / HearThis pull requests Build ..71.250c759959d3c04d1c9b390a132692446b2485bb outcome was SUCCESS
Summary: Running Build time: 00:01:21

@palaso-bob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity HearThis / HearThis pull requests Build ..72.250c759959d3c04d1c9b390a132692446b2485bb outcome was SUCCESS
Summary: Running Build time: 00:01:12

Please sign in to comment.