サードパーティの SDK に依存する Winforms アプリケーションがあります。アプリケーションに .NET 参照を含めましたが、常に必要または使用するとは限りません。DLL のないマシンでプログラムを実行しようとすると、まったく開かれませんMain
。
参照は可能ですが、必要な場合にのみ DLL をロードするように指示することはできますか?
(PDFSharp (私が使用している別のリファレンス) は、PdfSharp メソッドが呼び出されたときにのみ読み込まれるように見えます。これは、私が制御できるものであるかどうか疑問に思います。)
編集Program
...クラスにサードパーティの参照は表示されませんが、念のために次のとおりです。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MyProgram
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
Application.Run(new Main(args));
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message, "The program has quit :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
string TracefileContents = "Please email this file to some@body.com\n\n" + "Exception:\n" + Ex.Message + "\n\nStack trace:\n" + Ex.StackTrace.ToString();
System.IO.File.WriteAllText("Issue Report " + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".dat", TracefileContents);
}
}
}
}