Spaces:
Running
Running
File size: 72,270 Bytes
090629c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 |
<!--
***********************************************************************************************
NuGet.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
This target file contains the NuGet Restore target for walking the project and reference graph
and restoring dependencies from the graph.
Ways to use this targets file:
1. Invoke it directly and provide project file paths using $(RestoreGraphProjectInput).
2. With a solution this may be used as a target in the metaproj.
3. Import the targets file from a project.
Restore flow summary:
1. Top level projects (entry points) are determined.
2. Each project and all of its project references are walked recursively.
3. The project is evaluated for each $(TargetFramework). Items are created
for project properties and dependencies. Each item is marked
with the project it came from so that it can be matched up later.
4. All restore items generated by the walk are grouped together by
project and convert into a project spec.
The result file contains:
1. A list of projects to restore.
2. The complete closure of all projects referenced (Includes project references that are not being restored directly).
3. Package and project dependencies for each project.
4. DotnetCliTool references
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Mark that this target file has been loaded. -->
<IsRestoreTargetsFileLoaded>true</IsRestoreTargetsFileLoaded>
<!-- Load NuGet.Build.Tasks.dll, this can be overridden to use a different version with $(RestoreTaskAssemblyFile) -->
<RestoreTaskAssemblyFile Condition=" '$(RestoreTaskAssemblyFile)' == '' ">NuGet.Build.Tasks.dll</RestoreTaskAssemblyFile>
<!-- Do not hide errors and warnings by default -->
<HideWarningsAndErrors Condition=" '$(HideWarningsAndErrors)' == '' ">false</HideWarningsAndErrors>
<!-- Recurse by default -->
<RestoreRecursive Condition=" '$(RestoreRecursive)' == '' ">true</RestoreRecursive>
<RestoreUseSkipNonexistentTargets Condition=" '$(RestoreUseSkipNonexistentTargets)' == '' ">true</RestoreUseSkipNonexistentTargets>
<!-- RuntimeIdentifier compatibility check -->
<ValidateRuntimeIdentifierCompatibility Condition=" '$(ValidateRuntimeIdentifierCompatibility)' == '' ">false</ValidateRuntimeIdentifierCompatibility>
<!-- Error handling while walking projects -->
<RestoreContinueOnError Condition=" '$(RestoreContinueOnError)' == '' ">WarnAndContinue</RestoreContinueOnError>
<!-- Build in parallel -->
<RestoreBuildInParallel Condition=" '$(BuildInParallel)' != '' ">$(BuildInParallel)</RestoreBuildInParallel>
<RestoreBuildInParallel Condition=" '$(RestoreBuildInParallel)' == '' ">true</RestoreBuildInParallel>
<!-- Check if the restore target was executed on a sln file -->
<_RestoreSolutionFileUsed Condition=" '$(_RestoreSolutionFileUsed)' == '' AND '$(SolutionDir)' != '' AND $(MSBuildProjectFullPath.EndsWith('.metaproj')) == 'true' ">true</_RestoreSolutionFileUsed>
<!-- We default to MSBuildInteractive. -->
<NuGetInteractive Condition=" '$(NuGetInteractive)' == '' ">$(MSBuildInteractive)</NuGetInteractive>
<!-- Mark that this targets file supports package download. -->
<PackageDownloadSupported>true</PackageDownloadSupported>
<!-- Mark that this targets file GetReferenceNearestTargetFrameworkTask task supports the TargetPlatformMoniker -->
<GetReferenceNearestTargetFrameworkTaskSupportsTargetPlatformParameter>true</GetReferenceNearestTargetFrameworkTaskSupportsTargetPlatformParameter>
<!-- Flag if the Central package file is enabled -->
<_CentralPackageVersionsEnabled Condition="'$(ManagePackageVersionsCentrally)' == 'true' AND '$(CentralPackageVersionsFileImported)' == 'true'">true</_CentralPackageVersionsEnabled>
</PropertyGroup>
<!--
Visual Studio's project property page requires defaults to be set to inform customers what the default values are.
Project-system uses DefaultValueSourceLocation.AfterContext to detect when a customer's project changes the value, so these defaults must be set here in the targets file.
-->
<PropertyGroup>
<!-- Enable NuGetAudit by default -->
<NuGetAudit Condition=" '$(NuGetAudit)' == '' ">true</NuGetAudit>
<!-- Report on low severity vulnerabilities, and higher. Allowed values are: low, moderate, high, critical -->
<NuGetAuditLevel Condition=" '$(NuGetAuditLevel)' == '' ">low</NuGetAuditLevel>
<!-- Report known vulnerabilities on direct dependencies only. Allowed values are: direct, all -->
<NuGetAuditMode Condition="'$(NuGetAuditMode)' == ''
AND '$(NuGetExeSkipSdkAnalysisLevelCheck)' != 'true'
AND $([MSBuild]::VersionGreaterThanOrEquals($([MSBuild]::ValueOrDefault('$(SdkAnalysisLevel)', '0.0')), '9.0.100'))"
>all</NuGetAuditMode>
<NuGetAuditMode Condition=" '$(NuGetAuditMode)' == '' ">direct</NuGetAuditMode>
</PropertyGroup>
<PropertyGroup>
<!-- Exclude packages from changing restore inputs. -->
<_GenerateRestoreGraphProjectEntryInputProperties>ExcludeRestorePackageImports=true</_GenerateRestoreGraphProjectEntryInputProperties>
<!-- Standalone mode
This is used by NuGet.exe to inject targets into the project that will be
walked next. In normal /t:Restore mode this causes a duplicate import
since NuGet.targets it loaded as part of MSBuild, there is should be
skipped. -->
<_GenerateRestoreGraphProjectEntryInputProperties Condition=" '$(RestoreUseCustomAfterTargets)' == 'true' ">
$(_GenerateRestoreGraphProjectEntryInputProperties);
NuGetRestoreTargets=$(MSBuildThisFileFullPath);
RestoreUseCustomAfterTargets=$(RestoreUseCustomAfterTargets);
CustomAfterMicrosoftCommonCrossTargetingTargets=$(MSBuildThisFileFullPath);
CustomAfterMicrosoftCommonTargets=$(MSBuildThisFileFullPath);
</_GenerateRestoreGraphProjectEntryInputProperties>
<!-- Include SolutionDir and SolutionName for solution restores and persist these properties during the walk. -->
<_GenerateRestoreGraphProjectEntryInputProperties Condition=" '$(_RestoreSolutionFileUsed)' == 'true' ">
$(_GenerateRestoreGraphProjectEntryInputProperties);
_RestoreSolutionFileUsed=true;
SolutionDir=$(SolutionDir);
SolutionName=$(SolutionName);
SolutionFileName=$(SolutionFileName);
SolutionPath=$(SolutionPath);
SolutionExt=$(SolutionExt);
</_GenerateRestoreGraphProjectEntryInputProperties>
</PropertyGroup>
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true' And '$(RestoreEnableGlobalPackageReference)' != 'false'">
<!--
Add GlobalPackageReference items to the PackageReference item group with no version.
Global package references only include the same assets as a development dependency (runtime; build; native; contentfiles; analyzers)
because those kind of packages are the best candidate for a global package reference. They are generally packages that
extend the build.
Global package references have all assets private because central package references are generally packages that provide
versioning, signing, etc and should not flow to downstream dependencies. Also, central package references are already
referenced by every project in the tree so they don't need to be transitive.
-->
<PackageReference Include="@(GlobalPackageReference)"
Version=""
IncludeAssets="Runtime;Build;Native;contentFiles;Analyzers"
PrivateAssets="All" />
<!--
Add GlobalPackageReference items to the PackageVersion item group with the version.
-->
<PackageVersion Include="@(GlobalPackageReference)"
Version="%(Version)" />
</ItemGroup>
<!-- Tasks -->
<UsingTask TaskName="NuGet.Build.Tasks.RestoreTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.WriteRestoreGraphTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreProjectJsonPathTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreProjectReferencesTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestorePackageReferencesTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetCentralPackageVersionsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestorePackageDownloadsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreFrameworkReferencesTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreNuGetAuditSuppressionsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreDotnetCliToolsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetProjectTargetFrameworksTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreSolutionProjectsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreSettingsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.WarnForInvalidProjectsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetRestoreProjectStyleTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.NuGetMessageTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.CheckForDuplicateNuGetItemsTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<UsingTask TaskName="NuGet.Build.Tasks.GetGlobalPropertyValueTask" AssemblyFile="$(RestoreTaskAssemblyFile)" />
<!--
============================================================
Restore
Main entry point for restoring packages
============================================================
-->
<Target Name="Restore" DependsOnTargets="_GenerateRestoreGraph">
<!-- Drop any duplicate items -->
<RemoveDuplicates
Inputs="@(_RestoreGraphEntry)">
<Output
TaskParameter="Filtered"
ItemName="_RestoreGraphEntryFiltered" />
</RemoveDuplicates>
<!-- Call restore -->
<RestoreTask
RestoreGraphItems="@(_RestoreGraphEntryFiltered)"
RestoreDisableParallel="$(RestoreDisableParallel)"
RestoreNoCache="$(RestoreNoCache)"
RestoreNoHttpCache="$(RestoreNoHttpCache)"
RestoreIgnoreFailedSources="$(RestoreIgnoreFailedSources)"
RestoreRecursive="$(RestoreRecursive)"
RestoreForce="$(RestoreForce)"
HideWarningsAndErrors="$(HideWarningsAndErrors)"
Interactive="$(NuGetInteractive)"
RestoreForceEvaluate="$(RestoreForceEvaluate)"
RestorePackagesConfig="$(RestorePackagesConfig)"
EmbedFilesInBinlog="$(RestoreEmbedFilesInBinlog)">
<Output TaskParameter="EmbedInBinlog" ItemName="EmbedInBinlog" />
</RestoreTask>
</Target>
<!--
============================================================
GenerateRestoreGraphFile
Writes the output of _GenerateRestoreGraph to disk
============================================================
-->
<Target Name="GenerateRestoreGraphFile" DependsOnTargets="_GenerateRestoreGraph">
<!-- Validate -->
<Error Condition="$(RestoreGraphOutputPath) == ''" Text="Missing RestoreGraphOutputPath property!" />
<!-- Drop any duplicate items -->
<RemoveDuplicates
Inputs="@(_RestoreGraphEntry)">
<Output
TaskParameter="Filtered"
ItemName="_RestoreGraphEntryFiltered" />
</RemoveDuplicates>
<!-- Write file -->
<WriteRestoreGraphTask
RestoreGraphItems="@(_RestoreGraphEntryFiltered)"
RestoreGraphOutputPath="$(RestoreGraphOutputPath)"
RestoreRecursive="$(RestoreRecursive)" />
</Target>
<!--
============================================================
CollectPackageReferences
Gathers all PackageReference items from the project.
This target may be used as an extension point to modify
package references before NuGet reads them.
============================================================
-->
<Target Name="CollectPackageReferences" Returns="@(PackageReference)" >
<!-- NOTE for design-time builds we need to ensure that we continue on error. -->
<PropertyGroup>
<CollectPackageReferencesContinueOnError>$(ContinueOnError)</CollectPackageReferencesContinueOnError>
<CollectPackageReferencesContinueOnError Condition="'$(ContinueOnError)' == '' ">false</CollectPackageReferencesContinueOnError>
</PropertyGroup>
<CheckForDuplicateNuGetItemsTask
Condition="'$(DisableCheckingDuplicateNuGetItems)' != 'true' "
Items="@(PackageReference)"
ItemName="PackageReference"
LogCode="NU1504"
MSBuildProjectFullPath="$(MSBuildProjectFullPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
NoWarn="$(NoWarn)"
ContinueOnError="$(CollectPackageReferencesContinueOnError)"
>
<Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedPackageReferences" />
</CheckForDuplicateNuGetItemsTask>
<ItemGroup Condition="'@(DeduplicatedPackageReferences)' != ''">
<PackageReference Remove="@(PackageReference)" />
<PackageReference Include="@(DeduplicatedPackageReferences)" />
</ItemGroup>
</Target>
<!--
============================================================
CollectCentralPackageVersions
Gathers all PackageVersion items from the central package versions file.
============================================================
-->
<Target Name="CollectCentralPackageVersions" Returns="@(PackageVersion)">
<!-- NOTE for design-time builds we need to ensure that we continue on error. -->
<PropertyGroup>
<CollectCentralPackageVersionsContinueOnError>$(ContinueOnError)</CollectCentralPackageVersionsContinueOnError>
<CollectCentralPackageVersionsContinueOnError Condition="'$(ContinueOnError)' == '' ">false</CollectCentralPackageVersionsContinueOnError>
</PropertyGroup>
<CheckForDuplicateNuGetItemsTask
Condition="'$(DisableCheckingDuplicateNuGetItems)' != 'true' "
Items="@(PackageVersion)"
ItemName="PackageVersion"
LogCode="NU1506"
MSBuildProjectFullPath="$(MSBuildProjectFullPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
NoWarn="$(NoWarn)"
ContinueOnError="$(CollectCentralPackageVersionsContinueOnError)"
>
<Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedPackageVersions" />
</CheckForDuplicateNuGetItemsTask>
<ItemGroup Condition="'@(DeduplicatedPackageVersions)' != ''">
<PackageVersion Remove="@(PackageVersion)" />
<PackageVersion Include="@(DeduplicatedPackageVersions)" />
</ItemGroup>
</Target>
<!--
============================================================
CollectPackageDownloads
Gathers all PackageDownload items from the project.
This target may be used as an extension point to modify
package downloads before NuGet reads them.
============================================================
-->
<Target Name="CollectPackageDownloads" Returns="@(PackageDownload)">
<!-- NOTE for design-time builds we need to ensure that we continue on error. -->
<PropertyGroup>
<CollectPackageDownloadsContinueOnError>$(ContinueOnError)</CollectPackageDownloadsContinueOnError>
<CollectPackageDownloadsContinueOnError Condition="'$(ContinueOnError)' == '' ">false</CollectPackageDownloadsContinueOnError>
</PropertyGroup>
<CheckForDuplicateNuGetItemsTask
Condition="'$(DisableCheckingDuplicateNuGetItems)' != 'true' "
Items="@(PackageDownload)"
ItemName="PackageDownload"
LogCode="NU1505"
MSBuildProjectFullPath="$(MSBuildProjectFullPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
NoWarn="$(NoWarn)"
ContinueOnError="$(CollectPackageDownloadsContinueOnError)"
>
<Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedPackageDownloads" />
</CheckForDuplicateNuGetItemsTask>
<ItemGroup Condition="'@(DeduplicatedPackageDownloads)' != ''">
<PackageDownload Remove="@(PackageDownload)" />
<PackageDownload Include="@(DeduplicatedPackageDownloads)" />
</ItemGroup>
</Target>
<!--
============================================================
CollectFrameworkReferences
============================================================
-->
<Target Name="CollectFrameworkReferences" Returns="@(_FrameworkReferenceForRestore)">
<ItemGroup>
<_FrameworkReferenceForRestore
Include="@(FrameworkReference)"
Condition="'%(FrameworkReference.IsTransitiveFrameworkReference)' != 'true'"/>
</ItemGroup>
</Target>
<!--
============================================================
CollectNuGetAuditSuppressions
Gathers all NuGetAuditSuppress items from the project.
This target may be used as an extension point to modify
advisory suppressions before NuGet reads them.
============================================================
-->
<Target Name="CollectNuGetAuditSuppressions" Returns="@(NuGetAuditSuppress)">
<!-- NOTE for design-time builds we need to ensure that we continue on error. -->
<PropertyGroup>
<CollectNuGetAuditSuppressionsContinueOnError>$(ContinueOnError)</CollectNuGetAuditSuppressionsContinueOnError>
<CollectNuGetAuditSuppressionsContinueOnError Condition="'$(ContinueOnError)' == '' ">false</CollectNuGetAuditSuppressionsContinueOnError>
</PropertyGroup>
<CheckForDuplicateNuGetItemsTask
Items="@(NuGetAuditSuppress)"
ItemName="NuGetAuditSuppress"
LogCode="NU1505"
MSBuildProjectFullPath="$(MSBuildProjectFullPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
NoWarn="$(NoWarn)"
ContinueOnError="$(CollectNuGetAuditSuppressionsContinueOnError)"
>
<Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedNuGetAuditSuppressions" />
</CheckForDuplicateNuGetItemsTask>
<ItemGroup Condition="'@(DeduplicatedNuGetAuditSuppressions)' != ''">
<NuGetAuditSuppress Remove="@(NuGetAuditSuppress)" />
<NuGetAuditSuppress Include="@(DeduplicatedNuGetAuditSuppressions)" />
</ItemGroup>
</Target>
<!--
============================================================
_CollectRestoreInputs
Runs all the 'Collect' targets
============================================================
-->
<Target Name="_CollectRestoreInputs"
DependsOnTargets="CollectPackageReferences;CollectPackageDownloads;CollectFrameworkReferences;CollectCentralPackageVersions;CollectNuGetAuditSuppressions">
</Target>
<!--
============================================================
_LoadRestoreGraphEntryPoints
Find project entry points and load them into items.
============================================================
-->
<Target Name="_LoadRestoreGraphEntryPoints" Returns="@(RestoreGraphProjectInputItems)">
<!-- Allow overriding items with RestoreGraphProjectInput -->
<ItemGroup Condition=" @(RestoreGraphProjectInputItems) == '' ">
<RestoreGraphProjectInputItems Include="$(RestoreGraphProjectInput)" />
</ItemGroup>
<!-- Project case -->
<ItemGroup Condition=" $(MSBuildProjectFullPath.EndsWith('.metaproj')) != 'true' AND @(RestoreGraphProjectInputItems) == '' ">
<RestoreGraphProjectInputItems Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
<!-- Solution case -->
<GetRestoreSolutionProjectsTask
Condition=" $(MSBuildProjectFullPath.EndsWith('.metaproj')) == 'true' AND @(RestoreGraphProjectInputItems) == '' "
ProjectReferences="@(ProjectReference)"
SolutionFilePath="$(MSBuildProjectFullPath)">
<Output
TaskParameter="OutputProjectReferences"
ItemName="RestoreGraphProjectInputItems" />
</GetRestoreSolutionProjectsTask>
</Target>
<!--
============================================================
_FilterRestoreGraphProjectInputItems
Filter out unsupported project entry points.
============================================================
-->
<Target Name="_FilterRestoreGraphProjectInputItems" DependsOnTargets="_LoadRestoreGraphEntryPoints"
Returns="@(FilteredRestoreGraphProjectInputItems)">
<PropertyGroup>
<RestoreProjectFilterMode Condition=" '$(RestoreProjectFilterMode)' == '' ">exclusionlist</RestoreProjectFilterMode>
</PropertyGroup>
<!-- Filter to a list of known supported types -->
<ItemGroup Condition=" '$(RestoreProjectFilterMode)' == 'inclusionlist' ">
<_FilteredRestoreGraphProjectInputItemsTmp
Include="@(RestoreGraphProjectInputItems)"
Condition=" '%(RestoreGraphProjectInputItems.Extension)' == '.csproj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.vbproj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.fsproj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.nuproj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.proj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.msbuildproj' Or
'%(RestoreGraphProjectInputItems.Extension)' == '.vcxproj' " />
</ItemGroup>
<!-- Filter out disallowed types -->
<ItemGroup Condition=" '$(RestoreProjectFilterMode)' == 'exclusionlist' ">
<_FilteredRestoreGraphProjectInputItemsTmp
Include="@(RestoreGraphProjectInputItems)"
Condition=" '%(RestoreGraphProjectInputItems.Extension)' != '.metaproj'
AND '%(RestoreGraphProjectInputItems.Extension)' != '.shproj'
AND '%(RestoreGraphProjectInputItems.Extension)' != '.vcxitems'
AND '%(RestoreGraphProjectInputItems.Extension)' != '.vdproj'
AND '%(RestoreGraphProjectInputItems.Extension)' != '' " />
</ItemGroup>
<!-- No filtering -->
<ItemGroup Condition=" '$(RestoreProjectFilterMode)' != 'exclusionlist' AND '$(RestoreProjectFilterMode)' != 'inclusionlist' ">
<_FilteredRestoreGraphProjectInputItemsTmp
Include="@(RestoreGraphProjectInputItems)" />
</ItemGroup>
<!-- Remove duplicates -->
<RemoveDuplicates
Inputs="@(_FilteredRestoreGraphProjectInputItemsTmp)">
<Output
TaskParameter="Filtered"
ItemName="FilteredRestoreGraphProjectInputItemsWithoutDuplicates" />
</RemoveDuplicates>
<!-- Remove projects that do not support restore. -->
<!-- With SkipNonexistentTargets support -->
<MSBuild Condition=" '$(RestoreUseSkipNonexistentTargets)' == 'true' "
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(FilteredRestoreGraphProjectInputItemsWithoutDuplicates)"
Targets="_IsProjectRestoreSupported"
SkipNonexistentTargets="true"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="FilteredRestoreGraphProjectInputItems" />
</MSBuild>
<!-- Without SkipNonexistentTargets support -->
<MSBuild Condition=" '$(RestoreUseSkipNonexistentTargets)' != 'true' "
Projects="@(FilteredRestoreGraphProjectInputItemsWithoutDuplicates)"
Targets="_IsProjectRestoreSupported"
ContinueOnError="$(RestoreContinueOnError)"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="FilteredRestoreGraphProjectInputItems" />
</MSBuild>
<!-- Warn for projects that do not support restore. -->
<WarnForInvalidProjectsTask
Condition=" '$(DisableWarnForInvalidRestoreProjects)' != 'true' AND '$(HideWarningsAndErrors)' != 'true' "
AllProjects="@(FilteredRestoreGraphProjectInputItemsWithoutDuplicates)"
ValidProjects="@(FilteredRestoreGraphProjectInputItems)" />
</Target>
<!--
============================================================
_GenerateRestoreGraph
Entry point for creating the project to project restore graph.
============================================================
-->
<Target Name="_GenerateRestoreGraph"
DependsOnTargets="_FilterRestoreGraphProjectInputItems;_GetAllRestoreProjectPathItems"
Returns="@(_RestoreGraphEntry)">
<Message Text="Generating dg file" Importance="low" />
<Message Text="%(_RestoreProjectPathItems.Identity)" Importance="low" />
<!-- Use all projects if RestoreRecursive is true. Otherwise use only the top level projects. -->
<ItemGroup>
<_GenerateRestoreGraphProjectEntryInput Include="@(FilteredRestoreGraphProjectInputItems)" Condition=" '$(RestoreRecursive)' != 'true' " />
<_GenerateRestoreGraphProjectEntryInput Include="@(_RestoreProjectPathItems)" Condition=" '$(RestoreRecursive)' == 'true' " />
</ItemGroup>
<!-- Add top level entries to the direct restore list. These projects will also restore tools. -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(_GenerateRestoreGraphProjectEntryInput)"
Targets="_GenerateRestoreGraphProjectEntry"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreGraphEntry" />
</MSBuild>
<!-- Generate a spec for every project including dependencies. -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(_RestoreProjectPathItems)"
Targets="_GenerateProjectRestoreGraph"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreGraphEntry" />
</MSBuild>
</Target>
<!--
============================================================
_GenerateRestoreGraphProjectEntry
Top level entry point within a project.
============================================================
-->
<Target Name="_GenerateRestoreGraphProjectEntry"
DependsOnTargets="_GenerateRestoreSpecs;_GenerateDotnetCliToolReferenceSpecs"
Returns="@(_RestoreGraphEntry)">
<!-- Returns restore graph entries for the project and all dependencies -->
</Target>
<!--
============================================================
_GenerateRestoreSpecs
Mark entry points for restore.
============================================================
-->
<Target Name="_GenerateRestoreSpecs"
DependsOnTargets="_GetRestoreProjectStyle"
Returns="@(_RestoreGraphEntry)">
<Message Text="Restore entry point $(MSBuildProjectFullPath)" Importance="low" />
<!-- Mark entry point -->
<ItemGroup Condition=" '$(RestoreProjects)' == '' OR '$(RestoreProjects)' == 'true' ">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())" Condition=" '$(RestoreProjectStyle)' != 'Unknown' ">
<Type>RestoreSpec</Type>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
</_RestoreGraphEntry>
</ItemGroup>
</Target>
<!--
============================================================
_GenerateDotnetCliToolReferenceSpecs
Collect DotnetCliToolReferences
============================================================
-->
<Target Name="_GenerateDotnetCliToolReferenceSpecs"
DependsOnTargets="_GetRestoreSettings"
Returns="@(_RestoreGraphEntry)">
<PropertyGroup>
<DotnetCliToolTargetFramework Condition=" '$(DotnetCliToolTargetFramework)' == '' ">netcoreapp1.0</DotnetCliToolTargetFramework>
</PropertyGroup>
<!-- Write out tool references -->
<GetRestoreDotnetCliToolsTask
Condition=" '$(RestoreDotnetCliToolReferences)' == '' OR '$(RestoreDotnetCliToolReferences)' == 'true' "
ProjectPath="$(MSBuildProjectFullPath)"
ToolFramework="$(DotnetCliToolTargetFramework)"
RestorePackagesPath="$(_OutputPackagesPath)"
RestoreFallbackFolders="$(_OutputFallbackFolders)"
RestoreSources="$(_OutputSources)"
RestoreConfigFilePaths="$(_OutputConfigFilePaths)"
DotnetCliToolReferences="@(DotnetCliToolReference)">
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestoreDotnetCliToolsTask>
</Target>
<!--
============================================================
_GetProjectJsonPath
Discover the project.json path if one exists for the project.
============================================================
-->
<Target Name="_GetProjectJsonPath"
Returns="$(_CurrentProjectJsonPath)">
<!-- Get project.json path -->
<!-- Skip this if the project style is already set. -->
<GetRestoreProjectJsonPathTask
ProjectPath="$(MSBuildProjectFullPath)"
Condition=" '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(RestoreProjectStyle)' == '' ">
<Output TaskParameter="ProjectJsonPath" PropertyName="_CurrentProjectJsonPath" />
</GetRestoreProjectJsonPathTask>
</Target>
<!--
============================================================
_GetRestoreProjectStyle
Determine the project restore type.
============================================================
-->
<Target Name="_GetRestoreProjectStyle"
DependsOnTargets="_GetProjectJsonPath;CollectPackageReferences"
Returns="$(RestoreProjectStyle);$(PackageReferenceCompatibleProjectStyle)">
<!--
Older versions of MSBuild do not support the Count() item function which is an optimization. Expanding the
entire item list into a semicolon delimited string is slower but older versions of MSBuild don't support it so
use the older logic if necessary
-->
<PropertyGroup Condition="'$(MSBuildAssemblyVersion)' < '15.0'">
<_HasPackageReferenceItems Condition="'@(PackageReference)' != ''">true</_HasPackageReferenceItems>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildAssemblyVersion)' >= '15.0'">
<_HasPackageReferenceItems Condition="@(PackageReference->Count()) > 0">true</_HasPackageReferenceItems>
</PropertyGroup>
<GetRestoreProjectStyleTask
HasPackageReferenceItems="$(_HasPackageReferenceItems)"
MSBuildProjectDirectory="$(MSBuildProjectDirectory)"
MSBuildProjectName="$(MSBuildProjectName)"
ProjectJsonPath="$(_CurrentProjectJsonPath)"
RestoreProjectStyle="$(RestoreProjectStyle)">
<Output TaskParameter="ProjectStyle" PropertyName="RestoreProjectStyle" />
<Output TaskParameter="IsPackageReferenceCompatibleProjectStyle" PropertyName="PackageReferenceCompatibleProjectStyle" />
</GetRestoreProjectStyleTask>
<PropertyGroup>
<_HasPackageReferenceItems />
</PropertyGroup>
</Target>
<!--
============================================================
EnableIntermediateOutputPathMismatchWarning
If using PackageReference, enable an MSBuild warning if BaseIntermediateOutputPath is set to something different
than MSBuildProjectExtensionsPath, because it may be unexpected that the assets and related files wouldn't be written
to the BaseIntermediateOutputPath.
============================================================
-->
<Target Name="EnableIntermediateOutputPathMismatchWarning" DependsOnTargets="_GetRestoreProjectStyle"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform"
Condition="'$(RestoreProjectStyle)' == 'PackageReference'">
<PropertyGroup Condition="'$(EnableBaseIntermediateOutputPathMismatchWarning)' == ''">
<EnableBaseIntermediateOutputPathMismatchWarning>true</EnableBaseIntermediateOutputPathMismatchWarning>
</PropertyGroup>
</Target>
<!--
============================================================
_GetRestoreTargetFrameworksOutput
Read target frameworks from the project.
Non-NETCore project frameworks will be returned.
============================================================
-->
<Target Name="_GetRestoreTargetFrameworksOutput"
DependsOnTargets="_GetRestoreProjectStyle;_GetRestoreTargetFrameworkOverride"
Returns="@(_RestoreTargetFrameworksOutputFiltered)">
<PropertyGroup>
<_RestoreProjectFramework/>
<_TargetFrameworkToBeUsed Condition=" '$(_TargetFrameworkOverride)' == '' ">$(TargetFrameworks)</_TargetFrameworkToBeUsed>
</PropertyGroup>
<!-- For project.json projects target frameworks will be read from project.json. -->
<GetProjectTargetFrameworksTask
Condition=" '$(RestoreProjectStyle)' != 'ProjectJson'"
ProjectPath="$(MSBuildProjectFullPath)"
TargetFrameworks="$(_TargetFrameworkToBeUsed)"
TargetFramework="$(TargetFramework)"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
TargetPlatformIdentifier="$(TargetPlatformIdentifier)"
TargetPlatformVersion="$(TargetPlatformVersion)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)">
<Output
TaskParameter="ProjectTargetFrameworks"
PropertyName="_RestoreProjectFramework" />
</GetProjectTargetFrameworksTask>
<ItemGroup Condition=" '$(_RestoreProjectFramework)' != '' ">
<_RestoreTargetFrameworksOutputFiltered Include="$(_RestoreProjectFramework.Split(';'))" />
</ItemGroup>
</Target>
<!--
============================================================
_GetRestoreTargetFrameworksAsItems
Read $(TargetFrameworks) from the project as items.
Projects that do not have $(TargetFrameworks) will noop.
If $(TargetFramework) is specified globally, it'll be preferred over $(TargetFrameworks)
============================================================
-->
<Target Name="_GetRestoreTargetFrameworksAsItems"
DependsOnTargets="_GetRestoreProjectStyle;_GetRestoreTargetFrameworkOverride"
Returns="@(_RestoreTargetFrameworkItems)">
<ItemGroup Condition=" '$(TargetFrameworks)' != '' AND '$(_TargetFrameworkOverride)' == '' ">
<_RestoreTargetFrameworkItems Include="$(TargetFrameworks.Split(';'))" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworks)' != '' AND '$(_TargetFrameworkOverride)' != '' ">
<_RestoreTargetFrameworkItems Include="$(_TargetFrameworkOverride)" />
</ItemGroup>
</Target>
<!--
============================================================
_GetRestoreSettings
============================================================
-->
<Target Name="_GetRestoreSettings"
Condition=" '$(RestoreProjectStyle)' == 'PackageReference' OR '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(RestoreProjectStyle)' == 'DotnetToolReference' OR '$(RestoreProjectStyle)' == 'PackagesConfig'"
DependsOnTargets="_GetRestoreSettingsOverrides;_GetRestoreSettingsCurrentProject;_GetRestoreSettingsAllFrameworks"
Returns="$(_OutputSources);$(_OutputPackagesPath);$(_OutputRepositoryPath);$(_OutputFallbackFolders);$(_OutputConfigFilePaths)">
<PropertyGroup Condition=" '$(RestoreSolutionDirectory)' == '' AND '$(RestoreProjectStyle)' == 'PackagesConfig' AND '$(SolutionDir)' != '*Undefined*'">
<RestoreSolutionDirectory>$(SolutionDir)</RestoreSolutionDirectory>
</PropertyGroup>
<!-- For transitive project styles, we rely on evaluating all the settings and including them in the dg spec to faciliate no-op restore-->
<GetRestoreSettingsTask
ProjectUniqueName="$(MSBuildProjectFullPath)"
RestoreSources="$(RestoreSources)"
RestorePackagesPath="$(RestorePackagesPath)"
RestoreRepositoryPath="$(RestoreRepositoryPath)"
RestoreFallbackFolders="$(RestoreFallbackFolders)"
RestoreConfigFile="$(RestoreConfigFile)"
RestoreRootConfigDirectory="$(RestoreRootConfigDirectory)"
RestoreSolutionDirectory="$(RestoreSolutionDirectory)"
RestoreSettingsPerFramework="@(_RestoreSettingsPerFramework)"
RestorePackagesPathOverride="$(_RestorePackagesPathOverride)"
RestoreRepositoryPathOverride="$(_RestoreRepositoryPathOverride)"
RestoreSourcesOverride="$(_RestoreSourcesOverride)"
RestoreFallbackFoldersOverride="$(_RestoreFallbackFoldersOverride)"
RestoreProjectStyle="$(RestoreProjectStyle)"
MSBuildStartupDirectory="$(MSBuildStartupDirectory)">
<Output
TaskParameter="OutputSources"
PropertyName="_OutputSources" />
<Output
TaskParameter="OutputPackagesPath"
PropertyName="_OutputPackagesPath" />
<Output
TaskParameter="OutputRepositoryPath"
PropertyName="_OutputRepositoryPath" />
<Output
TaskParameter="OutputFallbackFolders"
PropertyName="_OutputFallbackFolders" />
<Output
TaskParameter="OutputConfigFilePaths"
PropertyName="_OutputConfigFilePaths" />
</GetRestoreSettingsTask>
</Target>
<!--
============================================================
_GetRestoreSettingsCurrentProject
Generate items for a single framework.
============================================================
-->
<Target Name="_GetRestoreSettingsCurrentProject"
Condition=" '$(TargetFrameworks)' == '' AND '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
DependsOnTargets="_GetRestoreSettingsPerFramework"
Returns="@(_RestoreSettingsPerFramework)">
</Target>
<!--
============================================================
_GetRestoreSettingsAllFrameworks
Generate items for all frameworks.
============================================================
-->
<Target Name="_GetRestoreSettingsAllFrameworks"
Condition=" '$(TargetFrameworks)' != '' AND '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
DependsOnTargets="_GetRestoreTargetFrameworksAsItems;_GetRestoreProjectStyle"
Returns="@(_RestoreSettingsPerFramework)">
<!-- Read additional sources and fallback folders for each framework -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Projects="$(MSBuildProjectFullPath)"
Targets="_GetRestoreSettingsPerFramework"
Properties="TargetFramework=%(_RestoreTargetFrameworkItems.Identity);
$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreSettingsPerFramework" />
</MSBuild>
</Target>
<!--
============================================================
_GetRestoreSettingsPerFramework
Generate items with framework specific settings.
============================================================
-->
<Target Name="_GetRestoreSettingsPerFramework"
Returns="@(_RestoreSettingsPerFramework)">
<ItemGroup>
<_RestoreSettingsPerFramework Include="$([System.Guid]::NewGuid())">
<RestoreAdditionalProjectSources>$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
<RestoreAdditionalProjectFallbackFolders>$(RestoreAdditionalProjectFallbackFolders)</RestoreAdditionalProjectFallbackFolders>
<RestoreAdditionalProjectFallbackFoldersExcludes>$(RestoreAdditionalProjectFallbackFoldersExcludes)</RestoreAdditionalProjectFallbackFoldersExcludes>
</_RestoreSettingsPerFramework>
</ItemGroup>
</Target>
<!--
============================================================
_GenerateRestoreProjectSpec
Generate a restore project spec for the current project.
============================================================
-->
<Target Name="_GenerateRestoreProjectSpec"
DependsOnTargets="_GetRestoreProjectStyle;_GetRestoreTargetFrameworksOutput;_GetRestoreSettings"
Returns="@(_RestoreGraphEntry)">
<!-- Determine the restore output path -->
<PropertyGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' OR '$(RestoreProjectStyle)' == 'ProjectJson' ">
<RestoreOutputPath Condition=" '$(RestoreOutputPath)' == '' ">$(MSBuildProjectExtensionsPath)</RestoreOutputPath>
</PropertyGroup>
<ConvertToAbsolutePath Paths="$(RestoreOutputPath)" Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' OR '$(RestoreProjectStyle)' == 'ProjectJson'">
<Output TaskParameter="AbsolutePaths" PropertyName="RestoreOutputAbsolutePath" />
</ConvertToAbsolutePath>
<!--
Determine project name for the assets file.
Highest priority: PackageId
If PackageId does not exist use: AssemblyName
If AssemblyName does not exist fallback to the project file name without the extension: $(MSBuildProjectName)
For non-PackageReference projects use only: $(MSBuildProjectName)
-->
<PropertyGroup>
<_RestoreProjectName>$(MSBuildProjectName)</_RestoreProjectName>
<_RestoreProjectName Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' AND '$(AssemblyName)' != '' ">$(AssemblyName)</_RestoreProjectName>
<_RestoreProjectName Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' AND '$(PackageId)' != '' ">$(PackageId)</_RestoreProjectName>
</PropertyGroup>
<!--
Determine project version for .NETCore projects
Default to 1.0.0
Use Version if it exists
Override with PackageVersion if it exists (same as pack)
-->
<PropertyGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' ">
<_RestoreProjectVersion>1.0.0</_RestoreProjectVersion>
<_RestoreProjectVersion Condition=" '$(Version)' != '' ">$(Version)</_RestoreProjectVersion>
<_RestoreProjectVersion Condition=" '$(PackageVersion)' != '' ">$(PackageVersion)</_RestoreProjectVersion>
</PropertyGroup>
<!-- Determine if this will use cross targeting -->
<PropertyGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' AND '$(TargetFrameworks)' != '' ">
<_RestoreCrossTargeting>true</_RestoreCrossTargeting>
</PropertyGroup>
<!-- Determine if ContentFiles should be written by NuGet -->
<PropertyGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' AND '$(_RestoreSkipContentFileWrite)' == '' ">
<_RestoreSkipContentFileWrite Condition=" '$(TargetFrameworks)' == '' AND '$(TargetFramework)' == '' ">true</_RestoreSkipContentFileWrite>
</PropertyGroup>
<!-- Write properties for the top level entry point -->
<ItemGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' ">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())">
<Type>ProjectSpec</Type>
<Version>$(_RestoreProjectVersion)</Version>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
<ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>
<ProjectName>$(_RestoreProjectName)</ProjectName>
<Sources>$(_OutputSources)</Sources>
<FallbackFolders>$(_OutputFallbackFolders)</FallbackFolders>
<PackagesPath>$(_OutputPackagesPath)</PackagesPath>
<ProjectStyle>$(RestoreProjectStyle)</ProjectStyle>
<OutputPath>$(RestoreOutputAbsolutePath)</OutputPath>
<RuntimeIdentifiers>$(RuntimeIdentifiers);$(RuntimeIdentifier)</RuntimeIdentifiers>
<RuntimeSupports>$(RuntimeSupports)</RuntimeSupports>
<CrossTargeting>$(_RestoreCrossTargeting)</CrossTargeting>
<RestoreLegacyPackagesDirectory>$(RestoreLegacyPackagesDirectory)</RestoreLegacyPackagesDirectory>
<ValidateRuntimeAssets>$(ValidateRuntimeIdentifierCompatibility)</ValidateRuntimeAssets>
<SkipContentFileWrite>$(_RestoreSkipContentFileWrite)</SkipContentFileWrite>
<ConfigFilePaths>$(_OutputConfigFilePaths)</ConfigFilePaths>
<TreatWarningsAsErrors>$(TreatWarningsAsErrors)</TreatWarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors)</WarningsAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors)</WarningsNotAsErrors>
<NoWarn>$(NoWarn)</NoWarn>
<RestorePackagesWithLockFile>$(RestorePackagesWithLockFile)</RestorePackagesWithLockFile>
<NuGetLockFilePath>$(NuGetLockFilePath)</NuGetLockFilePath>
<RestoreLockedMode>$(RestoreLockedMode)</RestoreLockedMode>
<_CentralPackageVersionsEnabled>$(_CentralPackageVersionsEnabled)</_CentralPackageVersionsEnabled>
<CentralPackageFloatingVersionsEnabled>$(CentralPackageFloatingVersionsEnabled)</CentralPackageFloatingVersionsEnabled>
<CentralPackageVersionOverrideEnabled>$(CentralPackageVersionOverrideEnabled)</CentralPackageVersionOverrideEnabled>
<CentralPackageTransitivePinningEnabled>$(CentralPackageTransitivePinningEnabled)</CentralPackageTransitivePinningEnabled>
<NuGetAudit>$(NuGetAudit)</NuGetAudit>
<NuGetAuditLevel>$(NuGetAuditLevel)</NuGetAuditLevel>
<NuGetAuditMode>$(NuGetAuditMode)</NuGetAuditMode>
</_RestoreGraphEntry>
</ItemGroup>
<!-- Use project.json -->
<ItemGroup Condition=" '$(RestoreProjectStyle)' == 'ProjectJson' ">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())">
<Type>ProjectSpec</Type>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
<ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>
<ProjectName>$(_RestoreProjectName)</ProjectName>
<Sources>$(_OutputSources)</Sources>
<OutputPath>$(RestoreOutputAbsolutePath)</OutputPath>
<FallbackFolders>$(_OutputFallbackFolders)</FallbackFolders>
<PackagesPath>$(_OutputPackagesPath)</PackagesPath>
<ProjectJsonPath>$(_CurrentProjectJsonPath)</ProjectJsonPath>
<ProjectStyle>$(RestoreProjectStyle)</ProjectStyle>
<ConfigFilePaths>$(_OutputConfigFilePaths)</ConfigFilePaths>
</_RestoreGraphEntry>
</ItemGroup>
<!-- Use packages.config -->
<ItemGroup Condition=" '$(RestoreProjectStyle)' == 'PackagesConfig' ">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())">
<Type>ProjectSpec</Type>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
<ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>
<ProjectName>$(_RestoreProjectName)</ProjectName>
<ProjectStyle>$(RestoreProjectStyle)</ProjectStyle>
<PackagesConfigPath Condition="Exists('$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config')">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesConfigPath>
<PackagesConfigPath Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfigPath>
<RestorePackagesWithLockFile>$(RestorePackagesWithLockFile)</RestorePackagesWithLockFile>
<NuGetLockFilePath>$(NuGetLockFilePath)</NuGetLockFilePath>
<RestoreLockedMode>$(RestoreLockedMode)</RestoreLockedMode>
<Sources>$(_OutputSources)</Sources>
<SolutionDir>$(SolutionDir)</SolutionDir>
<RepositoryPath>$(_OutputRepositoryPath)</RepositoryPath>
<ConfigFilePaths>$(_OutputConfigFilePaths)</ConfigFilePaths>
<PackagesPath>$(_OutputPackagesPath)</PackagesPath>
<TargetFrameworks>@(_RestoreTargetFrameworksOutputFiltered)</TargetFrameworks>
<NuGetAudit>$(NuGetAudit)</NuGetAudit>
<NuGetAuditLevel>$(NuGetAuditLevel)</NuGetAuditLevel>
</_RestoreGraphEntry>
</ItemGroup>
<!-- Non-NuGet type -->
<ItemGroup Condition=" '$(RestoreProjectStyle)' == 'Unknown' ">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())">
<Type>ProjectSpec</Type>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
<ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>
<ProjectName>$(_RestoreProjectName)</ProjectName>
<ProjectStyle>$(RestoreProjectStyle)</ProjectStyle>
<TargetFrameworks>@(_RestoreTargetFrameworksOutputFiltered)</TargetFrameworks>
</_RestoreGraphEntry>
</ItemGroup>
</Target>
<!--
============================================================
_GenerateProjectRestoreGraph
Recursively walk project to project references.
============================================================
-->
<Target Name="_GenerateProjectRestoreGraph"
DependsOnTargets="
_GetRestoreProjectStyle;
_GenerateRestoreProjectSpec;
_GenerateRestoreDependencies"
Returns="@(_RestoreGraphEntry)">
<!-- Output from dependency targets -->
</Target>
<!--
============================================================
_GenerateRestoreDependencies
Generate items for package and project references.
============================================================
-->
<Target Name="_GenerateRestoreDependencies"
DependsOnTargets="_GenerateProjectRestoreGraphAllFrameworks;_GenerateProjectRestoreGraphCurrentProject"
Returns="@(_RestoreGraphEntry)">
</Target>
<!--
============================================================
_GenerateProjectRestoreGraphAllFrameworks
Walk dependencies for all frameworks.
============================================================
-->
<Target Name="_GenerateProjectRestoreGraphAllFrameworks"
Condition=" '$(TargetFrameworks)' != '' "
DependsOnTargets="_GetRestoreTargetFrameworksAsItems"
Returns="@(_RestoreGraphEntry)">
<!-- Get project and package references -->
<!-- Evaluate for each framework -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateProjectRestoreGraphPerFramework"
Properties="TargetFramework=%(_RestoreTargetFrameworkItems.Identity);
$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreGraphEntry" />
</MSBuild>
</Target>
<!--
============================================================
_GenerateProjectRestoreGraphCurrentProject
Walk dependencies with the current framework.
============================================================
-->
<Target Name="_GenerateProjectRestoreGraphCurrentProject"
Condition=" '$(TargetFrameworks)' == '' "
DependsOnTargets="_GenerateProjectRestoreGraphPerFramework"
Returns="@(_RestoreGraphEntry)">
</Target>
<!--
============================================================
_GenerateProjectRestoreGraphPerFramework
Walk dependencies using $(TargetFramework)
============================================================
-->
<Target Name="_GenerateProjectRestoreGraphPerFramework"
DependsOnTargets="_GetRestoreProjectStyle;_CollectRestoreInputs"
Returns="@(_RestoreGraphEntry)">
<!-- Write out project references -->
<GetRestoreProjectReferencesTask
ProjectUniqueName="$(MSBuildProjectFullPath)"
ProjectReferences="@(ProjectReference)"
TargetFrameworks="$(TargetFramework)"
ParentProjectPath="$(MSBuildProjectFullPath)">
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestoreProjectReferencesTask>
<!-- Write out package references-->
<GetRestorePackageReferencesTask
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
ProjectUniqueName="$(MSBuildProjectFullPath)"
PackageReferences="@(PackageReference)"
TargetFrameworks="$(TargetFramework)"
>
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestorePackageReferencesTask>
<!-- Write out central package versions -->
<GetCentralPackageVersionsTask
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' AND '$(_CentralPackageVersionsEnabled)' == 'true' "
ProjectUniqueName="$(MSBuildProjectFullPath)"
CentralPackageVersions="@(PackageVersion)"
TargetFrameworks="$(TargetFramework)"
>
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetCentralPackageVersionsTask>
<!-- Write out package downloads -->
<GetRestorePackageDownloadsTask
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
ProjectUniqueName="$(MSBuildProjectFullPath)"
PackageDownloads="@(PackageDownload)"
TargetFrameworks="$(TargetFramework)"
>
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestorePackageDownloadsTask>
<!-- Write out Framework References-->
<GetRestoreFrameworkReferencesTask
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
ProjectUniqueName="$(MSBuildProjectFullPath)"
FrameworkReferences="@(FrameworkReference)"
TargetFrameworks="$(TargetFramework)"
>
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestoreFrameworkReferencesTask>
<!-- Write out advisory suppressions-->
<GetRestoreNuGetAuditSuppressionsTask
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' "
ProjectUniqueName="$(MSBuildProjectFullPath)"
NuGetAuditSuppressions="@(NuGetAuditSuppress)"
TargetFrameworks="$(TargetFramework)"
>
<Output
TaskParameter="RestoreGraphItems"
ItemName="_RestoreGraphEntry" />
</GetRestoreNuGetAuditSuppressionsTask>
<!-- Write out target framework information -->
<ItemGroup Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true'">
<_RestoreGraphEntry Include="$([System.Guid]::NewGuid())">
<Type>TargetFrameworkInformation</Type>
<ProjectUniqueName>$(MSBuildProjectFullPath)</ProjectUniqueName>
<PackageTargetFallback>$(PackageTargetFallback)</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback)</AssetTargetFallback>
<TargetFramework>$(TargetFramework)</TargetFramework>
<TargetFrameworkIdentifier>$(TargetFrameworkIdentifier)</TargetFrameworkIdentifier>
<TargetFrameworkVersion>$(TargetFrameworkVersion)</TargetFrameworkVersion>
<TargetFrameworkMoniker>$(TargetFrameworkMoniker)</TargetFrameworkMoniker>
<TargetFrameworkProfile>$(TargetFrameworkProfile)</TargetFrameworkProfile>
<TargetPlatformMoniker>$(TargetPlatformMoniker)</TargetPlatformMoniker>
<TargetPlatformIdentifier>$(TargetPlatformIdentifier)</TargetPlatformIdentifier>
<TargetPlatformVersion>$(TargetPlatformVersion)</TargetPlatformVersion>
<TargetPlatformMinVersion>$(TargetPlatformMinVersion)</TargetPlatformMinVersion>
<CLRSupport>$(CLRSupport)</CLRSupport>
<RuntimeIdentifierGraphPath>$(RuntimeIdentifierGraphPath)</RuntimeIdentifierGraphPath>
<WindowsTargetPlatformMinVersion>$(WindowsTargetPlatformMinVersion)</WindowsTargetPlatformMinVersion>
</_RestoreGraphEntry>
</ItemGroup>
</Target>
<!--
============================================================
_GenerateRestoreProjectPathItemsCurrentProject
Get absolute paths for all project references.
============================================================
-->
<Target Name="_GenerateRestoreProjectPathItemsCurrentProject"
Condition=" '$(TargetFrameworks)' == '' "
DependsOnTargets="_GenerateRestoreProjectPathItemsPerFramework"
Returns="@(_RestoreProjectPathItems)">
</Target>
<!--
============================================================
_GenerateRestoreProjectPathItemsPerFramework
Get absolute paths for all project references.
============================================================
-->
<Target Name="_GenerateRestoreProjectPathItemsPerFramework"
Returns="@(_RestoreProjectPathItems)">
<!-- Get the absolute paths to all projects -->
<ConvertToAbsolutePath Paths="@(ProjectReference)">
<Output TaskParameter="AbsolutePaths" PropertyName="_RestoreGraphAbsoluteProjectPaths" />
</ConvertToAbsolutePath>
<ItemGroup>
<_RestoreProjectPathItems Include="$(_RestoreGraphAbsoluteProjectPaths)" />
</ItemGroup>
</Target>
<!--
============================================================
_GenerateRestoreProjectPathItems
Get all project references regardless of framework
============================================================
-->
<Target Name="_GenerateRestoreProjectPathItems"
DependsOnTargets="_GenerateRestoreProjectPathItemsAllFrameworks;_GenerateRestoreProjectPathItemsCurrentProject"
Returns="@(_CurrentRestoreProjectPathItems)">
<!-- Drop any duplicate items -->
<RemoveDuplicates
Inputs="@(_RestoreProjectPathItems)">
<Output
TaskParameter="Filtered"
ItemName="_CurrentRestoreProjectPathItems" />
</RemoveDuplicates>
</Target>
<!--
============================================================
_GenerateRestoreProjectPathItemsAllFrameworks
Get all project references regardless of framework
============================================================
-->
<Target Name="_GenerateRestoreProjectPathItemsAllFrameworks"
Condition=" '$(TargetFrameworks)' != '' "
DependsOnTargets="_GetRestoreTargetFrameworksAsItems"
Returns="@(_RestoreProjectPathItems)">
<!-- Get all project references for the current project -->
<!-- With SkipNonexistentTargets support -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' == 'true' "
BuildInParallel="$(RestoreBuildInParallel)"
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateRestoreProjectPathItemsPerFramework"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true"
Properties="TargetFramework=%(_RestoreTargetFrameworkItems.Identity);
$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItems" />
</MSBuild>
<!-- Without SkipNonexistentTargets support -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' != 'true' "
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateRestoreProjectPathItemsPerFramework"
ContinueOnError="$(RestoreContinueOnError)"
Properties="TargetFramework=%(_RestoreTargetFrameworkItems.Identity);
$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItems" />
</MSBuild>
</Target>
<!--
============================================================
_GenerateRestoreProjectPathWalk
Recursively walk projects
============================================================
-->
<Target Name="_GenerateRestoreProjectPathWalk"
DependsOnTargets="_GenerateRestoreProjectPathItems"
Returns="@(_RestoreProjectPathItems)">
<!-- Walk project references -->
<!-- With SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' == 'true' "
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(_CurrentRestoreProjectPathItems)"
Targets="_GenerateRestoreProjectPathWalk"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_GenerateRestoreProjectPathWalkOutputs" />
</MSBuild>
<!-- Without SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' != 'true' "
Projects="@(_CurrentRestoreProjectPathItems)"
Targets="_GenerateRestoreProjectPathWalk"
ContinueOnError="$(RestoreContinueOnError)"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_GenerateRestoreProjectPathWalkOutputs" />
</MSBuild>
<!-- Include the current project in the result -->
<ItemGroup>
<_GenerateRestoreProjectPathWalkOutputs Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
<!-- Remove duplicates -->
<RemoveDuplicates
Inputs="@(_GenerateRestoreProjectPathWalkOutputs)">
<Output
TaskParameter="Filtered"
ItemName="_RestoreProjectPathItems" />
</RemoveDuplicates>
</Target>
<!--
============================================================
_GetAllRestoreProjectPathItems
Get the full list of known projects.
This includes all child projects from all target frameworks.
============================================================
-->
<Target Name="_GetAllRestoreProjectPathItems"
DependsOnTargets="_FilterRestoreGraphProjectInputItems"
Returns="@(_RestoreProjectPathItems)">
<NuGetMessageTask Name="DeterminingProjectsToRestore" Importance="High" />
<!-- Walk projects -->
<!-- With SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' == 'true' "
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(FilteredRestoreGraphProjectInputItems)"
Targets="_GenerateRestoreProjectPathWalk"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItemsOutputs" />
</MSBuild>
<!-- Without SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' != 'true' "
Projects="@(FilteredRestoreGraphProjectInputItems)"
Targets="_GenerateRestoreProjectPathWalk"
ContinueOnError="$(RestoreContinueOnError)"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItemsOutputs" />
</MSBuild>
<!-- Remove duplicates -->
<RemoveDuplicates
Inputs="@(_RestoreProjectPathItemsOutputs)">
<Output
TaskParameter="Filtered"
ItemName="_RestoreProjectPathItemsWithoutDupes" />
</RemoveDuplicates>
<!-- Remove projects that do not support restore. -->
<!-- With SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' == 'true' "
BuildInParallel="$(RestoreBuildInParallel)"
Projects="@(_RestoreProjectPathItemsWithoutDupes)"
Targets="_IsProjectRestoreSupported"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItems" />
</MSBuild>
<!-- Without SkipNonexistentTargets -->
<MSBuild
Condition=" '$(RestoreUseSkipNonexistentTargets)' != 'true' "
Projects="@(_RestoreProjectPathItemsWithoutDupes)"
Targets="_IsProjectRestoreSupported"
ContinueOnError="$(RestoreContinueOnError)"
Properties="$(_GenerateRestoreGraphProjectEntryInputProperties)">
<Output
TaskParameter="TargetOutputs"
ItemName="_RestoreProjectPathItems" />
</MSBuild>
</Target>
<!--
============================================================
_GetRestoreSettingsOverrides
Get global property overrides that should be resolved
against the current working directory instead of the project.
This is done by calling into NuGet.targets in a new scope,
project properties will not be returned by the calls below.
============================================================
-->
<Target Name="_GetRestoreSettingsOverrides"
Returns="$(_RestorePackagesPathOverride);$(_RestoreRepositoryPathOverride);$(_RestoreSourcesOverride);$(_RestoreFallbackFoldersOverride)">
<!-- RestorePackagesPathOverride -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Condition=" '$(RestorePackagesPath)' != '' "
Projects="$(MSBuildThisFileFullPath)"
Targets="_GetRestorePackagesPathOverride">
<Output
TaskParameter="TargetOutputs"
PropertyName="_RestorePackagesPathOverride" />
</MSBuild>
<!-- RestoreRepositoryPathOverride -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Condition=" '$(RestoreRepositoryPathOverride)' != '' "
Projects="$(MSBuildThisFileFullPath)"
Targets="_GetRestoreRepositoryPathOverride">
<Output
TaskParameter="TargetOutputs"
PropertyName="_RestoreRepositoryPathOverride" />
</MSBuild>
<!-- RestoreSourcesOverride -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Condition=" '$(RestoreSources)' != '' "
Projects="$(MSBuildThisFileFullPath)"
Targets="_GetRestoreSourcesOverride">
<Output
TaskParameter="TargetOutputs"
PropertyName="_RestoreSourcesOverride" />
</MSBuild>
<!-- RestoreFallbackFoldersOverride -->
<MSBuild
BuildInParallel="$(RestoreBuildInParallel)"
Condition=" '$(RestoreFallbackFolders)' != '' "
Projects="$(MSBuildThisFileFullPath)"
Targets="_GetRestoreFallbackFoldersOverride">
<Output
TaskParameter="TargetOutputs"
PropertyName="_RestoreFallbackFoldersOverride" />
</MSBuild>
</Target>
<!--
============================================================
_GetRestorePackagesPathOverride
============================================================
-->
<Target Name="_GetRestorePackagesPathOverride"
Returns="$(_RestorePackagesPathOverride)">
<PropertyGroup>
<_RestorePackagesPathOverride>$(RestorePackagesPath)</_RestorePackagesPathOverride>
</PropertyGroup>
</Target>
<!--
============================================================
_GetRestoreRepositoryPathOverride
============================================================
-->
<Target Name="_GetRestoreRepositoryPathOverride"
Returns="$(_RestoreRepositoryPathOverride)">
<PropertyGroup>
<_RestorePackagesPathOverride>$(RestoreRepositoryPath)</_RestorePackagesPathOverride>
</PropertyGroup>
</Target>
<!--
============================================================
_GetRestoreSourcesOverride
============================================================
-->
<Target Name="_GetRestoreSourcesOverride"
Returns="$(_RestoreSourcesOverride)">
<PropertyGroup>
<_RestoreSourcesOverride>$(RestoreSources)</_RestoreSourcesOverride>
</PropertyGroup>
</Target>
<!--
============================================================
_GetRestoreFallbackFoldersOverride
============================================================
-->
<Target Name="_GetRestoreFallbackFoldersOverride"
Returns="$(_RestoreFallbackFoldersOverride)">
<PropertyGroup>
<_RestoreFallbackFoldersOverride>$(RestoreFallbackFolders)</_RestoreFallbackFoldersOverride>
</PropertyGroup>
</Target>
<!--
============================================================
_GetRestoreTargetFrameworkOverride
============================================================
-->
<Target Name="_GetRestoreTargetFrameworkOverride"
Condition=" '$(_DisableNuGetRestoreTargetFrameworksOverride)' != 'true' "
Returns="$(_TargetFrameworkOverride)">
<GetGlobalPropertyValueTask
PropertyName="TargetFramework"
Condition=" '$(TargetFrameworks)' != '' ">
<Output TaskParameter="GlobalPropertyValue" PropertyName="_TargetFrameworkOverride" />
</GetGlobalPropertyValueTask>
<!-- Only set the override if TargetFrameworks has not been overriden as well. In that case, prefer it. -->
</Target>
<!--
============================================================
_GetTargetFrameworkOverrides
============================================================
-->
<Target Name="_GetTargetFrameworkOverrides"
Returns="$(_TargetFrameworkOverride)">
<PropertyGroup>
<_TargetFrameworkOverride Condition=" '$(TargetFrameworks)' == '' ">$(TargetFramework)</_TargetFrameworkOverride>
</PropertyGroup>
</Target>
<!--
============================================================
_IsProjectRestoreSupported
Verify restore targets exist in the project.
============================================================
-->
<Target Name="_IsProjectRestoreSupported"
Returns="@(_ValidProjectsForRestore)">
<ItemGroup>
<_ValidProjectsForRestore Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<!--
============================================================
Import NuGet.RestoreEx.targets if the MSBuild property 'RestoreEnableStaticGraph'
is 'true'. This file overrides the Restore target to use MSBuild Static Graph
to load and evaluate projects which is much faster.
This feature is not supported for NuGet.exe scenarios and NuGet.RestoreEx.targets
won't exist in that case.
============================================================
-->
<Import Project="NuGet.RestoreEx.targets" Condition="'$(RestoreUseStaticGraphEvaluation)' == 'true' And Exists('NuGet.RestoreEx.targets')" />
</Project>
|