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

Do not negotiate TargetFramework for ProjectReferences when explicit override is specified #3356

Closed
rainersigwald opened this issue May 29, 2018 · 4 comments
Labels

Comments

@rainersigwald
Copy link
Member

Today, if you want to explicitly pick the TargetFramework of a ProjectReference, you must specify two metadata values:

    <ProjectReference Include="..\multitargeted_lib\multitargeted_lib.csproj">
      <SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
    </ProjectReference>

But SkipGetTargetFrameworkProperties is redundant: if SetTargetFramework is set, we can assume that we shouldn't do the negotiation.

See dotnet/project-system#477 (comment) (cc @nguerrera)

@dasMulli
Copy link
Contributor

dasMulli commented May 29, 2018

Btw I've been telling ppl to set AdditionalProperties="TargetFramework=..." (Slack / StackOverflow) - how bad is/was that?
That way the targets that the negotiation calls into always returned the proper values since they considered the project to be single-TFM anyway.

@rainersigwald
Copy link
Member Author

It's slightly less specific than SetTargetFramework, and harder to detect for a case like this, but otherwise works the same, I think. The side effect of forcing the reference into its inner build and sidestepping the outer-build negotiation is interesting. It might even be better that way, though right now I think I prefer the explicit approach.

@nguerrera
Copy link
Contributor

@rainersigwald
Copy link
Member Author

Yes, you're totally right. How can it have been a long week like 2 hours into the first day?

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

4 participants