Syncfusion.Pdf.Base和Syncfusion.Pdf.Portable-同一代码中的不同程序集

问题描述

我有一个核心项目,即Visual中的CodeShareProject类型,其他项目也会使用。

其他项目包括:Xamarin Mobile App和桌面上的WinForms。

Xamarin App使用程序集Syncfusion.Pdf.Portable(来自Syncfusion.Xamarin.Pdf)生成pdf,而台式机应用程序使用程序集Syncfusion.Pdf.Base(来自Syncfusion.WinForms.Pdf)。

然后我有冲突,因为例如PdfDocument都在Syncfusion.Pdf.Base和Syncfusion.Pdf.Portable中。

Screenshot

该如何解决?有人知道吗预先感谢!

解决方法

我们可以通过为dll“ Syncfusion.Pdf.Portable.dll”添加“别名”来克服上述问题。请参考下面的代码以供参考,

.CSProj文件更改

git commit --allow-empty -m "This is another commit in my pull request"
git push origin patch-1

在您的类文件中添加以下名称空间:

<Target Name="ChangeAliases"BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences"> 
<ItemGroup> 
  <ReferencePath Condition="'%(FileName)' == 'Syncfusion.Pdf.Portable'">
   <Aliases>global,syncfusionPortable</Aliases>    
  </ReferencePath>    
</ItemGroup>    
</Target>  

在添加上述解决方案时,将不会发生所报告的冲突。我们创建了一个简单的示例来说明这一点,请从下面找到下载链接,

Download the sample here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...