Thanks to Louis Davis for this contribution:
Basically, it is quite simple. The basic steps to creating a .NET application are as follows:

Set references to the following assemblies
  • Accounting.Framework.Common
  • Accounting.Framework.License
  • Accounting.Framework.Session

Create a Module with a Sub Main Routine and set this as the start up for the program. Within the module do the following:
  1. Import Accounting.Framework
  2. Set a variable to the form you will display
  3. Create a new session
  4. Display the form

Option Explicit On
Option Strict On

Imports System.Windows.Forms
Imports System.Environment
Imports System.Data.SqlClient
Imports Accounting.Framework 'Import this to make the link to MAS 500

Module StartUp
' Add hooks for MAS 500 here
' and set program to start from this point
' Remember to set references to Accounting.Framework.Common
' Accounting.Framework.License
' Accounting.Framework.Session
Friend _Session As Session
Friend mcnn As SqlConnection
Friend msCompanyID As String

  Public Sub Main()
    'Instantiating the form that will be displayed
    Dim myForm As frmTestNetForm = New frmTestNetForm

  'Instantiate the session
_    Session = New Session(Service.GetSessionContextXMLFromCommand(CommandLine))

  'Check for a good session
  'This code is what traps if Cancel is selected from the MAS 500 login screen
    If ((Not _Session Is Nothing) AndAlso (_Session.State = Session.SessionState.Active)) Then
      'Set up parameters
      mcnn = New SqlConnection(_Session.ConnectionString)
      msCompanyID = _Session.CompanyID.ToString
      'Load form/Run application
    End If

  End Sub

End Module

That's pretty much it as far as setting the hooks. To deploy it you need to do the following:
  • Create an Application Configuration file to probe for MAS 500 .NET Assemblies
  • Place the EXE and Configuration files in Managed Applications folder (C:\Program files\Sage MAS 500 Client\Managed Applications)
  • Place custom assemblies not registered in the GAC into the Third Party folder or a custom folder under the Managed Applications directory.

The .NET EXE can be started as a stand alone or added to the business desktop. In either case it will run within a MAS 500 session.

This information is taught in the current SDK class and includes a lab to get some hands on in creating these types of applications. It is not documented in the SDK On Line Reference as of yet.

Louis Davis

Last edited Nov 23, 2011 at 5:34 PM by ldavis1, version 2


ldavis1 Nov 23, 2011 at 5:33 PM 
Recently discovered that you need to set a reference to Accounting.Framework.AppConfig as wel in in MAS 500 7.4

tconway Feb 13, 2007 at 7:26 PM 
Hi Louis

Just wanted to say thanks for your efforts here. I followed your outlined procedure and it worked perfectly.

thanks again