opened
TimLariviere
username_0
### Description

Starting v4.5.0, [Xamarin.Forms](https://www.nuget.org/packages/Xamarin.Forms/4.5.0.495) 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.
Could not detect any platforms from 'XCODE10' / 'XCODE11'
issue
created
vshapenko
username_1
Same for my project, looks like paket does not properly processes content inside the build folder of nuget package
comment
created
forki
username_2
What even is xcode10? Do we have similar?
comment
created
vshapenko
username_1
That 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.
comment
created
TimLariviere
username_0
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 @username_1, 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.
comment
created
forki
username_2
Can you please describe the workaround in detail? Thx
comment
created
vshapenko
username_1
@username_2  , does paket processes .props and .targets files from 'build'  folder?
comment
created
TimLariviere
username_0
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:
https://github.com/username_0/FabulousPlanets/commit/e5e8b6e39f9343896d91fc427decd9b0d94a61e1#diff-b5787cbb1a1fa09cbd9f445d240677dc
comment
created
vshapenko
username_1
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.
comment
created
forki
username_2
https://github.com/fsprojects/Paket/pull/3830
comment
created
forki
username_2
Please try with 6.0.0-alpha025
comment
created
TimLariviere
username_0
@username_2 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.
```
comment
created
forki
username_2
can you please upload a zip with a small sample?
comment
created
TimLariviere
username_0
[Sample-Paket-XCode.zip](https://github.com/fsprojects/Paket/files/4551968/Sample-Paket-XCode.zip)

I created 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).
comment
created
vshapenko
username_1
\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.
comment
created
forki
username_2
ok I pushed another fix. It's no longer complaining.

But which props and targets file from the sample should it import exactly?
comment
created
TimLariviere
username_0
@username_2 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?
comment
created
vshapenko
username_1
@username_2 , 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 <packagename>.props at the beginning of project file, put <packagename>.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 <tfm>/<packagename>.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 [Here](url) is more detailed and full information about possible folder names and their behaviour.
comment