如何解决Xamarin 的多目标库
我正在尝试为 Xamarin(Android、IOS 和 UWP)创建一个多目标库。我检查了一些多目标 xamarin 库的项目文件。 (例如Rg.Plugins.Popup、Xamarin.Essentials、MvvmCross)并像这样编辑我的库(XamTemel.Ortak)的csproj文件。
<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>
正如你所看到的,我将把平台渲染器放在 Platform/Android-IOS-UWP 等中。这在 Android 上不能正常工作。但是 ColorPicker 库在 UWP 上给了我这个错误。
我不明白为什么它找不到 ColorPicker。版本号好像没问题。我做错了什么?
这是示例解决方案。
https://drive.google.com/file/d/1PnqFyzDmTBom6GH9YVdbyBvNwikitYlC/view?usp=sharing
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。