How to Include DLL Files in ZennoPoster Project for Easy Sharing?

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
134
Благодарностей
35
Баллы
28
Hello everyone,

How to Include DLL Files in ZennoPoster Project for Easy Sharing?

I'm currently working on a project in ZennoPoster that uses external Sharp libraries (HtmlAgilityPack.dll).
To make it work, I've manually installed the necessary DLL file. Now, I want to share my project with a friend, but I would like to avoid them having to manually install this DLL file.

Is there a way to directly include the DLL file within my ZennoPoster project, so when I share it, the DLL comes with it and my friend doesn't need to install anything extra? I read through the official ZennoLab documentation but couldn't find anything about embedding DLL files directly into a project.
For the moment included in the project zp file and the dll in a zip file but the main idea is to already link the dll file!


Could anyone guide me on how to achieve this or point me to any resources that might help?

Thank you in advance for your help!
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Not sure what you mean with installing, but No, you can't include .dll into .zp file, since external assemblies have to be added in an External Assembly folder, it's global for a whole zenno and not for one project.
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
134
Благодарностей
35
Баллы
28
Not sure what you mean with installing, but No, you can't include .dll into .zp file, since external assemblies have to be added in an External Assembly folder, it's global for a whole zenno and not for one project.
Thank for your reply,
yes i was not very clear,
and you right is not about installation but more copy the dll in Eternal assembly

since external assemblies have to be added in an External Assembly folder

That this operation i would to avoid.
So because i join the DLL fill in my ZIP file who inclued the Project file (ZP),
and as you can see i already link by GAC,



118155


118156


i just would like to automatise the action to add this dll when i share my project:

118157



It is just a small thing to do, but i wonder if it is possible to do!

Thank again!
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Copy one file into External Assemblies folder takes what 10 seconds?
I spent 5 times more answering already. :dy:
You will spend a hour to develop some logic for this.

Just curious how this makes sense to You?
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
134
Благодарностей
35
Баллы
28
Copy one file into External Assemblies folder takes what 10 seconds?
I spent 5 times more answering already. :dy:
You will spend a hour to develop some logic for this.

Just curious how this makes sense to You?

I got your point and like i said it just small thing,
but i was wondering if there is a way to by pass this move,
because i made a template where you nothing to set up for a beginner friend : profile, cookies, list, tab...

And this is only step who need to be manually done,
so i wanted to remove it;-)
To get a easy & perfect "one click" project;-)
 
Последнее редактирование:

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
I see, anyway, my brain does not work with non-logical stuff :D Therefore i have no idea.

But if i would have to make some commercial product with many users are using it and i would need the best user experience, I would probably host files on my server and download all necessary data, files or anything else from there as project starts.

Another idea to explore would be to convert file to text and back. Example: c# - Converting file into Base64String and back again - Stack Overflow
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
134
Благодарностей
35
Баллы
28
I really appreciate the patience and guidance you've offered.
I spent one hour to find a way for a 'one click' button to bypass this 10-second task and Yes in a way it is "non logical stuff"

In fact, it was more of a way for me to learn "new skills", like using PowerShell, "execute as admin" and batch files : I see it as a valuable learning curve because i start from 0!
So Next time, I'll be able to do it in 2 minutes by using the same files and just modifying the DLL name.
And also for many other automation!

Here's what I accomplished step by step:

  1. PowerShell Scripting: I created a PowerShell script that handles the dynamic location and copying of the HtmlAgilityPack.dll file. This script is smart enough to find its way around the user's directory and place the DLL file exactly where it needs to be within the ZennoPoster project structure by checking the last version installed.
  2. Batch File Creation: To simplify the process, I crafted a batch file that serves as a launcher, executing the PowerShell script with administrative rights. No more manual copying—the batch file does the heavy lifting.
  3. Shortcut Automation: The real trick was to automate the creation of a shortcut that not only points to the PowerShell script but also ensures it runs with admin privileges right off the bat. This was the key to achieving the "one-click" experience I was aiming for.
To wrap it up, yes, I might have made things more complicated for myself this time, but it was all in the spirit of learning.
Now I have a handy script that I can reuse and adapt for future needs. It's like the old saying,
"Give a man a fish, and you feed him for a day. Teach a man to fish, and you feed him for a lifetime." I've learned to fish, and it feels great!

Thank you once again for @lokiys for your patience!

118183



my bat file :


Код:
@echo off
setlocal

rem Get the current directory where this batch script is located.
set "CurrentDir=%~dp0"

rem Clean up the path to remove the trailing backslash.
set "CurrentDir=%CurrentDir:~0,-1%"

rem Create the full path of the PowerShell script you want to execute.
set "PowerShellScript=%CurrentDir%\CopyDLLToZenno.ps1"

rem Set the name of the shortcut you want to create.
set "ShortcutPath=%CurrentDir%\CopyDLLToZenno.lnk"

rem Use PowerShell to create the shortcut with the full path of the script.
powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%ShortcutPath%'); $s.TargetPath = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; $s.Arguments = '-NoExit -ExecutionPolicy Bypass -File ""%PowerShellScript%""'; $s.WorkingDirectory = '%CurrentDir%'; $s.Save(); $bytes = [System.IO.File]::ReadAllBytes('%ShortcutPath%'); $bytes[0x15] = $bytes[0x15] -bor 0x20; [System.IO.File]::WriteAllBytes('%ShortcutPath%', $bytes);"

rem Launch the created shortcut
start "" "%ShortcutPath%"

echo Shortcut created successfully: %ShortcutPath%
pause
 
  • Спасибо
Реакции: lokiys

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)