Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error MSB4019: "Microsoft.WinFX.props" was not found #224

Open
mvanbeusekom opened this issue Apr 24, 2020 · 9 comments
Open

error MSB4019: "Microsoft.WinFX.props" was not found #224

mvanbeusekom opened this issue Apr 24, 2020 · 9 comments

Comments

@mvanbeusekom
Copy link

On my Ubuntu machine, I run into the error below when trying to compile a .NET Standard 2.0 class library using the MSBuild.Sdk.Extras package (if I switch back to the default Microsoft.NET.Sdk the error does't show):

error MSB4019: The imported project "/usr/share/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.

Steps to reproduce:

  1. Create a new project using dotnet new classlib;
  2. Update the project SDK in the .csproj file so it reads <Project Sdk="MSBuild.Sdk.Extras">;
  3. Add a new file called global.json to the root of the project with the following content:
{
  "msbuild-sdks": {
    "MSBuild.Sdk.Extras": "2.0.54"
  }
} 
  1. Restore all NuGet packages: dotnet restore
  2. Build the project with dotnet build

I have noticed that the Microsoft.WinFX.props file does exists but spelled with a lower case "x". For now a workaround is to simply rename the file:

sudo mv "/usr/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFx.props" "/usr/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFX.props"

Not sure this is the correct place for this issue. But it looks like the Microsoft.WinFX.props target is incorrectly referenced by the MSBuild.Sdk.Extras package since it is ment to be used fro WPF and WinForms projects which are not supported on Linux and MacOS. My assumption is this problem doesn't occur on MacOS since it doesn't use a case sensitive filesystem be default.

@moljac
Copy link

moljac commented May 7, 2020

Same here MacOSX (case sensitive) newly installed.

Google.Play.Services and AndroidX (Xamarin.Android) builds

diskutil info /

output:

   Device Identifier:         disk1s6
   Device Node:               /dev/disk1s6
   Whole:                     No
   Part of Whole:             disk1

   Volume Name:               MacOSX
   Mounted:                   Yes
   Mount Point:               /

   Partition Type:            41504653-0000-11AA-AA11-00306543ECAC
   File System Personality:   Case-sensitive APFS
   Type (Bundle):             apfs
   Name (User Visible):       APFS (Case-sensitive)
   Owners:                    Enabled

Workaround:

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

@Nirmal4G
Copy link
Contributor

Expected someone should've hit this.

The Fix is here: dotnet/wpf#2975

@moljac
Copy link

moljac commented May 11, 2020

@Nirmal4G

You fixed WPF, but what about other projects?

Solution is to add tests on Mac case sensitive APFS as early as possible. Xamarin.Android team is quite safe regarding to this problem, because some of the team members are working on Linux which is case sensitive by default.
This issue might impact other teams.

@Nirmal4G
Copy link
Contributor

Nirmal4G commented May 11, 2020

@moljac dotnet/wpf#2975 (comment)

You fixed WPF, but what about other projects?

If there are any other targets that are in incorrect case, please let me know. For now, your workaround to rename the file is the solution.
You can also report to the appropriate team, if it's not open source OR You can also create issue/PR in the repos which host the targets.

@moljac
Copy link

moljac commented May 11, 2020

@Nirmal4G

I'm on Xamarin.Android team and detected this "by accident". Who would install case sensitive filesystem support, but crazy bored guy... And I did.
We discovered few issues in our builds, but this maybe should be fixed here.

And maybe case sensitive tests could be added.

@Nirmal4G
Copy link
Contributor

@moljac

Yeah, on the other hand, tests should be added. For the fix, we could conditionally import the desktop sdk targets.

@clairernovotny
Copy link
Collaborator

We already do conditionally detect and import the desktop sdk targets:

https://github.com/novotnyllc/MSBuildSdkExtras/blob/master/Source/MSBuild.Sdk.Extras/Sdk/Sdk.props#L9-L26

@Nirmal4G
Copy link
Contributor

I meant the WinFX targets.

Since, we always import the desktop Sdk props/targets which in turn imports the WinFX targets with incorrect casing and that'll fail in case sensitive OS / file systems.

@jeremyVignelles
Copy link

Duplicate of #207 ? See dotnet/sdk#11108

AArnott added a commit to AArnott/PCLCrypto that referenced this issue Aug 16, 2020
We can't build off Windows anyway due to: novotnyllc/MSBuildSdkExtras#224
AArnott added a commit to AArnott/PCLCrypto that referenced this issue Aug 16, 2020
We can't build off Windows anyway due to: novotnyllc/MSBuildSdkExtras#224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants