Skip to content

Commit

Permalink
Explicitly import NuGet.targets (#2663)
Browse files Browse the repository at this point in the history
* Explicitly import NuGet.targets
NuGet.targets was added as a hard dependency in #2595, this change will
explicitly import it in Microsoft.Common.CurrentVersion.targets.

* Copy NuGet references for tests

* Remove NuGet ImportAfter from bootstrap build
  • Loading branch information
AndyGerlicher authored Oct 25, 2017
1 parent be84c37 commit b42b1be
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 24 deletions.
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
4 changes: 0 additions & 4 deletions targets/BootStrapMSBuild.proj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.versioning\$(NuGetVersion)\lib\netstandard1.0\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuspec.referencegenerator\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\Newtonsoft.Json\9.0.1\lib\netstandard1.0\**\*.*" />
<BootstrapDependencies Include="$(ProjectDir)targets\bootstrapDependencies\Core\**\*.*" />
</ItemGroup>

<RemoveDir
Expand All @@ -141,9 +140,6 @@
<Copy SourceFiles="@(NuGetCommonExtensions)"
DestinationFiles="@(NuGetCommonExtensions -> '$(BootstrapDestination)%(RecursiveDir)%(FileName)%(Extension)')" />

<Copy SourceFiles="@(BootstrapDependencies)"
DestinationFiles="@(BootstrapDependencies -> '$(BootstrapDestination)%(RecursiveDir)%(FileName)%(Extension)')" />

<!-- Microsoft.Portable.CSharp.targets imports this file with a capital T -->
<Copy SourceFiles="$(DeploymentDir)\Microsoft.CSharp.targets"
DestinationFiles="$(BootstrapDestination)\Microsoft.CSharp.Targets" />
Expand Down
46 changes: 45 additions & 1 deletion targets/DeployDependencies.proj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,50 @@
SkipUnchangedFiles="true" />
</Target>

<!--
Copy NuGet targets/tasks to the test deploy folder.
This is required by the Common targets and needed for tests.
-->
<Target Name="CopyNuGetTargets">
<ItemGroup Condition="'$(NetCoreBuild)' != 'true'">
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\runtimes\any\native\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.commands\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.common\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.configuration\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.dependencyresolver.core\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.frameworks\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.librarymodel\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging.core\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.projectmodel\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.protocol\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.versioning\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuspec.referencegenerator\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\Newtonsoft.Json\9.0.1\lib\net45\**\*.*" />
</ItemGroup>
<ItemGroup Condition="'$(NetCoreBuild)' == 'true'">
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\runtimes\any\native\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.commands\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.common\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.configuration\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.dependencyresolver.core\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.frameworks\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.librarymodel\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging.core\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.projectmodel\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.protocol\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.versioning\$(NuGetVersion)\lib\netstandard1.0\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuspec.referencegenerator\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\Newtonsoft.Json\9.0.1\lib\netstandard1.0\**\*.*" />
</ItemGroup>

<Copy SourceFiles="@(NuGetCommonExtensions)"
DestinationFiles="@(NuGetCommonExtensions -> '$(TestDeploymentDir)\%(RecursiveDir)%(FileName)%(Extension)')" />
</Target>

<Target Name="CopyPackageContent">
<ItemGroup>
<!-- We want the list of files *after* restore, which happens
Expand Down Expand Up @@ -188,6 +232,6 @@
</Target>

<Target Name="DeployDependencies"
DependsOnTargets="CopyPackageContent;CopyCompilerTools;DeployRuntime;FixupFilenames" />
DependsOnTargets="CopyPackageContent;CopyCompilerTools;CopyNuGetTargets;DeployRuntime;FixupFilenames" />

</Project>

This file was deleted.

0 comments on commit b42b1be

Please sign in to comment.