0

Context: I want to create a nuget for both Xamarin.Android and Xamarin.iOS. Aside the dll nuget, for the Android project I need a xml file to be copied to a certain location which for some strange reason.

Problem: The xml file gets copied for Xamarin.iOS, but not for the Xamarin.Android when nuget is installed and I don't understand why. I have the following line in the nuspec:

<files>
<file src="ProjectName.Droid\bin\Debug\ProjectName.Droid.dll" target="lib\MonoAndroid10\ProjectName.dll" />
<file src="ProjectName.Droid\bin\Debug\ProjectName.Droid.pdb" target="lib\MonoAndroid10\ProjectName.Droid.pdb" />
<file src="ProjectName.Droid\Resources\values\attrs.xml" target="content\MonoAndroid10\Resources\values\attrs.xml" />
<file src="ProjectName.Touch\bin\iPhoneSimulator\Debug\ProjectName.Touch.dll" target="lib\Xamarin.iOS1.0\XBottomSheet.Touch.dll" />
<file src="ProjectName.Touch\bin\iPhoneSimulator\Debug\ProjectName.Touch.pdb" target="lib\Xamarin.iOS1.0\ProjectName.Touch.pdb" />

The strange part is that if I remove the "MonoAndroid10" the file gets added to the iOS project, but not to the Android one. After I add it, neither of them sees it. I've also looked over how this is set: https://github.com/jamesmontemagno/SettingsPlugin/blob/master/nuget/Plugin.nuspec but I think it looks the same, yet it has different behaviour.

Any clue why is this happening? If something is not explained well, please ask and I'll come with details. It really bothers me that it keeps me stuck.

Alexandru Stefan
  • 635
  • 1
  • 9
  • 22
  • 1
    Are all of your projects using `packages.config`? Because content is not supported when using `PackageReference`. Instead, they have `contentFiles`, but it [works differently](https://learn.microsoft.com/en-us/nuget/reference/nuspec#including-content-files). Also, have you looked at those docs? maybe it helps. Finally, `Xamarin.iOS` isn't listed as a [supported framework](https://learn.microsoft.com/en-us/nuget/reference/target-frameworks). Maybe the docs are wrong, but maybe it's related to your issue. – zivkan Dec 24 '18 at 17:59
  • You were indeed right!!! For some reason, from previous tests with the nuget, it was added as PackageReference. After removing that part and adding it again it worked like a charm. Thank you! – Alexandru Stefan Dec 25 '18 at 00:09

0 Answers0