Skip to content

Use correct PresentationBuildTasks.dll for VS and MSBuild builds#1999

Merged
vatsan-madhavan merged 1 commit intodotnet:masterfrom
wpfcontrib:pbt-msbuild-fixup
Oct 8, 2019
Merged

Use correct PresentationBuildTasks.dll for VS and MSBuild builds#1999
vatsan-madhavan merged 1 commit intodotnet:masterfrom
wpfcontrib:pbt-msbuild-fixup

Conversation

@vatsan-madhavan
Copy link
Copy Markdown
Member

@vatsan-madhavan vatsan-madhavan commented Oct 3, 2019

The PresentationBuildTasks.dll built out of the .NET Core codebase is not being used for msbuild based builds (i.e., when $(MSBuildRuntimeType)==Full) of WPF projects that use WindowsDesktop SDK. Instead, the PresentationBuildTasks.dll from GAC, i.e., the DLL that shipped with .NET Framework, is being used for builds instead.

This is because the first occurance of an UsingTask element that applies to a TaskName will always be used - it can not be overridden by subsequent UsingTask entries (this is unlike Property and Item behavior). See note in https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/msbuild/usingtask-element-msbuild.md immediate after the Syntax section (Note: The msbuild team added this note after identifying this behavior as part of investiaging this PresentationBuildTasks.dll issue).

The fix ensures that the UsingTask declarations supplied by the WindowsDesktop SDK precede those supplied by .NET Framework's copy of Microsoft.WinFX.targets by introducing a new .props file - Microsoft.WinFX.props - and moving a small number of Property and UsingTask declartions into it. Since .props are imported before targets, the UsingTask declarations supplied by WindowsDesktop SDK will thus take precedence.

Note that Pbt.props is used only for building this repo - it doesn't ship.

Addresses #1998
This needs to be ported to release/3.1 and release/3.0 (servicing).

… not being used for msbuild based builds (i.e., when `$(MSBuildRuntimeType)==Full`) of WPF projects that use WindowsDesktop SDK. Instead, the PresentationBuildTasks.dll from GAC, i.e., the DLL that shipped with .NET Framework, is being used for builds instead.

This is because the *first* occurance of an `UsingTask` element that applies to a `TaskName` will always be used - it can not be overridden by subsequent `UsingTask` entries (this is unlike `Property` and `Item` behavior). See note in https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/msbuild/usingtask-element-msbuild.md immediate after the **Syntax** section (Note: The msbuild team added this note after identifying this behavior as part of investiaging this PresentationBuildTasks.dll issue).

The fix ensures that the `UsingTask` declarations supplied by the WindowsDesktop SDK precede those supplied by .NET Framework's copy of `Microsoft.WinFX.targets` by introducing a new `.props` file - `Microsoft.WinFX.props` - and moving a small number of `Property` and `UsingTask` declartions into it. Since `.props` are imported before `targets`, the `UsingTask` declarations supplied by WindowsDesktop SDK will thus take precedence.
@vatsan-madhavan vatsan-madhavan self-assigned this Oct 3, 2019
@ghost ghost requested a review from rladuca October 3, 2019 22:39
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Oct 3, 2019
@ghost ghost requested a review from SamBent October 3, 2019 22:39
@vatsan-madhavan vatsan-madhavan added this to the 5.0 milestone Oct 3, 2019
@nguerrera
Copy link
Copy Markdown

I don't know how that happened because the old PBT was breaking hard on System.Runtime as core assembly.

@nguerrera
Copy link
Copy Markdown

We had workarounds in place just to be able to use the old PBT

@nguerrera
Copy link
Copy Markdown

Oh, when the target framework is net4x!

@vatsan-madhavan
Copy link
Copy Markdown
Member Author

Fixed issue description. Yeah - this is limited to netfx TFM’s.

@vatsan-madhavan
Copy link
Copy Markdown
Member Author

Fixed issue description. Yeah - this is limited to netfx TFM’s.

Sorry, that's not right. This is not limited to netfx TFM's. See #1998 (comment).

@nguerrera
Copy link
Copy Markdown

I think that it was right. See my comments.

@vatsan-madhavan
Copy link
Copy Markdown
Member Author

I think that it was right. See my comments.

you're right!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants