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

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

Open
TimLariviere opened this issue Mar 26, 2020 · 17 comments
Open

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

TimLariviere opened this issue Mar 26, 2020 · 17 comments

Comments

@TimLariviere
Copy link
Member

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
  1. Run paket install

  2. 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
Copy link

vshapenko commented Apr 19, 2020

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
Copy link
Member

forki commented Apr 19, 2020

What even is xcode10? Do we have similar?

@vshapenko
Copy link

vshapenko commented Apr 19, 2020 via email

@TimLariviere
Copy link
Member Author

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
Copy link
Member

forki commented Apr 19, 2020 via email

@vshapenko
Copy link

vshapenko commented Apr 19, 2020

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

@TimLariviere
Copy link
Member Author

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:

  • Add this line at the start of the iOS fsproj file, after the <Project> start tag
<Import Project="..\packages\Xamarin.Forms\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms\build\Xamarin.Forms.props')" />
  • Add this line at the endof the iOS fsproj file, before the </Project> end tag
<Import Project="..\packages\Xamarin.Forms\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms\build\Xamarin.Forms.targets')" />

For reference, see this commit:
TimLariviere/FabulousPlanets@e5e8b6e#diff-b5787cbb1a1fa09cbd9f445d240677dc

@vshapenko
Copy link

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 added a commit that referenced this issue Apr 20, 2020
@forki
Copy link
Member

forki commented Apr 20, 2020

#3830

@forki
Copy link
Member

forki commented Apr 28, 2020

Please try with 6.0.0-alpha025

@TimLariviere
Copy link
Member Author

@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
Copy link
Member

forki commented Apr 29, 2020

can you please upload a zip with a small sample?

@TimLariviere
Copy link
Member Author

TimLariviere commented Apr 29, 2020

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
Copy link

vshapenko commented May 1, 2020

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
Copy link
Member

forki commented May 2, 2020

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

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

@TimLariviere
Copy link
Member Author

@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
Copy link

vshapenko commented May 3, 2020

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

  • Xamarin.Forms.props
    -Xamarin.Forms.targets
    -Xamarin.Forms.Default.props
    -Xamarin.Forms.Default.targets
    MonoAndroid10
    net46
    netstandard2.0
    XCODE10
    XCODE11\

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.

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

3 participants