Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Fix old project system warnings #710

Merged
merged 2 commits into from Apr 18, 2018

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Apr 17, 2018

When NETStandard.Library was referenced in a .NETFramework project using the old project system,
it would evaluate the project ignoring conditions on ItemGroups. Apparently this is done to
display the superset of project configurations (eg both debug and release) in the solution heirarchy.
The warnings were a result of the items never being resolved after design time build finished
resolving references (because of course the items were conditioned out for the target framework).

We can workaround this using choose/when. Apparently the evaluation of the project is bold
enough to ignore the conditions on an itemgroup, but not bold enough to choose one of many
when (or all) clauses. :)

Fixes #708

When NETStandard.Library was referenced in a .NETFramework project using the old project system,
it would evaluate the project ignoring conditions on ItemGroups.  Apparently this is done to
display the superset of project configurations (eg both debug and release) in the solution heirarchy.
The warnings were a result of the items never being resolved after design time build finished
resolving references (because of course the items were conditioned out for the target framework).

We can workaround this using choose/when.  Apparently the evaluation of the project is bold
enough to ignore the conditions on an itemgroup, but not bold enough to choose one of many
when (or all) clauses. :)
We were appending an unnecessary slash after MSBuildThisFileDirectory in our targets.

This wasn't breaking anything but it should be cleaned up to avoid being a red-herring.
@ericstj ericstj self-assigned this Apr 17, 2018
@weshaggard
Copy link
Member

It might be worth pinging someone on the project system side to see if this is a known thing.

@ericstj
Copy link
Member Author

ericstj commented Apr 18, 2018

@davkean does this sound right?

@davkean
Copy link
Member

davkean commented Apr 18, 2018

It's really an MSBuild bug that you are relying on that won't get fixed; old project system says "give us all items ignoring conditions" and it MSBuild doesn't return these. Others are doing the same pattern.

@ericstj
Copy link
Member Author

ericstj commented Apr 18, 2018

Yeah, it felt more safe to rely on the choose/when behavior than what we previously got. Previously this was working because MSBuild wasn't evaluating the property that was used in the item, so the wildcard item came up empty (so long as folks didn't have any *.dll in the project directory 😖, if a DLL was in the directory it would also have the same behavior described in this issue).

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

Successfully merging this pull request may close these issues.

Wrong reference path in NETStandard.Library.targets
3 participants