Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eng
diff options
context:
space:
mode:
authorViktor Hofer <viktor.hofer@microsoft.com>2021-06-24 17:46:39 +0300
committerGitHub <noreply@github.com>2021-06-24 17:46:39 +0300
commit458bb9efd1de6544aa2a1645ba699ef7e59889df (patch)
tree5b88bca14df4dc0557389842ee2dd8658859e4e8 /eng
parent2ac023c8e9df61fe4557212cbd13956042fb47c5 (diff)
Fix compiler references when building inside VS (#54614)
If for a source project a contract project exists, then the contract project's TargetPath should be passed to the compiler. This is handled by the SDK by default when `ProduceReferenceAssembly` is true. As dotnet/runtime doesn't use the `ProduceReferenceAssembly` feature yet, a custom target adds the necessary `ReferenceAssembly` metadata to the `TargetPathWithTargetPlatformMoniker` item which then is transformed to references for the compiler. That works fine on the CLI as the `GetTargetPathWithTargetPlatformMoniker` target runs after the ProjectReference to the ContractProject is resolved and its target path is available. Inside VS the target ordering is different and the `ResolvedMatchingContract` item was empty as the ProjectReference to the contract wasn't yet resolved. The fix for that is to add a dependency onto the `ResolveProjectReferences` target to guarantee that the `ResolvedMatchingContract` item is populated in time. Noticed this when the build of System.ComponentModel.Composition.Registration failed because the implementation assembly of System.ComponentModel.Composition was passed to the compiler instead of the reference assembly.
Diffstat (limited to 'eng')
-rw-r--r--eng/resolveContract.targets1
1 files changed, 1 insertions, 0 deletions
diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets
index d98ef8dffb7..8c99a9059de 100644
--- a/eng/resolveContract.targets
+++ b/eng/resolveContract.targets
@@ -25,6 +25,7 @@
<!-- Allow P2Ps that target a source project to build against the corresponding ref project. -->
<Target Name="AnnotateTargetPathWithTargetPlatformMonikerWithReferenceAssembly"
Condition="'$(HasMatchingContract)' == 'true'"
+ DependsOnTargets="ResolveProjectReferences"
AfterTargets="GetTargetPathWithTargetPlatformMoniker">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker ReferenceAssembly="@(ResolvedMatchingContract)" />