Starting my programm on a Diffrent PC i get a error message

Hi Andreas,

Try this:

  • Uninstall GemBox.Bundle package.

  • Download GemBox.Spreadsheet.dll from the bugfixes page (version 49.0.35.1274): GemBox.Spreadsheet Bug Fixes

  • Add the GemBox.Spreadsheet.dll to some folder inside your project and mark it as Embedded Resource (from Visual Studio select the GemBox.Spreadsheet.dll file, go to the properties window, and set “Build Action” to “Embedded Resource”).

  • Add a reference to that GemBox.Spreadsheet.dll file (from Visual Studio right-click your project and then Add → Reference → Browse).

  • As a result, you should have something like this inside your CSPROJ file:

  <ItemGroup>
    <Reference Include="GemBox.Spreadsheet">
      <HintPath>MyFolder\GemBox.Spreadsheet.dll</HintPath>
    </Reference>
  </ItemGroup>

...

  <ItemGroup>
    <EmbeddedResource Include="MyFolder\GemBox.Spreadsheet.dll" />
  </ItemGroup>
  • After that, handle the AddDomain.AssemblyResolve event, for example like this:
namespace MyApplication
{
    public partial class Form1 : Form
    {
        static Form1()
        {
            // Used for debugging (finding out) embedded resource names.
            //var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();

            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
        }

        private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs e)
        {
            if (e.Name != null && e.Name.Contains("GemBox.Spreadsheet"))
            {
                // IMPORTANT: change the "resourceLocation" to match the GemBox.Spreadsheet.dll location in your application.
                // To see what is the correct value, uncomment the above commented line of code
                // and find the GemBox.Spreadsheet.dll item in "resourceNames" array.
                string resourceLocation = "MyApplication.MyFolder.GemBox.Spreadsheet.dll";

                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceLocation))
                {
                    var data = new byte[stream.Length];
                    stream.Read(data, 0, data.Length);
                    return Assembly.Load(data);
                }
            }

            return null;
        }

        public Form1()
        {
            // Put your license key here.
            SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
            InitializeComponent();
        }

        // ...
    }
}

I hope this helps.

Regards,
Mario

1 Like