Sage 200:无法将许多 *.dll 文件添加到我的 visual studio c# 项目中以使 sage 200 的基本功能正常工作

Sage 200 : Could not add many *.dll files in to my visual studio c# project to make sage 200 basic functionality work

我正在尝试将大约 200 多个 dll 文件添加到我的 visual studio 项目 (sage 200 assemblies files),但是当我转到 Project -> Add Reference 部分并浏览文件时,它没有显示任何内容.我可以轻松浏览大约 30-50 个文件,但不能同时显示 100 多个文件。

有什么设置可以改变这个吗?或者是否有任何其他方法可以使 sage 200 C# 代码用于 connect/create customer/sale 发票等

其实没必要往项目里加那么多DLL。 Sage 200 有一些基本的 dll 文件可以添加到项目中,并且有 sage 200 SDK 支持的初始代码,这有助于从安装本身引用所有必需的程序集。

这是来自他们 documentation:

的示例代码

以下是编写源自 Sage.MMS.BaseForm 的基本 Sage 200 表格所需的最少参考资料。

  • Sage.Accounting.Common.Forms.dll
  • Sage.Common.Controls.dll
  • Sage.MMS.dll
  • System.Windows.Forms.dll

以下是在财务模块中使用 类 所需的最少参考资料。

  • Sage.Accounting.Common.dll
  • Sage.Accounting.Common.PersistentObjects.dll
  • Sage.Accounting.Financials.dll
  • Sage.Accounting.PersistentObjects.dll
  • Sage.Common.dll
  • Sage.ObjectStore.dll
  • Sage.Utils.dll

以下是在广告模块中使用 类 所需的最少参考资料。

  • Sage.Accounting.Common.dll
  • Sage.Accounting.Common.PersistentObjects.dll
  • Sage.Accounting.Commercials.dll
  • Sage.Accounting.Financials.dll
  • Sage.Accounting.PersistentObjects.dll
  • Sage.Common.dll
  • Sage.ObjectStore.dll
  • Sage.Utils.dll

以下是在项目会计模块中使用 类 所需的最少参考资料。

  • Sage.Accounting.People.dll
  • Sage.Accounting.ProjectCosting.dll
  • Sage.Accounting.TimesheetAndExpenses.dll
  • Sage.Accounting.Commercials.dll
  • Sage.Accounting.Financials.dll
  • Sage.Accounting.PersistentObjects.dll
  • Sage.Common.dll
  • Sage.ObjectStore.dll
  • Sage.Utils.dll

除了上面列出的财务和商业参考资料外,以下是在物料清单模块中使用 类 所需的最低参考资料。

  • Sage.Manufacturing.AccountsBusinessObjects.dll
  • Sage.Manufacturing.AccountsBusinessObjects.Sage200.dll
  • Sage.Manufacturing.dll
  • Sage.Manufacturing.BusinessObjects.dll
  • Sage.Manufacturing.BusinessObjects.Sage200.dll
  • Sage.Manufacturing.PersistentObjects.dll
  • Sage.ObjectStore.Builder.dll

为了能够 运行 代码中的任何 Sage 200 报告,您至少需要以下参考资料:

  • Sage.Accounting.Financials.dll
  • Sage.Common.dll
  • Sage.Manufacturing.Reporting.dll
  • Sage.ObjectStore.dll
  • Sage.Utils.dll

这里是 c# 代码,用于引用安装目录中所有必需的 dll

#region constants
private const string REG_PATH = @"Software\Sage\MMS";
private const string REGKEY_VALUE = "ClientInstallLocation";
private const string DEFAULT_ASSEMBLY = "Sage.Common.dll";
private const string ASSEMBLY_RESOLVER = "Sage.Common.Utilities.AssemblyResolver";
private const string RESOLVER_METHOD = "GetResolver";
#endregion constants

/// <summary>
/// Locates and invokes assemblies from the client folder at runtime.
/// </summary>
static void FindCore200()
{
    // get registry info for Sage 200 server path
    string path = string.Empty;
    RegistryKey root = Registry.CurrentUser;
    RegistryKey key = root.OpenSubKey(REG_PATH);

    if (key != null)
    {
        object value = key.GetValue(REGKEY_VALUE);
        if (value != null)
            path = value as string;
    }

    // refer to all installed assemblies based on location of default one
    if (string.IsNullOrEmpty(path) == false)
    {
        string commonDllAssemblyName = System.IO.Path.Combine(path, DEFAULT_ASSEMBLY);

        if (System.IO.File.Exists(commonDllAssemblyName))
        {
            System.Reflection.Assembly defaultAssembly = System.Reflection.Assembly.LoadFrom(commonDllAssemblyName);
            Type type = defaultAssembly.GetType(ASSEMBLY_RESOLVER);
            MethodInfo method = type.GetMethod(RESOLVER_METHOD);
            method.Invoke(null, null);
        }
    }
}

/// <summary>
/// Launch the application's main code
/// </summary>
static void LaunchApplication()
{
    // NOTE: Entering this function, .Net will attempt to load sage assemblies into the AppDomain.
    // Assembly resolution MUST be configured before entering this function.

    // -- Replace this code with your application startup code --
    // |                                                        |
    // V                                                        V

    var app = new ClassReferencingSageObjects();
    app.Run();

    // ^                                                        ^
    // |                                                        |
    // -- Replace this code with your application startup code --
}

/// <summary>
/// Program main entry point.
/// </summary>
static void Main()
{
    FindCore200();
    LaunchApplication();
}