From ba8fca1a6079f05f9917065ad2111cdd3305d47e Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Fri, 18 Aug 2017 13:30:16 -0500 Subject: [PATCH 01/13] Get properties for ProjectReference in parallel In order to avoid batching the _GetProjectReferenceTargetFrameworkProperties target for each reference, the ProjectReference protocol can be amended to return an item from GetTargetFrameworkProperties instead of a semicolon-delimited list of key-value pairs. This allows a single build request to be sent to the engine, and allows resolving references in parallel on multiprocess builds. --- .../Microsoft.Common.CurrentVersion.targets | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Tasks/Microsoft.Common.CurrentVersion.targets b/src/Tasks/Microsoft.Common.CurrentVersion.targets index 6451832246c..7acc9f8da0a 100644 --- a/src/Tasks/Microsoft.Common.CurrentVersion.targets +++ b/src/Tasks/Microsoft.Common.CurrentVersion.targets @@ -1525,8 +1525,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. ====================================================================================== --> - + + <_ProjectReferencesWithTargetFrameworkProperties Include="@(_ProjectReferenceTargetFrameworkProperties->'%(OriginalItemSpec)')"> + + + + + <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' != 'true'"> + @(_ProjectReferencesWithTargetFrameworkProperties->'%(DesiredTargetFrameworkProperties)') + - %(_MSBuildProjectReferenceExistent.UndefineProperties);TargetFramework;ProjectHasSingleTargetFramework - - %(_MSBuildProjectReferenceExistent.UndefineProperties);ProjectHasSingleTargetFramework + + <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' == 'true'"> + @(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');TargetFramework - - - <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.Identity)' == '%(Identity)' and '$(_ProjectReferenceTargetFrameworkProperties)' != ''"> - %(_MSBuildProjectReferenceExistent.UndefineProperties);RuntimeIdentifier;ProjectIsRidAgnostic - - %(_MSBuildProjectReferenceExistent.UndefineProperties);ProjectIsRidAgnostic + + <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(IsRidAgnostic)')' == 'true'"> + @(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');RuntimeIdentifier - - - <_ProjectReferenceTargetFrameworkProperties /> - + <_ProjectReferenceTargetFrameworkProperties + Condition="'@(_ProjectReferenceTargetFrameworkProperties->Count())' > '1' and '%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)' != ''"> + @(_ProjectReferenceTargetFrameworkProperties) + + <_ProjectReferenceTargetFrameworkProperties + Include="%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)" + Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''"> + %(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec) + $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Replace('ProjectHasSingleTargetFramework=true','').Replace('ProjectHasSingleTargetFramework=false','').Replace('ProjectIsRidAgnostic=true','').TrimEnd(';')) + $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectHasSingleTargetFramework=true')) + $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectIsRidAgnostic=true')) + + <_ProjectReferenceTargetFrameworkProperties + Remove="@(_ProjectReferenceTargetFrameworkProperties)" + Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''" /> + - <_ProjectReferencesWithTargetFrameworkProperties Include="@(_ProjectReferenceTargetFrameworkProperties->'%(OriginalItemSpec)')"> - - + <_ProjectReferencesWithTargetFrameworkProperties + Include="@(_ProjectReferenceTargetFrameworkProperties->'%(OriginalItemSpec)')" /> <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' != 'true'"> From 8729689176f0e495ad8c709bd8ed9c34587a93f6 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Tue, 22 Aug 2017 14:40:48 -0500 Subject: [PATCH 03/13] Clarify existing ProjectReference protocol returns In preparation for describing the changes to return values I'd like to make, I need to document what the old ones were. --- documentation/ProjectReference-Protocol.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/documentation/ProjectReference-Protocol.md b/documentation/ProjectReference-Protocol.md index c85a219ae31..920ecbceedb 100644 --- a/documentation/ProjectReference-Protocol.md +++ b/documentation/ProjectReference-Protocol.md @@ -1,4 +1,4 @@ -# The `ProjectReference` Protocol +# The `ProjectReference` Protocol The MSBuild engine doesn't have a notion of a “project reference”—it only provides the [`MSBuild` task](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task) to allow cross-project communication. @@ -47,16 +47,19 @@ These targets are all defined in `Microsoft.Common.targets` and are defined in M If implementing a project with an “outer” (determine what properties to pass to the real build) and “inner” (fully specified) build, only `GetTargetFrameworkProperties` is required in the “outer” build. The other targets listed can be “inner” build only. -* `GetTargetFrameworkProperties` determines what properties should be passed to the “main” target. +* `GetTargetFrameworkProperties` determines what properties should be passed to the “main” target for a given `ReferringTargetFramework`. * **New** for MSBuild 15/Visual Studio 2017. Supports the cross-targeting feature allowing a project to have multiple `TargetFrameworks`. * **Conditions**: only when metadata `SkipGetTargetFrameworkProperties` for each reference is not true. * Skipped for `*.vcxproj` by default. -* `GetTargetPath` should the path of the project's output, but _not_ build that output. + * This should return a string of the form `TargetFramework=$(NearestTargetFramework);ProjectHasSingleTargetFramework=$(_HasSingleTargetFramework);ProjectIsRidAgnostic=$(_IsRidAgnostic)`, where the value of `NearestTargetFramework` will be used to formulate `TargetFramework` for the following calls and the other two properties are booleans. +* `GetTargetPath` should return the path of the project's output, but _not_ build that output. * **Conditions**: this is used for builds inside Visual Studio, but not on the command line. * It's also used when the property `BuildProjectReferences` is `false`, manually indicating that all `ProjectReferences` are up to date and shouldn't be (re)built. + * This should return a single item that is the primary output of the project, with metadata describing that output. See [`TargetPathWithTargetPlatformMoniker`](https://github.com/Microsoft/msbuild/blob/080ef976a428f6ff7bf53ca5dd4ee637b3fe949c/src/Tasks/Microsoft.Common.CurrentVersion.targets#L1834-L1842) for the default metadata. * **Default** targets should do the full build and return an assembly to be referenced. * **Conditions**: this is _not_ called when building inside Visual Studio. Instead, Visual Studio builds each project in isolation but in order, so the path returned from `GetTargetPath` can be assumed to exist at consumption time. * If the `ProjectReference` defines the `Targets` metadata, it is used. If not, no target is passed, and the default target of the reference (usually `Build`) is built. + * The return value of this target should be identical to that of `GetTargetPath`. * `GetNativeManifest` should return a manifest suitable for passing to the `ResolveNativeReferences` target. * `GetCopyToOutputDirectoryItems` should return the outputs of a project that should be copied to the output of a referencing project. * `Clean` should delete all outputs of the project. @@ -68,4 +71,4 @@ As with all MSBuild logic, targets can be added to do other work with `ProjectRe In particular, NuGet depends on being able to identify referenced projects' package dependencies, and calls some targets that are imported through `Microsoft.Common.targets` to do so. At the time of writing this this is in [`NuGet.targets`](https://github.com/NuGet/NuGet.Client/blob/79264a74262354c1a8f899c2c9ddcaff58afaf62/src/NuGet.Core/NuGet.Build.Tasks/NuGet.targets). -`Microsoft.AppxPackage.targets` adds a dependency on the target `GetPackagingOutputs`. \ No newline at end of file +`Microsoft.AppxPackage.targets` adds a dependency on the target `GetPackagingOutputs`. From 984f38125bc76949e3f263abd17b9cf09b0d765d Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Tue, 22 Aug 2017 14:46:38 -0500 Subject: [PATCH 04/13] Document new GetTargetFrameworkProperties return Document the more-succinct-but-compatibility-breaking single-item-with-metadata return possibility for GetTargetFrameworkProperties. --- documentation/ProjectReference-Protocol.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/ProjectReference-Protocol.md b/documentation/ProjectReference-Protocol.md index 920ecbceedb..608bd317dae 100644 --- a/documentation/ProjectReference-Protocol.md +++ b/documentation/ProjectReference-Protocol.md @@ -51,7 +51,9 @@ If implementing a project with an “outer” (determine what properties to pass * **New** for MSBuild 15/Visual Studio 2017. Supports the cross-targeting feature allowing a project to have multiple `TargetFrameworks`. * **Conditions**: only when metadata `SkipGetTargetFrameworkProperties` for each reference is not true. * Skipped for `*.vcxproj` by default. - * This should return a string of the form `TargetFramework=$(NearestTargetFramework);ProjectHasSingleTargetFramework=$(_HasSingleTargetFramework);ProjectIsRidAgnostic=$(_IsRidAgnostic)`, where the value of `NearestTargetFramework` will be used to formulate `TargetFramework` for the following calls and the other two properties are booleans. + * This should return either + * a string of the form `TargetFramework=$(NearestTargetFramework);ProjectHasSingleTargetFramework=$(_HasSingleTargetFramework);ProjectIsRidAgnostic=$(_IsRidAgnostic)`, where the value of `NearestTargetFramework` will be used to formulate `TargetFramework` for the following calls and the other two properties are booleans, or + * an item with metadata `DesiredTargetFrameworkProperties` (key-value pairs of the form `TargetFramework=net46`), `HasSingleTargetFramework` (boolean), and `IsRidAgnostic` (boolean). * `GetTargetPath` should return the path of the project's output, but _not_ build that output. * **Conditions**: this is used for builds inside Visual Studio, but not on the command line. * It's also used when the property `BuildProjectReferences` is `false`, manually indicating that all `ProjectReferences` are up to date and shouldn't be (re)built. From c36bfb3b56a9899505c1c0465daee24396f5c1ee Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Thu, 24 Aug 2017 15:09:18 -0500 Subject: [PATCH 05/13] Documentation for protocol change --- documentation/ProjectReference-Protocol.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/documentation/ProjectReference-Protocol.md b/documentation/ProjectReference-Protocol.md index 608bd317dae..7734a0f261c 100644 --- a/documentation/ProjectReference-Protocol.md +++ b/documentation/ProjectReference-Protocol.md @@ -31,7 +31,9 @@ There are empty hooks in the default targets for `AssignProjectConfiguration` runs when building in a solution context, and ensures that the right `Configuration` and `Platform` are assigned to each reference. For example, if a solution specifies (using the Solution Build Manager) that for a given solution configuration, a project should always be built `Release`, that is applied inside MSBuild in this target. -`PrepareProjectReferences` then runs, ensuring that each referenced project exists (creating the item `@(_MSBuildProjectReferenceExistent)`) and determining the parameters it needs to produce a compatible build by calling its `GetTargetFrameworkProperties` target. +`PrepareProjectReferences` then runs, ensuring that each referenced project exists (creating the item `@(_MSBuildProjectReferenceExistent)`). + +`_ComputeProjectReferenceTargetFrameworkMatches` calls `GetTargetFrameworks` in existent ProjectReferences and determines the parameters needed to produce a compatible build by calling the `AssignReferenceProperties` task for each reference that multitargets. `ResolveProjectReferences` does the bulk of the work, building the referenced projects and collecting their outputs. @@ -47,8 +49,12 @@ These targets are all defined in `Microsoft.Common.targets` and are defined in M If implementing a project with an “outer” (determine what properties to pass to the real build) and “inner” (fully specified) build, only `GetTargetFrameworkProperties` is required in the “outer” build. The other targets listed can be “inner” build only. +* `GetTargetFrameworks` tells referencing projects what options are available to the build. + * It returns an item with metadata `TargetFrameworks` indicating what TargetFrameworks are available in the project, as well as boolean metadata `HasSingleTargetFramework` and `IsRidAgnostic`. + * **New** in MSBuild 15.5. * `GetTargetFrameworkProperties` determines what properties should be passed to the “main” target for a given `ReferringTargetFramework`. - * **New** for MSBuild 15/Visual Studio 2017. Supports the cross-targeting feature allowing a project to have multiple `TargetFrameworks`. + * **Deprecated** in MSBuild 15.5. + * New for MSBuild 15/Visual Studio 2017. Supports the cross-targeting feature allowing a project to have multiple `TargetFrameworks`. * **Conditions**: only when metadata `SkipGetTargetFrameworkProperties` for each reference is not true. * Skipped for `*.vcxproj` by default. * This should return either From bb447395304ce65b2ee03315d99a5136c1142649 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Thu, 24 Aug 2017 14:37:33 -0500 Subject: [PATCH 06/13] Identify inner-build in consuming project * Call GetTargetFrameworks target to identify target frameworks in referenced projects. Since TargetFrameworks is not set, this will avoid a 2nd evaluation when the project single targets. * Adds dependency on NuGet AssignReferenceProperties task. --- .../Microsoft.Common.CrossTargeting.targets | 13 ++++ .../Microsoft.Common.CurrentVersion.targets | 70 +++++++++++++++---- 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/src/Tasks/Microsoft.Common.CrossTargeting.targets b/src/Tasks/Microsoft.Common.CrossTargeting.targets index 61eb29ff956..138961514cc 100644 --- a/src/Tasks/Microsoft.Common.CrossTargeting.targets +++ b/src/Tasks/Microsoft.Common.CrossTargeting.targets @@ -20,6 +20,19 @@ Copyright (C) Microsoft Corporation. All rights reserved. + + + <_ThisProjectBuildMetadata Include="$(MSBuildProjectFullPath)"> + $(TargetFrameworks) + $(TargetFramework) + true + false + true + + + + <_TargetFramework Include="$(TargetFrameworks)" /> diff --git a/src/Tasks/Microsoft.Common.CurrentVersion.targets b/src/Tasks/Microsoft.Common.CurrentVersion.targets index bc455f7048e..b36c167acf4 100644 --- a/src/Tasks/Microsoft.Common.CurrentVersion.targets +++ b/src/Tasks/Microsoft.Common.CurrentVersion.targets @@ -1512,20 +1512,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - - + + + + + + + + + + + + <_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" /> + <_MSBuildProjectReferenceExistent Include="@(AnnotatedProjects)" /> + + + + + + + + <_ThisProjectBuildMetadata Include="$(MSBuildProjectFullPath)"> + $(TargetFrameworks) + $(TargetFramework) + true + false + true + + + + + + + false + true diff --git a/src/Tasks/Microsoft.Common.CurrentVersion.targets b/src/Tasks/Microsoft.Common.CurrentVersion.targets index b36c167acf4..2276ccc683e 100644 --- a/src/Tasks/Microsoft.Common.CurrentVersion.targets +++ b/src/Tasks/Microsoft.Common.CurrentVersion.targets @@ -1512,7 +1512,18 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + + + + $(NugetTargetMoniker) + $(TargetFrameworkMoniker) + + - + - + + + + TargetFramework=%(AnnotatedProjects.NearestTargetFramework) + + + %(AnnotatedProjects.UndefineProperties);TargetFramework + + + %(AnnotatedProjects.UndefineProperties);RuntimeIdentifier + + <_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" /> <_MSBuildProjectReferenceExistent Include="@(AnnotatedProjects)" /> @@ -1580,7 +1603,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(TargetFramework) true false - true + + false + true @@ -1598,68 +1623,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. ====================================================================================== --> - - - - $(NugetTargetMoniker) - $(TargetFrameworkMoniker) - - - - - - - - - - <_ProjectReferenceTargetFrameworkProperties - Condition="'@(_ProjectReferenceTargetFrameworkProperties->Count())' > '1' and '%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)' != ''"> - @(_ProjectReferenceTargetFrameworkProperties) - - <_ProjectReferenceTargetFrameworkProperties - Include="%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)" - Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''"> - %(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec) - $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Replace('ProjectHasSingleTargetFramework=true','').Replace('ProjectHasSingleTargetFramework=false','').Replace('ProjectIsRidAgnostic=true','').TrimEnd(';')) - $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectHasSingleTargetFramework=true')) - $([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectIsRidAgnostic=true')) - - <_ProjectReferenceTargetFrameworkProperties - Remove="@(_ProjectReferenceTargetFrameworkProperties)" - Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''" /> - - - <_ProjectReferencesWithTargetFrameworkProperties - Include="@(_ProjectReferenceTargetFrameworkProperties->'%(OriginalItemSpec)')" /> - - - <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' != 'true'"> - @(_ProjectReferencesWithTargetFrameworkProperties->'%(DesiredTargetFrameworkProperties)') - - - - <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' == 'true'"> - @(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');TargetFramework - - - - <_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(IsRidAgnostic)')' == 'true'"> - @(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');RuntimeIdentifier - - - + + TargetFramework=%(AnnotatedProjects.NearestTargetFramework) - + + + %(AnnotatedProjects.UndefineProperties);TargetFramework + + %(AnnotatedProjects.UndefineProperties);RuntimeIdentifier - - + <_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" /> <_MSBuildProjectReferenceExistent Include="@(AnnotatedProjects)" /> - - - - - TargetFramework=%(AnnotatedProjects.NearestTargetFramework) From 21b9a9562df16823b44603e3bbc46fe9c08f4412 Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Tue, 10 Oct 2017 19:10:48 -0700 Subject: [PATCH 10/13] Update NuGet.Build.Tasks Doesn't look like the package is signed so this likely won't work. --- dir.props | 2 +- src/.nuget/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dir.props b/dir.props index d2aadc3f413..61079e03748 100644 --- a/dir.props +++ b/dir.props @@ -43,7 +43,7 @@ 0.2.0 1.6.35 1.4.2 - 4.5.0-preview1-4518 + 4.5.0-preview1-4527 diff --git a/src/.nuget/project.json b/src/.nuget/project.json index c3e05402a74..f3a4c6fde07 100644 --- a/src/.nuget/project.json +++ b/src/.nuget/project.json @@ -6,7 +6,7 @@ "Microsoft.Net.Compilers": "2.3.1", "MicroBuild.Core": "0.2.0", "Microsoft.DotNet.BuildTools.GenAPI": "1.0.0-beta2-00731-01", - "NuGet.Build.Tasks": "4.5.0-preview1-4518" + "NuGet.Build.Tasks": "4.5.0-preview1-4527" }, "frameworks": { "net46": {} From 15afc901b8c128fff1e7ee0a3afef7e36fda7dff Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Tue, 10 Oct 2017 23:06:43 -0700 Subject: [PATCH 11/13] Add NuGet ImportAfter targets to bootstrapped build This is needed to get the import to get the automatic import of NuGet.targets. --- targets/BootStrapMSBuild.proj | 4 ++++ .../Microsoft.NuGet.ImportAfter.targets | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 targets/bootstrapDependencies/Core/15.0/Microsoft.Common.targets/ImportAfter/Microsoft.NuGet.ImportAfter.targets diff --git a/targets/BootStrapMSBuild.proj b/targets/BootStrapMSBuild.proj index d53760c2976..d926a713cdc 100644 --- a/targets/BootStrapMSBuild.proj +++ b/targets/BootStrapMSBuild.proj @@ -124,6 +124,7 @@ + + + diff --git a/targets/bootstrapDependencies/Core/15.0/Microsoft.Common.targets/ImportAfter/Microsoft.NuGet.ImportAfter.targets b/targets/bootstrapDependencies/Core/15.0/Microsoft.Common.targets/ImportAfter/Microsoft.NuGet.ImportAfter.targets new file mode 100644 index 00000000000..433922aacf3 --- /dev/null +++ b/targets/bootstrapDependencies/Core/15.0/Microsoft.Common.targets/ImportAfter/Microsoft.NuGet.ImportAfter.targets @@ -0,0 +1,18 @@ + + + + + $(MSBuildExtensionsPath)\NuGet.targets + + + From 00e2059b3e71a4d16fb56a0ba61957cc5aa66fea Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Tue, 10 Oct 2017 23:22:04 -0700 Subject: [PATCH 12/13] Comment cleanup --- .../Microsoft.Common.CurrentVersion.targets | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Tasks/Microsoft.Common.CurrentVersion.targets b/src/Tasks/Microsoft.Common.CurrentVersion.targets index 3a4eead7fa5..32a159e2836 100644 --- a/src/Tasks/Microsoft.Common.CurrentVersion.targets +++ b/src/Tasks/Microsoft.Common.CurrentVersion.targets @@ -1517,10 +1517,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. _GetProjectReferenceTargetFrameworkProperties Builds the GetTargetFrameworks target of all existent project references to get a list - of all supported TargetFrameworks of the referenced projects. For each project, call - GetReferenceNearestTargetFrameworkTask to determine the closest match. This allows a - cross-targeting project to select how it should be configured to build against the - most appropriate target for the referring target framework. + of all supported TargetFrameworks of the referenced projects. Calls the + GetReferenceNearestTargetFrameworkTask to determine the closest match for each project. + This allows a cross-targeting project to select how it should be configured to build + against the most appropriate target for the referring target framework. ====================================================================================== --> @@ -1567,7 +1567,12 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + + @@ -1596,8 +1606,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. TargetFramework=%(AnnotatedProjects.NearestTargetFramework) - + %(AnnotatedProjects.UndefineProperties);TargetFramework From e3ee36f9bb937dc6700bb955fbb159e78b4d06f5 Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Wed, 11 Oct 2017 10:20:09 -0700 Subject: [PATCH 13/13] Preserve project references that opt-out Projects that opt-out of GetTargetFrameworks must be preserved (e.g. C# -> C++ references). --- src/Tasks/Microsoft.Common.CurrentVersion.targets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.Common.CurrentVersion.targets b/src/Tasks/Microsoft.Common.CurrentVersion.targets index 32a159e2836..7334199e64c 100644 --- a/src/Tasks/Microsoft.Common.CurrentVersion.targets +++ b/src/Tasks/Microsoft.Common.CurrentVersion.targets @@ -1619,7 +1619,11 @@ Copyright (C) Microsoft Corporation. All rights reserved. %(AnnotatedProjects.UndefineProperties);RuntimeIdentifier - <_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" /> + + <_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" Condition="'%(_MSBuildProjectReferenceExistent.SkipGetTargetFrameworkProperties)' != 'true'" /> <_MSBuildProjectReferenceExistent Include="@(AnnotatedProjects)" />