- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Closed
Description
- .NET Core Version: 3.0 Preview 2
 - Windows version: (
winver): N/A, build time error - Does the bug reproduce also in WPF for .NET Framework 4.8?: N/A
 
Problem description:
If a project targets netcoreapp1.x or netcoreapp2.x in addition to netcoreapp3.0, and uses WindowsDesktop SDK in order to use WPF conditionally on 3.0, it fails to build. (Importing SDKs conditionally is possible, but difficult to get right and hard to maintain.)
The implicit framework reference is conditioned only on TargetFrameworkIdentifier being .NETCoreApp. It ignores TargetFrameworkVersion.
Minimal repro:
dotnet build this:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
   <TargetFrameworks>netcoreapp1.0;netcoreapp3.0</TargetFrameworks>
   <UseWPF Condition="'$(TargetFramework)' == 'netcoreapp3.0'">true</UseWPF>
  </PropertyGroup>
</Project>Actual behavior:
error NETSDK1073: The FrameworkReference 'Microsoft.WindowsDesktop.App' was not recognized
Expected behavior:
Successful build
AArnott
Metadata
Metadata
Assignees
Labels
BugProduct bug (most likely)Product bug (most likely)