|
2 | 2 | <PropertyGroup> |
3 | 3 | <_MicrosoftNetSdkWindowsDesktop>true</_MicrosoftNetSdkWindowsDesktop> |
4 | 4 | </PropertyGroup> |
5 | | - |
6 | | - <ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' And '$(UseWPF)' == 'true'"> |
| 5 | + |
| 6 | + <PropertyGroup> |
| 7 | + <!-- |
| 8 | + WindowsDesktop SDK supports WPF and WinForms on |
| 9 | + - .NET Core 3.0 and greater |
| 10 | + - .NET Framework 3.0 and greater |
| 11 | + |
| 12 | + Note that on .NET Framework versions < 4.0, additional workarounds may be required to build applications |
| 13 | + using the SDK style projects. For e.g., see https://github.com/microsoft/msbuild/issues/1333 |
| 14 | + |
| 15 | + Irrespective of whether '$(TargetFrameworkIdentifier)' is '.NETCoreApp' or '.NETFramework', |
| 16 | + the minimum value of $(_TargetFrameworkVersionWithoutV) we will be testing for is '3.0' |
| 17 | + |
| 18 | + Note: |
| 19 | + Please see https://github.com/microsoft/msbuild/issues/3212 for a discussion about the use of |
| 20 | + the private $(_TargetFrameworkVersionWithoutV) property - which will likely remain supported and |
| 21 | + is safe to use here. |
| 22 | + --> |
| 23 | + <_WindowsDesktopSdkTargetFrameworkVersionFloor>3.0</_WindowsDesktopSdkTargetFrameworkVersionFloor> |
| 24 | + </PropertyGroup> |
| 25 | + |
| 26 | + <ItemGroup Condition=" ('$(EnableDefaultItems)' == 'true') And ('$(UseWPF)' == 'true') And |
| 27 | + ('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)')"> |
7 | 28 | <ApplicationDefinition Include="App.xaml" |
8 | 29 | Condition="'$(EnableDefaultApplicationDefinition)' != 'false' And Exists('$(MSBuildProjectDirectory)/App.xaml') And '$(MSBuildProjectExtension)' == '.csproj'"> |
9 | 30 | <Generator>MSBuild:Compile</Generator> |
|
13 | 34 | <Generator>MSBuild:Compile</Generator> |
14 | 35 | </ApplicationDefinition> |
15 | 36 |
|
16 | | - <None Remove="@(ApplicationDefinition)" |
17 | | - Condition="'$(EnableDefaultApplicationDefinition)' != 'false'" /> |
18 | | - |
19 | 37 | <Page Include="**/*.xaml" |
20 | 38 | Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(ApplicationDefinition)" |
21 | 39 | Condition="'$(EnableDefaultPageItems)' != 'false'" > |
22 | 40 | <Generator>MSBuild:Compile</Generator> |
23 | 41 | </Page> |
24 | 42 |
|
25 | | - <None Remove="@(Page)" |
26 | | - Condition="'$(EnableDefaultPageItems)' != 'false'" /> |
27 | | - </ItemGroup> |
28 | 43 |
|
29 | | - <ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(UseWPF)' == 'true' And '$(UseWindowsForms)' == 'true'"> |
30 | | - <FrameworkReference Include="Microsoft.WindowsDesktop.App" IsImplicitlyDefined="true" /> |
31 | | - </ItemGroup> |
| 44 | + <!-- |
| 45 | + See https://github.com/dotnet/wpf/issues/685 |
| 46 | + Visual Studio would prefer that we remove **/*.xaml instead of |
| 47 | + being more precise. |
32 | 48 |
|
33 | | - <ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(UseWPF)' == 'true' And '$(UseWindowsForms)' != 'true'"> |
34 | | - <FrameworkReference Include="Microsoft.WindowsDesktop.App.WPF" IsImplicitlyDefined="true" /> |
| 49 | + <None Remove="@(Page)" |
| 50 | + Condition="'$(EnableDefaultPageItems)' != 'false'" /> |
| 51 | + <None Remove="@(ApplicationDefinition)" |
| 52 | + Condition="'$(EnableDefaultApplicationDefinition)' != 'false'" /> |
| 53 | + --> |
| 54 | + <None Remove="**/*.xaml" |
| 55 | + Condition="'$(EnableDefaultApplicationDefinition)' != 'false' And '$(EnableDefaultPageItems)' != 'false'" /> |
35 | 56 | </ItemGroup> |
36 | 57 |
|
37 | | - <ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(UseWPF)' != 'true' And '$(UseWindowsForms)' == 'true'"> |
38 | | - <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" IsImplicitlyDefined="true" /> |
| 58 | + |
| 59 | + <ItemGroup Condition="('$(DisableImplicitFrameworkReferences)' != 'true') And |
| 60 | + ('$(TargetFrameworkIdentifier)' == '.NETCoreApp') And |
| 61 | + ('$(_TargetFrameworkVersionWithoutV)' != '') And |
| 62 | + ('$(_TargetFrameworkVersionWithoutV)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)')"> |
| 63 | + |
| 64 | + <FrameworkReference Include="Microsoft.WindowsDesktop.App" IsImplicitlyDefined="true" |
| 65 | + Condition="('$(UseWPF)' == 'true') And ('$(UseWindowsForms)' == 'true')"/> |
| 66 | + |
| 67 | + <FrameworkReference Include="Microsoft.WindowsDesktop.App.WPF" IsImplicitlyDefined="true" |
| 68 | + Condition="('$(UseWPF)' == 'true') And ('$(UseWindowsForms)' != 'true')"/> |
| 69 | + |
| 70 | + <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" IsImplicitlyDefined="true" |
| 71 | + Condition="('$(UseWPF)' != 'true') And ('$(UseWindowsForms)' == 'true')"/> |
39 | 72 | </ItemGroup> |
| 73 | + |
40 | 74 |
|
41 | 75 | <!-- |
42 | 76 | Traditionally, Visual Studio has supplied these references for .NET Framework based |
|
57 | 91 | .NET 4.5+: PresentationCore, PresentationFramework, WindowsBase, System.Xaml, |
58 | 92 | UIAutomationClient, UIAutomationClientSideProviders, UIAutomationProvider, UIAutomationTypes |
59 | 93 | System.Windows.Controls.Ribbon |
60 | | - |
61 | | - Note: |
62 | | - Please see https://github.com/microsoft/msbuild/issues/3212 for a discussion about the use of |
63 | | - the private $(_TargetFrameworkVersionWithoutV) property - which will likely remain supported and |
64 | | - is safe to use here. |
| 94 | +
|
65 | 95 | --> |
66 | | - <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(_TargetFrameworkVersionWithoutV)' != ''"> |
67 | | - <_WpfCommonNetFxReference Include="WindowsBase" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'" /> |
68 | | - <_WpfCommonNetFxReference Include="PresentationCore" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'" /> |
69 | | - <_WpfCommonNetFxReference Include="PresentationFramework" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'" /> |
| 96 | + <ItemGroup Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') And ('$(_TargetFrameworkVersionWithoutV)' != '') And |
| 97 | + ('$(_TargetFrameworkVersionWithoutV)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)')"> |
| 98 | + |
| 99 | + <!-- |
| 100 | + The following 3 _WpfCommonNetFxReference items normally require Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'", since |
| 101 | + they are supported on .NET Framework 3.0 and above. |
| 102 | + |
| 103 | + This condition is implicitly satisfied by '$(_TargetFrameworkVersionWithoutV)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)' |
| 104 | + in the outer ItemGroup |
| 105 | + --> |
| 106 | + <_WpfCommonNetFxReference Include="WindowsBase" /> |
| 107 | + <_WpfCommonNetFxReference Include="PresentationCore" /> |
| 108 | + <_WpfCommonNetFxReference Include="PresentationFramework" /> |
70 | 109 |
|
71 | 110 | <_WpfCommonNetFxReference Include="System.Xaml" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.0'"> |
72 | 111 | <RequiredTargetFramework>4.0</RequiredTargetFramework> |
|
79 | 118 | <_WpfCommonNetFxReference Include="System.Windows.Controls.Ribbon" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '4.5'" /> |
80 | 119 | </ItemGroup> |
81 | 120 |
|
82 | | - <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWPF)' == 'true' "> |
83 | | - <_SDKImplicitReference Include="@(_WpfCommonNetFxReference)" /> |
84 | | - </ItemGroup> |
85 | | - |
86 | | - <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWindowsForms)' == 'true' "> |
87 | | - <_SDKImplicitReference Include="System.Windows.Forms"/> |
88 | | - </ItemGroup> |
89 | | - |
90 | | - <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWindowsForms)' == 'true' And '$(UseWPF)' == 'true' "> |
91 | | - <_SDKImplicitReference Include="WindowsFormsIntegration"/> |
| 121 | + <ItemGroup Condition="('$(DisableImplicitFrameworkReferences)' != 'true') And ('$(TargetFrameworkIdentifier)' == '.NETFramework') And |
| 122 | + ('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)')"> |
| 123 | + |
| 124 | + <_SDKImplicitReference Include="@(_WpfCommonNetFxReference)" |
| 125 | + Condition="'$(UseWPF)' == 'true'"/> |
| 126 | + |
| 127 | + <_SDKImplicitReference Include="System.Windows.Forms" |
| 128 | + Condition="('$(UseWindowsForms)' == 'true') " /> |
| 129 | + |
| 130 | + <_SDKImplicitReference Include="WindowsFormsIntegration" |
| 131 | + Condition=" ('$(UseWindowsForms)' == 'true') And ('$(UseWPF)' == 'true') "/> |
92 | 132 | </ItemGroup> |
93 | 133 | </Project> |
0 commit comments