Closed clairernovotny closed 8 months ago
@nguerrera, thoughts on changing these?
In Microsoft.NET.Sdk.WindowsDesktop.props, we have:
<ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<FrameworkReference Include="Microsoft.WindowsDesktop.App" IsImplicitlyDefined="true" />
</ItemGroup>
Perhaps this could be condition on either UseWpf
Or UseWindowsForms
<ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And ('$(UseWpf)'=='true' Or $(UseWindowsForms)=='true')">
<FrameworkReference Include="Microsoft.WindowsDesktop.App" IsImplicitlyDefined="true" />
</ItemGroup>
Similarly, in Microsoft.NET.Sdk.WindowsDesktop.targets, we have:
<Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets"
Condition ="'$(MSBuildRuntimeType)' != 'Core' and '$(UseLegacyPresentationBuildTasks)' == 'true'"/>
<Import Project="Microsoft.WinFX.targets"
Condition="'$(MSBuildRuntimeType)' == 'Core' or '$(UseLegacyPresentationBuildTasks)' != 'true'" />
This could be conditioned on UseWpf
:
<Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets"
Condition ="'$(MSBuildRuntimeType)' != 'Core' and '$(UseLegacyPresentationBuildTasks)' == 'true' and '$(UseWpf)'=='true'"/>
<Import Project="Microsoft.WinFX.targets"
Condition="'$(MSBuildRuntimeType)' == 'Core' or '$(UseLegacyPresentationBuildTasks)' != 'true' and '$(UseWpf)'=='true'" />
cc @rladuca
I think the conditions proposed make sense.
Aside: I think we can remove UseLegacyPresentationBuildTasks now. I put that there when switching over to new PBT to have an escape hatch if folks were blocked. It wasn't intended to be permanent. I don't think it even works anymore because it has a corresponding hack in the microsoft.net.windows.desktop.app targets that aren't imported after targeting pack work. cc @dsplaisted
cc @DamianEdwards
Old issue triage: We assume a solution was found for this or people have moved on so closing. We can reactivate if there is still a needed scenario for this.
I was looking to see how I can incorporate the MSBuild.Sdk.Extras with the new WindowsDesktop SDK and hit a few challenges. The overall scenario is getting multi-targeting to work, where iOS, UWP, Android, Tizen, are handled by the Extras, while WPF/WinForms is handled by the WindowsDesktop SDK.
Here’s where I hit some issues (numbered for reference):
I think that should cover it? If a couple of conditionals are added, I can have people use the MSBuild.Sdk.Extras as the SDK and pull in the WindowsDestop props/targets. The TFM-specific conditions would add all the items/targets.
What scenarios are covered by the Microsoft.WindowsDesktop.App FrameworkReference where neither UseWpf nor UseWindowsForms would be defined?
--
Overall, I wound up having to bypass the WindowsDesktop SDK itself and go straight to its targets, since I couldn't compose things the way I needed to in the right order. I'm hoping for ideas/suggestions/improvements going forward.