dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

[MSBuildExtras] Using msbuild extras under linux fails with missing Microsoft.WinFX.props #11108

Open jeromelaban opened 4 years ago

jeromelaban commented 4 years ago

MSBuild extras validates that projects can successfully build under a variety of .NET Runtimes and OSes, and a recent addition of validation of .NET Core 3.1 fails the build under Linux with the following error:

/__t/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.props(208,3): 
error MSB4019: The imported project "/__t/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFX.props" was not found. 
Confirm that the expression in the Import declaration "Microsoft.WinFX.props" is correct, and that the file exists on disk.

This error does not happen with .NET Core 3.0 and 2.2.

The error happens when building this project, with this script.

dsplaisted commented 4 years ago

This seems like either an issue with MSBuildExtras itself, or just a limitation of the fact that building projects targeting UAP isn't supported on Linux.

FYI @clairernovotny

mfkl commented 4 years ago

just a limitation of the fact that building projects targeting UAP isn't supported on Linux.

That's not it, you can reproduce with just

<Project Sdk="MSBuild.Sdk.Extras">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
    </PropertyGroup>
</Project>
jeromelaban commented 4 years ago

This error is caused by a casing issue, where the import here:

https://github.com/dotnet/wpf/blob/165948b449e9de9fbba9843c2695f32a3212158f/packaging/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.props#L208

Does not match the casing in this folder:

gitpod@ws-XXX:/workspace/uno$ ll /usr/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets
total 72
drwxr-xr-x 2 root root  4096 Mar 18 17:39 ./
drwxr-xr-x 5 root root  4096 Mar 18 17:39 ../
-rw-r--r-- 1 root root 11191 Feb 28 17:55 Microsoft.NET.Sdk.WindowsDesktop.props
-rw-r--r-- 1 root root  6543 Feb 28 17:55 Microsoft.NET.Sdk.WindowsDesktop.targets
-rw-r--r-- 1 root root  1482 Feb 28 17:55 Microsoft.WinFx.props
-rw-r--r-- 1 root root 40124 Feb 28 17:55 Microsoft.WinFx.targets
Nirmal4G commented 4 years ago

The Fix is here: dotnet/wpf#2975

ermshiperete commented 4 years ago

Still happening even with the merged fix (SDK 3.1.302)

ermshiperete commented 4 years ago

This got fixed in https://github.com/dotnet/wpf/commit/b198dcfba5ad68db829dadc4637e244129a3c23b - or at least the failing line removed in that commit.

Nirmal4G commented 4 years ago

It seems the fix is not merged into SDK 3.1.302! So, I've asked whether it is possible for back porting the fix into 3.1.

worldbeater commented 4 years ago

The workaround implemented by Jerome in https://github.com/unoplatform/docker/pull/4/commits/8e13b5b5f68ccc082048913dac88bc86ffe6006b finally made it possible to use MsBuild.Sdk.Extras with .NET Core 3.1 on my Linux machine! Posting this message here for dumb people like me who didn't notice this easy workaround when viewing the issue for the first time. Thank you @jeromelaban! <3

moljac commented 2 years ago

still issue in 3.1.421

fixed with:

sudo \
    cp \
    /usr/local/share/dotnet/sdk/3.1.421/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFx.props \
    /usr/local/share/dotnet/sdk/3.1.421/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFX.props