Skip to content

Commit

Permalink
Explicitly import NuGet.targets
Browse files Browse the repository at this point in the history
NuGet.targets was added as a hard dependency in dotnet#2595, this change will
explicitly import it in Microsoft.Common.CurrentVersion.targets.
  • Loading branch information
AndyGerlicher committed Oct 24, 2017
1 parent 9644404 commit 6d858d6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cibuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ if /i "%TARGET%"=="CoreCLR" (
:: warning MSB3026: Could not copy "XXX" to "XXX". Beginning retry 1 in 1000ms.
:: warning MSB3073: Exec task failure (when set to be a warning) -- needed to keep from failing on dev desktops that don't have C++ tools
:: warning AL1053: The version '1.2.3.4-foo' specified for the 'product version' is not in the normal 'major.minor.build.revision' format
SET _NOWARN=MSB3277;MSB3026;MSB3073;AL1053
:: warning MSB4011: Imported target already imported. This will happen when Microsoft.NuGet.ImportAfter.targets installed on the local
:: machine still has the import to NuGet.targets which is now in Microsoft.Common.CurrentVersion.targets. This can be
:: removed when we want to require VS15.5+ to build locally.
SET _NOWARN=MSB3277;MSB3026;MSB3073;AL1053;MSB4011
set MSBUILDBINLOGPATH=%~dp0msbuild_rebuild-%HOST%.binlog

echo.
Expand Down
5 changes: 5 additions & 0 deletions src/Build/Evaluation/IntrinsicFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@ public static string GetMSBuildExtensionsPath()
return BuildEnvironmentHelper.Instance.MSBuildExtensionsPath;
}

public static bool IsRunningFromVisualStudio()
{
return BuildEnvironmentHelper.Instance.Mode == BuildEnvironmentMode.VisualStudio;
}

#region Debug only intrinsics

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Tasks/Microsoft.Common.CurrentVersion.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5869,6 +5869,14 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<!-- This import is temporary and will be removed once it is moved into the silverlight targets -->
<Import Project="$(MSBuildToolsPath)\Microsoft.Data.Entity.targets" Condition="'$(TargetFrameworkIdentifier)' == 'Silverlight' and Exists('$(MSBuildToolsPath)\Microsoft.Data.Entity.targets')"/>

<!-- Import NuGet.targets (required for GetReferenceNearestTargetFrameworkTask and used for Restore functionality) -->
<PropertyGroup>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'=='' and '$([MSBuild]::IsRunningFromVisualStudio())'=='true'">$(MSBuildToolsPath32)\..\..\..\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets</NuGetRestoreTargets>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'==''">$(MSBuildToolsPath)\NuGet.targets</NuGetRestoreTargets>
</PropertyGroup>

<Import Project="$(NuGetRestoreTargets)" />

<Import Project="$(CustomAfterMicrosoftCommonTargets)" Condition="'$(CustomAfterMicrosoftCommonTargets)' != '' and Exists('$(CustomAfterMicrosoftCommonTargets)')"/>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter')"/>
Expand Down

0 comments on commit 6d858d6

Please sign in to comment.