-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditions for targets/props imports
Framework conditions for targets/props are added only when a project uses cross targeting. For scenarios with a single framework under $(TargetFramework) buildCrossTargeting will be left out and there will be no framework conditions to block the imports. In addition to this a new property has been added to allow control over package imports: ExcludeRestorePackageImports. This flag is used at restore time to avoid imports from packages changing the inputs to restore, without this it is possible to get different results between the first and second restore. This change also contains support for nooping when writing out targets/props files. Currently the check is a simple string compare on the files since these files are small. Nooping is now a major benefit since all NETCore projects reference the SDK package, without nooping on the targets/props files MSBuild will always end up rebuilding everything for NETCore solutions. Fixes NuGet/Home#3588 Fixes NuGet/Home#3637 Fixes NuGet/Home#3604 Fixes NuGet/Home#3641 Fixes NuGet/Home#3199
- Loading branch information
Showing
15 changed files
with
1,440 additions
and
159 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
45 changes: 45 additions & 0 deletions
45
src/NuGet.Core/NuGet.Commands/RestoreCommand/MSBuildRestoreImportGroup.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace NuGet.Commands | ||
{ | ||
public class MSBuildRestoreImportGroup | ||
{ | ||
/// <summary> | ||
/// Optional position arguement used when ordering groups in the output file. | ||
/// </summary> | ||
public int Position { get; set; } = 1; | ||
|
||
/// <summary> | ||
/// Conditions applied to the item group. These will be AND'd together. | ||
/// </summary> | ||
public List<string> Conditions { get; set; } = new List<string>(); | ||
|
||
/// <summary> | ||
/// Project paths to import. | ||
/// </summary> | ||
public List<string> Imports { get; set; } = new List<string>(); | ||
|
||
/// <summary> | ||
/// Combined conditions | ||
/// </summary> | ||
public string Condition | ||
{ | ||
get | ||
{ | ||
if (Conditions.Count > 0) | ||
{ | ||
return " " + string.Join(" AND ", Conditions.Select(s => s.Trim())) + " "; | ||
} | ||
else | ||
{ | ||
return string.Empty; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.