BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
<Target Name="ChangeAliases"BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(FileName)' == 'Syncfusion.Pdf.Portable'">
<Aliases>global,syncfusionPortable</Aliases>
</ReferencePath>
</ItemGroup>
</Target> |
extern alias syncfusionPortable;
//Create PDF document
syncfusionPortable::Syncfusion.Pdf.PdfDocument document = new syncfusionPortable::Syncfusion.Pdf.PdfDocument;
|
Hi Team,
As per your suggestion, creating Aliases works in one of my projects, where we added the references for the DLLs and used them with different Alias names.
However, I am facing an issue in a different WinForms ASPX project. In this project, we place the required DLL files in the bin folder and do not add them as explicit references in the project. I attempted to declare the alias directly in the project code as follows:
html
<% Import Namespace="SyncPortable::Syncfusion.Pdf.Portable" %>
However, this was not accepted. When I tried:
html
<% Import Namespace="SyncPortable::Syncfusion.Pdf" %>
it accepted the alias, but I encountered the same error:
'PdfLoadedDocument' exists in both 'Syncfusion.Pdf.Base' and 'Syncfusion.Pdf.Portable'.
I would appreciate your guidance on how to properly declare aliases or avoid conflicts in a scenario where I cannot add direct references to the libraries and must rely on placing the DLLs in the bin folder.
Looking forward to your assistance.
Best regards,
Chetan Raivadera
Hi Chetan,
While adding the above provided solution, the reported conflicts will not occurs. We have created the simple sample to illustrate this and please find the download link from below,
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfSample-1274997518
Please try the above sample in your end and let us know the result. If you are still facing an issue, we request you to share the modified sample with us. so that we can assist with you further in this.
Regards,
Irfana
Hi Irfana,
You have replied with the solution given earlier only.
I had mentioned clearly - that way it is working in .Net project, where in the References, I can give a separate named alias for the library instead of global from the properties. (you can refer the screenshot attached)
The other project I am talking about is a ASPX page, where I can keep the library in bin folder only and do not have option to change alias from references - properties.
Please provide a solution for this case.
Code Example:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading.Tasks" %>
<%@ Import Namespace="System.Security.Cryptography.X509Certificates" %>
<%@ Import Namespace="SyncBase=Syncfusion.Pdf" %>
"SyncBase= SyncBase=Syncfusion.Pdf.Portable" does not provide the portable library reference to the project and gives error as Portable is not available in Syncfusion.Pdf )
Code Example:
public string DoSignPDF(string SelCert, string SDHubConnectionId)
{
string inFileName = @"C:\Test\MultiPageTest.pdf";
string outFileName = @"C:\Test\AspxSignedPDF.pdf";
TxnRespWithFile txnResp = new TxnRespWithFile() { IsSuccess = true };
try
{
byte[] sourcefile = File.ReadAllBytes(inFileName);
SyncBase.Parsing.PdfLoadedDocument document = new SyncBase.Parsing.PdfLoadedDocument(sourcefile);
This gives the error:
The type 'PdfLoadedDocument' exists in both 'Syncfusion.Pdf.Base, Version=19.4460.0.56, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' and 'Syncfusion.Pdf.Portable, Version=26.1.40.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' 6_SignPDF.aspx
Awaiting a positive reply from you. Thankyou.
Hi Chetan,
We are currently checking your requirement to resolve the reported issue and we will provide the further details on or before October 29th, 2024.
Regards,
Irfana J.
Hi Chetan,
Thank you for bringing this issue to our attention. We understand that you are facing conflicts when using Syncfusion.Pdf.Base
and Syncfusion.Pdf.Portable
assemblies in your ASPX project. Unfortunately, due to the nature of ASPX projects and the lack of direct support for aliasing assemblies without a .csproj
file, there are inherent limitations that prevent us from resolving this conflict effectively. Due to this limitation, we cannot directly use both assemblies in the ASPX project.
Therefore, we recommend using only one of the packages based on your requirements. The Syncfusion.Pdf.Net.Core
package (Syncfusion.Pdf.Portable
) supports cross-platforms, and both assemblies offer almost the same set of features.
We request you to provide your exact requirements for using both platforms so that we can explore alternatives and provide you with a prompt solution.
Regards,
Irfana J.
Thankyou for the update
Irfana.
Regars,