question

lht-0429 avatar image
0 Votes"
lht-0429 asked RobCaplan edited

Multi-targeting Library for Xamarin

Hi. I'm trying to create a multiple-targeting library for Xamarin(Android, IOS and UWP.) I examined project files of some multi-targeting xamarin libraries. (Such as Rg.Plugins.Popup, Xamarin.Essentials, MvvmCross) and edited the csproj file of my library(XamTemel.Ortak) like this.

 <Project Sdk="MSBuild.Sdk.Extras/3.0.22">
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;Xamarin.iOS10;monoandroid10.0;</TargetFrameworks>
     <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.17763;</TargetFrameworks>
     <DebugType>portable</DebugType>
     <Configurations>Debug;Release</Configurations>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT' ">
     <!-- sourcelink: Declare that the Repository URL can be published to NuSpec -->
     <PublishRepositoryUrl>true</PublishRepositoryUrl>
     <!-- sourcelink: Embed source files that are not tracked by the source control manager to the PDB -->
     <EmbedUntrackedSources>true</EmbedUntrackedSources>
     <!-- sourcelink: Include PDB in the built .nupkg -->
     <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
   </PropertyGroup>
   <ItemGroup>
     <Compile Remove="Platforms\**\*.cs" />
     <None Include="Platforms\**\*.cs" />
   </ItemGroup>
   <ItemGroup Condition=" $(TargetFramework.StartsWith('monoandroid')) ">
     <None Remove="Platforms\Android\**\*.cs" />
     <None Remove="Platforms\Xamarin\**\*.cs" />
     <Compile Include="Platforms\Android\**\*.cs" />
     <Compile Include="Platforms\Xamarin\**\*.cs" />
     <AndroidResource Include="Resources\**\*.xml" SubType="Designer" Generator="MSBuild:UpdateAndroidResources" />
     <AndroidResource Include="Resources\**\*.json" Generator="MSBuild:UpdateAndroidResources" />
   </ItemGroup>
    
   <ItemGroup>
     <PackageReference Include="ColorPicker.Xamarin.Forms" Version="1.3.4.11" />
   </ItemGroup>
    
    
 </Project>

As you can see I am going to put platform renderers in Platform/Android-IOS-UWP etc. Not this works fine on Android. But ColorPicker library gives me this error on UWP.

105145-available.png

I don't understand why it cannot find ColorPicker. Version number seems okay. What am i doing wrong?



Here is the sample solution.

https://drive.google.com/file/d/1PnqFyzDmTBom6GH9YVdbyBvNwikitYlC/view?usp=sharing



dotnet-xamarin
available.png (28.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@lht-0429 Did you try to add "ItemGroup Condition" for "uap"? <ItemGroup Condition=" $(TargetFramework.StartsWith('uap')) ">

0 Votes 0 ·

0 Answers