Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to express dependencies among projects without referencing output assembly #3843

Open
rainersigwald opened this issue Oct 9, 2018 · 4 comments
Labels

Comments

@rainersigwald
Copy link
Member

From @tmat on October 8, 2018 23:44

It is sometimes necessary to build project A before project B without project B referencing the assembly that A generates. In such cases one can use ProjectReference with ReferenceOutputAssembly="false".

This however is not sufficient in all scenarios, especially when these projects target different, incompatible frameworks and/or multi-target.

Turns out 3 properties need to be set to make this work:

<ProjectReference Include="B.csproj" 
       ReferenceOutputAssembly="false"
       SkipGetTargetFrameworkProperties="true"
       GlobalPropertiesToRemove="TargetFramework" />

This is much more complex than it should be.

Proposal: introduce a new item that can be use to express that this project depends on building another project, but has no implication on references. Such item could be called e.g. ProjectBuildOrderDependency, DependsOnProject, etc.

<DependsOnProject Include="B.csproj" />

Copied from original issue: dotnet/sdk#2574

@rainersigwald
Copy link
Member Author

From @nguerrera on October 8, 2018 23:45

cc @rainersigwald

@rainersigwald
Copy link
Member Author

Any change here would need to live on the MSBuild side of the fence, because you can have dependencies to SDK projects from non-SDK projects.

@rainersigwald
Copy link
Member Author

I don't think adding a new item type is the right way to fix this, because ProjectReference is semantically meaningful to VS and other consumers.

I wish we had made ReferenceOutputAssembly="false" have this behavior, but because we shipped the way we did, we can't fix that now -- see #2661 (and why the fix for it got backed out). This might actually just be a duplicate of that bug.

We could potentially just add a BuildOrderingOnly="true" or something, and recommend using that always over ReferenceOutputAssembly.

@nguerrera
Copy link
Contributor

I agree with everything you wrote. There are actually two workarounds here vs. the desire of just saying ReferenceOutputAssembly="false"

  1. SkipGetTargetFrameworkProperties (works around P2Ps should be allowed when ReferenceOutputAssembly=false even given TFM incompatibilities #2661, which I think at this point is by design / won't fix)
  2. GlobalPropertiesToRemove (works around Build failure related to dependencies in a mixed solution #2366, which I think we still hope to fix -- there's an active PR)

Since it doesn't seem we can compatibly make ReferenceOutputAssembly="false" the master switch, I vote +1 on BuildOderingOnly="true" or some other new metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants