fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

Could not detect any platforms from 'XCODE10' / 'XCODE11' #3816

Open TimLariviere opened 4 years ago

TimLariviere commented 4 years ago

Description

Starting v4.5.0, Xamarin.Forms added 2 new folders in their NuGet packages, under the folder build, named XCODE10 and XCODE11.

When installing this package with Paket, the following warnings appear:

Xamarin.Forms 4.5.0.495 unzipped to /Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.macOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.iOS.pdb', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.macOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.iOS.pdb', please tell the package authors
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.macOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.iOS.pdb', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.macOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/Fabulous/packages/androidapp/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.iOS.pdb', please tell the package authors

Repro steps

  1. Add a reference to Xamarin.Forms 4.5.0.495

    nuget Xamarin.Forms 4.5.0.495
  2. Run paket install

  3. Warnings about XCODE10 and XCODE11 should appear (see example above)

Expected behavior

I'm not exactly sure what these warnings mean, but I would expect no warning at all.

Actual behavior

Warnings are appearing.

Known workarounds

No workaround known.

vshapenko commented 4 years ago

Same for my project, looks like paket does not properly processes content inside the build folder of nuget package. Ios project does not build for now

forki commented 4 years ago

What even is xcode10? Do we have similar?

vshapenko commented 4 years ago

@forki ,it is xamarin forms magic. If we look inside xamarin.forms 4.5 nuget package,we find xcode 11 and xcode10 folder inside 'build' folder. Files there are very important to build an ios app. Honestly,i do not know,why xamarin team took such decision.

вс, 19 апр. 2020 г., 16:43 Steffen Forkmann notifications@github.com:

What even is xcode10? Do we have similar?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3816#issuecomment-616138003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKNDOW6BQLARMVY63HCIIDRNL5Y3ANCNFSM4LUHCVSQ .

TimLariviere commented 4 years ago

I noticed that an assembly named Xamarin.Forms.Platform.iOS (containing iOS-specific code - same with macOS) which was previously under lib\Xamarin.iOS10 has been removed and replaced by 2 other ones under build\XCode10 and build\XCode11.

I'm guessing the Xamarin.Forms team had to provide dlls specifically compatible with the XCode version you have installed on your mac.

Like @vshapenko, some of my iOS projects managed by Paket failed to build once updated by Paket. They were missing links to Xamarin.Forms.props and Xamarin.Forms.targets, for some reasons. Those files are at the root of the build directory. Once I added the links manually, the projects built correctly.

The targets file automatically chooses the appropriate XCode10/11 dll, so I don't think it really concerns Paket.

forki commented 4 years ago

Can you please describe the workaround in detail? Thx

Timothé Larivière notifications@github.com schrieb am So., 19. Apr. 2020, 16:02:

I noticed that an assembly named Xamarin.Forms.Platform.iOS (containing iOS-specific code - same with macOS) which was previously under lib\Xamarin.iOS10 has been removed and replaced by 2 other ones under build\XCode10 and build\XCode11.

I'm guessing the Xamarin.Forms team had to provide dlls specifically compatible with the XCode version you have installed on your mac.

Like @vshapenko https://github.com/vshapenko, some of my iOS projects managed by Paket failed to build once updated by Paket. They were missing links to Xamarin.Forms.props and Xamarin.Forms.targets, for some reasons. Those files are at the root of the build directory. Once I added the links manually, the projects built correctly.

The targets file automatically chooses the appropriate XCode10/11 dll, so I don't think it really concerns Paket.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3816#issuecomment-616142031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOANF6H77CS4IS3K6IEFDRNL76ZANCNFSM4LUHCVSQ .

vshapenko commented 4 years ago

@forki , does paket process .props and .targets files from 'build' folder?

TimLariviere commented 4 years ago

Workaround of the build issue once upgrading to Xamarin.Forms 4.5.0.396 or newer:

After running paket install, Paket should have removed the reference to Xamarin.Forms.Platform.iOS.dll inside the iOS fsproj file.

To be able to continue building your iOS (or macOS) project, you'll need to do the following:

For reference, see this commit: https://github.com/TimLariviere/FabulousPlanets/commit/e5e8b6e39f9343896d91fc427decd9b0d94a61e1#diff-b5787cbb1a1fa09cbd9f445d240677dc

vshapenko commented 4 years ago

Ok, after some deep dive into paket sources, i think i can identify the problem: InstallModel.fs, part there we parse build folder. According to nuspec : https://docs.microsoft.com/ru-ru/nuget/create-packages/creating-a-package#include-msbuild-props-and-targets-in-a-package props and targets files from build folder should be included in project. However, paket just scans subfolders for dll with proper tfm, and it works not in 100% cases, as we can see.

forki commented 4 years ago

https://github.com/fsprojects/Paket/pull/3830

forki commented 4 years ago

Please try with 6.0.0-alpha025

TimLariviere commented 4 years ago

@forki I'm still having the issue with the following paket.dependencies.

version 6.0.0-alpha025
framework xamarinios
source https://www.nuget.org/api/v2
nuget Xamarin.Forms ~> 4.5.0
timothelariviere@Timothes-MacBook-Pro FabulousPlanets % mono .paket/paket.exe install
Paket version 6.0.0-alpha025
Resolving packages for group Main:
 - Xamarin.Forms 4.5.0.657+219-sha.3d0108ce6-azdo.3648568
Locked version resolution written to /Users/timothelariviere/Git/GitHub/FabulousPlanets/paket.lock
Installing into projects:
 - Creating model and downloading packages.
Could not detect any platforms from 'XCODE10' in '/Users/timothelariviere/Git/GitHub/FabulousPlanets/packages/Xamarin.Forms/build/XCODE10/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
Could not detect any platforms from 'XCODE11' in '/Users/timothelariviere/Git/GitHub/FabulousPlanets/packages/Xamarin.Forms/build/XCODE11/Xamarin.Forms.Platform.iOS.dll', please tell the package authors
 - Installing for projects
   - FabulousPlanets.Android/paket.references -> FabulousPlanets.Android/FabulousPlanets.Android.fsproj
   - FabulousPlanets.iOS/paket.references -> FabulousPlanets.iOS/FabulousPlanets.iOS.fsproj
   - FabulousPlanets/paket.references -> FabulousPlanets/FabulousPlanets.fsproj
F# project /Users/timothelariviere/Git/GitHub/FabulousPlanets/FabulousPlanets/FabulousPlanets.fsproj does not reference FSharp.Core.
Performance:
 - Resolver: 4 seconds (1 runs)
    - Runtime: 115 milliseconds
    - Blocked (retrieving package details): 504 milliseconds (1 times)
    - Blocked (retrieving package versions): 3 seconds (1 times)
 - Disk IO: 671 milliseconds
 - Average Request Time: 1 second
 - Number of Requests: 3
 - Runtime: 5 seconds
Paket omitted 10 warnings similar to the ones above. You can see them in verbose mode.
forki commented 4 years ago

can you please upload a zip with a small sample?

TimLariviere commented 4 years ago

Sample-Paket-XCode.zip

I created it with the default Xamarin iOS template and added Xamarin.Forms 4.5.0 via paket install (magic mode).

If you remove paket.lock and run paket install (mono paket.exe install on macOS), you'll see the warnings and also #3831 (the Xamarin.Forms.targets/props is not imported in the csproj by Paket).

vshapenko commented 4 years ago

Ok. to clearify the problem little bit: According to nuget spec here, build folder is suited for storing build and props targets for different tfms(or global ones):

Files in the root \build folder are considered suitable for all target frameworks. To provide framework-specific files, first place them within appropriate subfolders, such as the following: \build \netstandard1.4 \Contoso.Utility.UsefulStuff.props \Contoso.Utility.UsefulStuff.targets \net462 \Contoso.Utility.UsefulStuff.props \Contoso.Utility.UsefulStuff.targets

So, the proper algorithm would be following:

  1. Determine tfm in project we add nuget package to
  2. search build folder for either global props and targets or for tfm/.build or .props
  3. Include search results into the project file.
  4. import_targets flag looks useless, because setting it false breaks the expected behavior for nuget package and does not include important parts of package into project.
  5. Dll files from build folder should not be included as project references (i hope paket follows this rule).

Sorry for being some rude, but i have problems with clean and proper description of issues.

forki commented 4 years ago

ok I pushed another fix. It's no longer complaining.

But which props and targets file from the sample should it import exactly?

TimLariviere commented 4 years ago

@forki I confirm that the warnings disappeared with 6.0.0-alpha027.

For the props/targets, Xamarin.Forms requires to import both build\Xamarin.Forms.props and build\Xamarin.Forms.targets (inside Xamarin.Forms NuGet package) in order to compile. It's these files that import the dlls from the XCODE10/XCODE11 folders.

Note that build\Xamarin.Forms.DefaultItems.props is imported by build\Xamarin.Forms.props, same with targets. So I guess a props/targets file inside the build folder with the same name as the package is meant to be imported by default?

vshapenko commented 4 years ago

@forki , if we look into the srtucture of directory build, we will see the following:

We need to put .props at the beginning of project file, put .targets to the end of project file. But before we do this, we should scan folders for props and targets for tfm related files, i.e. there may be /.props, which we should take instead root props file. Important: Only props and targets should be taken, neither dll or other one. Name of file should match the package name. P.,S. There can be a buildMultitarget directory in package :

MSBuild .props and .targets files for cross-framework targeting can be placed in the \buildMultiTargeting folder. During package installation, NuGet adds the corresponding <Import> elements to the project file with the condition, that the target framework is not set (the MSBuild property $(TargetFramework) must be empty).

P.S.S https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#from-a-convention-based-working-directory is more detailed and full information about possible folder names and their behaviour.