Issue with Relative Paths in SDK version 3.3.4

I hope you’re doing well. We’re currently working on integrating the latest version of your SDK and have encountered an issue related to the use of relative paths within the library.

for those files where in the library they should exist 3 folders back. where in our project the data folder would be in the same project binaries

  • 20210819_ZATCA_E-invoice_Validation_Rules.xsl
  • CEN-EN16931-UBL.xsl

What do you suggest as a solution for this ?

1 Like

Hi everyone,

I just wanted to follow up on my earlier post regarding the issue with relative paths in the SDK integration. I’m still trying to find a solution and would really appreciate any insights or suggestions you might have.

Thanks again for your time and help!

You release 3.3.5 but it still contains relative path issue which makes the integrations hard.

Any clarifications please

I’m guessing you’re talking about .Net8 Zatca.eInvoice.SDK.dll

From my testing, v3.3.5 requires external resources as you mentioned.

I did a little patch on .Net8 Zatca.eInvoice.SDK.dll for this issue

From this

relativePathKSA = @"..\..\..\Data\Rules\schematrons\20210819_ZATCA_E-invoice_Validation_Rules.xsl";
KSA_Schematrons = File.ReadAllText(Path.GetFullPath(Path.Combine(AppDomain.get_CurrentDomain().get_BaseDirectory(), relativePathKSA)));
relativePathEN = @"..\..\..\Data\Rules\schematrons\CEN-EN16931-UBL.xsl";
EN_Schematrons = File.ReadAllText(Path.GetFullPath(Path.Combine(AppDomain.get_CurrentDomain().get_BaseDirectory(), relativePathEN)));

to

relativePathKSA = @"Data\Rules\schematrons\20210819_ZATCA_E-invoice_Validation_Rules.xsl";
KSA_Schematrons = File.ReadAllText(Path.GetFullPath(Path.Combine(AppDomain.get_CurrentDomain().get_BaseDirectory(), relativePathKSA)));
relativePathEN = @"Data\Rules\schematrons\CEN-EN16931-UBL.xsl";
EN_Schematrons = File.ReadAllText(Path.GetFullPath(Path.Combine(AppDomain.get_CurrentDomain().get_BaseDirectory(), relativePathEN)));

and made sure all the required resources were copied to the location of the Exe file with

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
  <Exec Command="xcopy &quot;$(ProjectDir)ikvm&quot; &quot;$(TargetDir)ikvm\&quot; /E /I /Y" />
  <Exec Command="xcopy &quot;$(ProjectDir)Data&quot; &quot;$(TargetDir)Data\&quot; /E /I /Y" />
</Target>

<Target Name="PostPublish" AfterTargets="Publish">
  <Exec Command="xcopy &quot;$(ProjectDir)ikvm&quot; &quot;$(PublishDir)ikvm\&quot; /E /I /Y" />
  <Exec Command="xcopy &quot;$(ProjectDir)Data&quot; &quot;$(PublishDir)Data\&quot; /E /I /Y" />
</Target>

In my c# Project file.

Work well on Windows OS.
ikvm folder should from Test Folder zatca-einvoicing-sdk-238-R3.3.5\Lib\Dot-Net8\Test

Thank you so much for your reply, I just downloaded the SDK again but I didn’t find the dll you patched. May I know where I can get the patched dll

.NET 8 Zatca eInvoice SDK in Action (github.com)

I do not recommend this method.
I am just giving an example, how this relativePath problem can be solved.

Hopefully in the next release, external resources will no longer be needed like in Release v 3.3.3 for .NetFx4.0

So, what I understand from you is that only the releases in Announcements section are the final ones. and until that time we’re fine

There are many additional features in each release, so we should always follow the latest releases, to ensure that the invoices we send are in accordance with the rules applied by Zatca.

Ok, because the one here: zatca-einvoicing-sdk-238-R3.3.5 doesn’t include your patched file. and I noticed in the Announcements section you still didn’t announce the latest one.

Yes, I did my own patch, I modified Zatca.eInvoice.SDK.dll to solve the relativePath issue.

so, should I wait to the one from the link I mentioned earlier, or just use the one you gave me ? and if I have to wait

It’s up to you,

I’m sure the Developers have read this issue, and we should wait for the next release.

.Net8 Zatca.eInvoice.SDK actually has no problem, Signing document and validation works well.

But users have difficulty because they have to set the Data folder back 3 steps.

As you said

Dear @eCloud
For signing of invoice and hash generation do we need this folder in project ?

@anusv

Just clone the repository, build and run the code, it should work in your Windows PC.

Then you can see, how it works from the existing code sample.

Hello,
i am having the same issue when i publish the solution on docker, any ideas how can i fix it or patch it up ?

  • using ver 3.3.7 .net 8
  • added the dlls to my code and calling them from code