How to include static files in electron-packager published output folder? #694

Closed
opened 2026-01-29 16:46:09 +00:00 by claunia · 3 comments
Owner

Originally created by @SheltonAlves on GitHub (Sep 7, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Hi,

I have used ElectronNET.API(9.31.2) and ElectronNET.CLI(0.0.9) to build my .NET CORE (3.1) application.
For data saving in application I have used sqlite DB file into project and have added "CopyToOutputDirectory = Always" property and it gets copied in output directory when I build the project.
But when I package the project using electron command "electronize build /target win" exe is generated successfully at location "../../bin/Desktop" but does not have sqlite file in published exe output.

How do I include static files in publish output where exe package is built ??

Originally created by @SheltonAlves on GitHub (Sep 7, 2021). Originally assigned to: @GregorBiswanger on GitHub. Hi, I have used ElectronNET.API(9.31.2) and ElectronNET.CLI(0.0.9) to build my .NET CORE (3.1) application. For data saving in application I have used sqlite DB file into project and have added "CopyToOutputDirectory = Always" property and it gets copied in output directory when I build the project. But when I package the project using electron command "electronize build /target win" exe is generated successfully at location "../../bin/Desktop" but does not have sqlite file in published exe output. How do I include static files in publish output where exe package is built ??
claunia added the question label 2026-01-29 16:46:09 +00:00
Author
Owner

@safoxe commented on GitHub (Jan 10, 2022):

Hi @SheltonAlves,
Do you have "extraResources" section in your electron.manifest,json?
I think this StackOverflow question is related to yours.

@safoxe commented on GitHub (Jan 10, 2022): Hi @SheltonAlves, Do you have "extraResources" section in your electron.manifest,json? I think this [StackOverflow question](https://stackoverflow.com/questions/46022443/electron-how-to-add-external-files) is related to yours.
Author
Owner

@SheltonAlves commented on GitHub (Jan 11, 2022):

Thank you @safoxe for replying.
For adding static files into publish output folder I have used following code in my project csproj file. And during publish it copies the files from <Target> into output folder.

  <Target Name="CreateDBFileinOutput" AfterTargets="ComputeFilesToPublish">
    <Copy SourceFiles="SQLite.db" DestinationFolder="$(PublishDir)" />
  </Target>
@SheltonAlves commented on GitHub (Jan 11, 2022): Thank you @safoxe for replying. For adding static files into publish output folder I have used following code in my project csproj file. And during publish it copies the files from `<Target>` into output folder. ``` <Target Name="CreateDBFileinOutput" AfterTargets="ComputeFilesToPublish"> <Copy SourceFiles="SQLite.db" DestinationFolder="$(PublishDir)" /> </Target> ```
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#694