Msbuild: MSBuild cannot build Xamarin.Android referencing a netstandard base library if the library contains a NuGet reference

Created on 10 Oct 2017  路  13Comments  路  Source: dotnet/msbuild

For details see the original bug here in the Xamarin bug tracker, which also includes a minimal repro example confirmed by @dellis1972. To summarise: There will be compilation error if a Xamarin.Android project uses a netstandard project as a base class library and this library calls a method of a NuGet package. The iOs build builds but would fail at runtime since the NuGet dll is missing.

Most helpful comment

@terrajobst There is no progress/feedback on this .Net Standard issue (and the originally raised Xamarin Bug here is also dead) but more and more people are still demanding a solution or at least a rough date of when this will get fixed. Can you clarify the status please?

All 13 comments

I'm having the same issue.

I am having the same issue. Is there any information on this?

@terrajobst There is no progress/feedback on this .Net Standard issue (and the originally raised Xamarin Bug here is also dead) but more and more people are still demanding a solution or at least a rough date of when this will get fixed. Can you clarify the status please?

ping

@rainersigwald Why is the community not getting a statement on this issue from the MSFT side with details such as if and when a fix is anticipated?

Looks like you just need to add your nuget packages to your Android project so they are properly compiled. It is always best practice to add nugets to all projects that need them and their base. Sometimes there is platform specific implementations that need them.

I second this. Using many nuget packages in your net standard project results in dependency hell! An update would be great!

I'm honestly rather surprised that issues like this stay open in a commercial product. I've spent over a day tracking down this bug in setting up a Xamarin POC (as we evaluate it's use for a project).

For what it's worth, this appears to also affect iOS now. Instead of showing up as a build failure like with Android, you instead get a runtime error complaining about the missing package.

Any progress on this?

I recently stumbled over this same issue. My solution was migrating the target platforms to use nuget references instead of the package config file. Here a link to the official docs, I also wrote this blog post to point some of my colleagues to, maybe this will also be of help to someone else.

HTH

@mallibone Thanks, that actually worked!

Sounds like the solution here is to move to PackageReference.

@rainersigwald Not sure if it has changed but at the time Xamarin projects did not support PackageReference

Was this page helpful?
0 / 5 - 0 ratings