I am using scitersharp with WinForms and trying to build a single standalone compiled c# executable. It's a simple "Hello World" app which loads an HTML file. Initially after compilation 3 DLLs (sciter.dll, sciter64.dll and SciterSharpWindows.dll) were being generated in the bin\Debug folder. So, i googled and tried to find a solution to embed those dll files into the executable. Here is what i tried:
Loading the DLL in project window in visual studio and setting the build option as "Embedded resource"
Add references to the resources but this method didn't worked and it's giving me the following error:
`A reference to resource 'pathto\sciter.dll' could not be added. Please make sure the file is accesible and that it is a valid assembly or COM component`
Read the solutions from this stackoverflow question
Installed Cosutra.Fody package and rebuild the project. This time i managed to embed only the SciterSharpWindows.dll
Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sciter;
using SciterSharp;
using SciterSharp.WinForms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
// Create a class-accesible sciter control
private SciterControl SciterElement;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Create a new instance of the sciter control
SciterElement = new SciterControl();
// Set the callback once the element is ready to be used
SciterElement.HandleCreated += SciterControl1_HandleCreated;
// Add the Sciter Control to the Form and fill it
this.Controls.Add(SciterElement);
SciterElement.Dock = DockStyle.Fill;
}
private void SciterControl1_HandleCreated(object sender, EventArgs e)
{
// Initialize with some HTML
SciterElement.SciterWnd.LoadHtml(@"
<div style='padding: 0px 8px;'>
<h1>
Hello World
</h1>
</div>
");
}
}
}
Is there any way to embed these resources into the executable? Also, please let me know if i am missing something? Thank you in advance.