We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Licence file not found when running C# Program via .exe in commandline

When running my program as an .exe file via commandline, when running these lines:


Aspose.Email.License license = new Aspose.Email.License();
license.SetLicense(“Aspose.Email.lic”);

I receive the following error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Aspose.Email, Version=17.5.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.
at ProcessPst.Program.Main(String[] args)

Not sure what I can do to fix this. I have tried embedding the .lic file etc but hasn’t helped. It works when you run via the C# console in debug mode but as soon as you try release it throws this error.

Any help would be much appreciated.
Cheers,
Vanessa
Hi Vanessa,

Thank you for your inquiry and sharing details.

We have investigated the issue at our end. We are unable to reproduce the issue. We have used the code snippet shared by you. Sample console application is attached for your reference. Please give it a try and share your feedback.

Hi,


I unzipped your program files. I replaced the .Total license with the .Email one. And then ran it via the .exe file in this location:
\SimpleConsole\SimpleConsole\obj\x86\Release\SimpleConsole.exe

And received the same error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Aspose.Email, Version=17.5.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.
at SimpleConsole.Program.Main(String[] args)

Perhaps I am not loading the library correctly? Could you provide step instructions for this if it is the case?

Thank you,
Vanessa

Hi Vanessa,


Please make sure that the license file, Aspose.Email dll and Exe file are located in the same folder. We placed all these files in the same folder and everything is working fine.