Xamarin.forms: custom iOS Renderers won't compile when using MSBuild.Sdk.Extras since 4.5.0.396

Created on 17 Mar 2020  路  6Comments  路  Source: xamarin/Xamarin.Forms

Description

In my Xamarin projects, I use the great MSBuild.Sdk.Extras package to be able to easily create multitargeted libraries. But since the latest Xamarin version, there seems to be a problem.
I am not sure if the problem is related to MSBuild.Sdk.Extras or Xamarin, although the previous version of Xamarin did work, so something must have changed.

The problem is related to transitive dependencies. I have 1 library where I reference Xamarin.Forms, my other libraries will reference that library, so they get the Xamarin.Forms library as a transitive dependency. (That way I only update 1 package, and all my related libraries will reference the correct Xamarin.Forms version)

in 4.5.0.396, for iOS it won't find the Xamarin.Forms.Platform.iOS namespace. So my custom renderers won't compile.
It does work for Android. (Haven't tested UWP)

Steps to Reproduce

  1. Clone https://github.com/MariovanZeist/XamRepro
  2. Compile

Expected Behavior

Both libraries compile.

Actual Behavior

The iOS version doesn't compile

Basic Information

  • Version with issue: V4.5.0.396
  • Last known good version: V4.5.0.356
  • IDE: VS2019 16.5.0
  • Platform Target Frameworks: iOS

Reproduction Link

https://github.com/MariovanZeist/XamRepro

Workaround

When referencing "Xamarin.Forms" Version="4.5.0.396" directly in the Xam.Controls library the library will compile.

regression in-progress bug

All 6 comments

@MariovanZeist to maintain backwards compatibility with VS 2017 we had to add some trickery into our forms.targets file

I'll need to look into seeing if we can make this work transitively with ios

@PureWeen
Not sure if it's related, but in the .nuspec/Xamarin.Forms.targets file at line 211 and 216, I think the hintpath will result in a path with a double \
$(MSBuildThisFileDirectory)XCODE10$(FrameworkDll)

I think $(MSBuildThisFileDirectory) already has a trailing

I saw this when I was rummaging through a MSBuild log when investigating this issue.

4.5.0.396 is useless for me also...
Xamarin.Forms.Platform.iOS namespace don't exist.

@Jacko1394 If you reference Xamarin.Forms directly in the library that needs the Xamarin.Forms.Platform.iOS namespace it will work.

I will close this issue for now, as it seems to be fixed in the next release.
Will reopen when the problem persists.

Thanks @PureWeen

Verified fixed in version 4.5.0.530

Was this page helpful?
0 / 5 - 0 ratings