Skip to content

Fix preprocessor when imported documents specify Sdk - #2904

Merged
AndyGerlicher merged 2 commits into
dotnet:vs15.6from
jeffkl:fix-pp
Jan 24, 2018
Merged

AndyGerlicher merged 2 commits into
dotnet:vs15.6from
jeffkl:fix-pp

Conversation

@jeffkl

@jeffkl jeffkl commented Jan 24, 2018

Copy link
Copy Markdown
Contributor

Implicit imports for imported projects are shown in the preprocessor at the top and bottom of the top level project rather than the imported project.

To fix this, I've created a mapping of which documents contain the implicit imports. Before processing a document, the imports are then added to that document rather than the top level one.

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but I'm sad that we support this situation at all.

Comment thread src/Build/Evaluation/Preprocessor.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't we going to make importing a project that itself had an Sdk element an error? That seems way clearer . . . but is it done in the wild?

@AndyGerlicher
AndyGerlicher changed the base branch from master to vs15.6 January 24, 2018 20:53
Implicit imports for imported projects are shown in the preprocessor at the top and bottom of the top level project rather than the imported project.

To fix this, I've created a mapping of which documents contain the implicit imports.  Before processing a document, the imports are then added to that document rather than the top level one.
@AndyGerlicher
AndyGerlicher merged commit da555c2 into dotnet:vs15.6 Jan 24, 2018
@jeffkl
jeffkl deleted the fix-pp branch January 24, 2018 21:35
radical pushed a commit to radical/msbuild that referenced this pull request Jan 30, 2018
* Fix preprocessor when imported documents specify Sdk

Implicit imports for imported projects are shown in the preprocessor at the top and bottom of the top level project rather than the imported project.

To fix this, I've created a mapping of which documents contain the implicit imports.  Before processing a document, the imports are then added to that document rather than the top level one.

* Add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants