问题描述
我有一个核心项目,即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中。
该如何解决?有人知道吗预先感谢!
解决方法
我们可以通过为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>
在添加上述解决方案时,将不会发生所报告的冲突。我们创建了一个简单的示例来说明这一点,请从下面找到下载链接,