locked
How to recompile a DLL using Visual Studio Express 2012?

    Question

  • I am not a programmer, but necessity requires me to recompile a single DLL since the third-party no longer supports it.  Please craft responses in step-by-step rather than logical answers. Embarassed

    Specifically, the DLL in question is for use as a transport agent on Exchange 2010 and deploying SP2 causes an error:

    The TransportAgentFactory type must be the Microsoft .NET class type of the transport agent factory.

    The author had previously fixed the DLL for SP1 by recompiling the DLL using the updated versions of the following Exchange libraries:

      • Microsoft.Exchange.Data.Common.dll (14.2.214.0)
      • Microsoft.Exchange.Data.Transport.dll (14.2.214.0)

      I found another third-party agent (http://routingruleagent.codeplex.com/documentation , scroll down to "Building the Binary") that encountered the same problem transitioning to Exchange 2010 SP1 and was kind enough to provide a step-by-step guide on how to compile his source code.  Assuming that Exchange 2010 SP2 should be compiled for .NET 3.5 SP1 (http://technet.microsoft.com/en-us/library/ff728623.aspx), the original dll was written in C#, and that I have .NET Reflector 7.6 and Visual Studio Express 2012 for Web installed, could someone fill-in in the following steps?

      1. Open Microsoft.Exchange.Data.Common.dll, Microsoft.Exchange.Data.Transport.dll, and then TransportAgent.dll in .NET Reflector 7.6.
      2. Switch .NET Reflector to C# and .NET 3.5.
      3. Right-click on TransportAgent (1.0.0.0) and select "Export Assembly Source Code".  Finish export with 0 errors with the following files (Transport.csproj, AssemblyInfo.cs, Global.cs, TransportAgent.cs, TransportConfig.cs, TransportFactory.cs)
      4. Close .NET Reflector.
      5. Open Transport.csproj with Visual Studio.
      6. In the Solution Explorer, right-click on "References", select "Add Reference", browse to Microsoft.Exchange.Data.Common.dll and Microsoft.Exchange.Data.Transport.dll.  Both are checked.
      7. ???
      8. Debug Menu => Build TransportAgent

    The error list shows:

    • The type or namespace name 'Exchange' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
    • The type or namespace name 'SmtpReceiveAgentFactory' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'SmtpServer' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'AddressBook' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'SmtpResponse' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'RoutingAddress' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'AddressBook' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'ReceiveCommandEventSource' could not be found (are you missing a using directive or an assembly reference?)
    • The type or namespace name 'RcptCommandEventArgs' could not be found (are you missing a using directive or an assembly reference?)
    • The primary reference "Microsoft.Exchange.Data.Common" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which not be resolved in the currently targeted framework. ".NETFramework, Version=v2.0". To resolve this problem, either remove the reference "Microsoft.Exchange.Data.Transport" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

    Thanks.

    Saturday, September 29, 2012 10:39 PM

Answers