Table of Contents

How to compile it with your own Exchange version dlls

  1. Install Visual Studio Community 2019: https://www.visualstudio.com/downloads/
  2. Create a C# class library project, name it "Microsoft.Exchange.SBR" if you just want to copy/paste my code:

    Create Project

    If you want to work on several versions, just change the Solution name.
  3. [Only for Exchange 2010] Change the target Framework to .NET Framework 3.5 in the Application Properties

    [Only for Exchange 2016 CU8 and higher] Starting CU8, .NET Framework 4.7.1 is supported. Starting CU10, it is mandatory. Assumed .NET 4.7.1 is installed on the Exchange 2016 CU8 server, change the target framework to .NET Framework 4.7.1 in the Application Properties (.NET Framework 4.7.1 Developer Pack must be installed on the machine used for compiling)

    [Only for Exchange 2016 CU11 and higher] Starting CU11, .NET Framework 4.7.2 is supported. Starting CU12, it is mandatory. Assumed .NET 4.7.2 is installed on the Exchange 2016 CU11+ server, change the target framework to .NET Framework 4.7.2 in the Application Properties (.NET Framework 4.7.2 Developer Pack must be installed on the machine used for compiling)

    [Only for Exchange 2016 CU13 and higher] Starting CU13, .NET Framework 4.8 is supported. Starting CU15, it is mandatory. Assumed .NET 4.8 is installed on the Exchange 2016 CU13+ server, change the target framework to .NET Framework 4.8 in the Application Properties (.NET Framework 4.8 Developer Pack must be installed on the machine used for compiling)

    Check Exchange Server supportability matrix and .NET SDKs for Visual Studio.

    Right-click the Project, select Properties (at the bottom)
    Change .NET Framework Part 1

    Select .NET Framework 3.5 or .NET Framework 4.7.1/4.7.2/4.8, restart as instructed
    Change .NET Framework Part 2
  4. In the same interface, change the Assembly Information as you like
    Change .NET Framework Part 3
  5. Copy the following DLLs to the debug directory ..\Microsoft.Exchange.SBR\bin\Debug of your new C# project:

    • Microsoft.Exchange.Data.Common.dll
    • Microsoft.Exchange.Data.Transport.dll

    Default location in Exchange 2010:
    C:\Program Files\Microsoft\Exchange Server\v14\Public

    Default location in Exchange 2013:
    C:\Program Files\Microsoft\Exchange Server\v15\Public

    Default location in Exchange 2016:
    C:\Program Files\Microsoft\Exchange Server\v15\Public
  6. Add references to the two DLLs to the C# project using the Visual Studio solution explorer by browsing to the files
    Add Reference Part 1

    Add Reference Part 2
  7. Also add reference to System.Configuration.Install (found in Assemblies/Framework)
    Add Reference Part 3
  8. [Only for Exchange 2010] Remove reference to Microsoft.CSharp (the one with the explamation mark)
    Add Reference Part 4
  9. Add the following code to your project

    For Exchange 2010: CustomSBRRoutingAgent-E10.cs
    For Exchange 2013: CustomSBRRoutingAgent-E13.cs
    For Exchange 2016: CustomSBRRoutingAgent-E16.cs

    And maybe give the default C# code file a more meaningful name, e.g. CustomSBRAgent.cs:
    Change to Release Mode Part 1
  10. Change to Release mode
    Change to Release Mode Part 2
  11. Compile the DLL
    Compile Binary
  12. Copy the DLL from your project ..\Microsoft.Exchange.SBR\bin\Release to the HT server (Exchange 2010) or MBX server (Exchange 2013/2016).
    Copy to target
  13. Continue with Installing Binary, for Exchange 2010 or Exchange 2013 or Exchange 2016.