Install-TransportAgent issues with .NET 3.5/4.0 RRS feed

  • Question

  • This post has also been cross-posted in Exchange 2010 forum,, but one of the moderators asked me to post it here-

    I am trying to install a Transport Agent first compiled for .NET 3.5 in VS2010 against an Exchange 2010 SP1 environment but receives this error:

    Could not load file or assembly 'file:///XXX' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.    + CategoryInfo          : InvalidArgument: (:) [Install-TransportAgent], BadImageFormatException    + FullyQualifiedErrorId :31BC3A31,Microsoft.Exchange.Management.AgentTasks.InstallTransportAgent

    Get same error for .NET 4.0. After trying changing the PowerShell supported CLR's to include 4.0 and running

    [PS] C:\Windows\system32>[Environment]::Version.ToString()

    Have looked trough Transport Agents SDK October 2010 form Microsoft but they are configured to be compiled against .NET 2.0 which will not work because Exchange 2010 SP1 referenced assemblies (Microsoft.Exchange.Data.Transport.dll and Microsoft.Exchange.Data.Common.dll) require .NET 3.5.

    So summary:

    1) Exchange Shell Install-TransportAgent seems to be broke in Exchange 2010 SP1 trying to install a Transport Agent compiled in .NET 3.5 / 4.0

    2) Trying to compile against 2.0 results in broken code because the referenced assemblies require .NET 3.5

    Any suggestion how this can be fixed ?

    Monday, January 10, 2011 8:45 AM

All replies

  • I'm having exact same issue. Anyone have any workarounds or solutions?
    Sunday, January 23, 2011 3:35 PM
  • This has been submitted to Microsoft Support and has been in work for 2 weeks now, I have been promised that the engineer tomorrow will get back with the result.

    As far as I know there is no workaround.


    Sunday, January 23, 2011 3:50 PM
  • For everybody having the same problem the solution is simple:

    When developing a Transport- or Routing Agent you need to be carefull about referencing both Microsoft.Exchange.Data.Transport.dll and Microsoft.Exchange.Data.Common.dll. You will be able to reference only Microsoft.Exchange.Data.Transport.dll and succesfully compile and because the Microsoft.Exchange.Data.Common.dll will be included the project output you may think "that everything is fine" but it will break when trying to install the Agent.

    Therefore simply add the reference to Microsoft.Exchange.Data.Common.dll in your project, recompile and installation is successful.



    Friday, January 28, 2011 5:25 PM
  • Jens,

    Can you clarify on this?  I have references to both Exchange dlls in my transport agent and am still unable to install the it due to the "built by a runtime newer than the currently loaded runtime" error.  Did you have to modify any of the project settings in VS or do anything special in powershell to allow the transport agent to install properly?


    Friday, February 25, 2011 6:08 PM
  • are you compiling against .NET 3.5 ? Check the project settings you target .NET 3.5.





    Friday, February 25, 2011 6:16 PM
  • Yes, I am using 3.5.  I also updated the supported Powershell CLR's to include 4.0 but I'm still getting that message.

    I'm trying to create a transport for sender based routing and used the code block towards the bottom of this forum post as a reference...

    Any reason you can think of this shouldn't work or know of a better guide for creating a transport agent for routing based on sender?

    Thank you for your help,

    Friday, February 25, 2011 8:06 PM
  • Got it, it has to be in the public directory with the other .dlls.  Probably a common noob mistake...

    Friday, February 25, 2011 8:40 PM
  • Jestin: what do you mean by public directory with other dlls? Thanks.
    Wednesday, April 20, 2011 6:36 PM
  • I am not sure if this ever got answered, but the public directory that Jestin is talking about above is actually under the path where Exchange is installed.  Drop your assembly into that public directory and the install should be successful.  Also, make sure that when you open the powershell console that you are connecting to the same machine that you are trying to install the agent on.
    • Proposed as answer by itsnomihere Wednesday, July 27, 2011 12:48 PM
    Wednesday, July 20, 2011 2:01 AM
  • Was this issue ever resolved?  I am having the exact same problem.



    Thursday, December 29, 2011 9:32 PM
  • I can confirm that the solution mentioned by Bounty Hunter is correct.  The example scripts given in the Transport Agent SDK documentation tell you to place your dll in the agent directory under TransportRoles, but it seems perhaps there is a CASPOL in place that does not allow Exchange to register or work with Third Part DLLs outside of the Public folder.

    I just compiled a Transport Agent in .Net 3.5 and attempted to install it from the example location, but failed with the given message.  after moving my assembly to the Public folder, the agent installed without an issue.

    I also have both Public DLLs referenced in my project as well (Microsoft.Exchange.Data.Transport and Microsoft.Exchange.Data.Common)

    PS: Yeah I know this is old, but it was ambiguous to me if the proposed solution was in fact correct and I wanted to put something here so if someone else found this page in searching the error, they would know that htis works.


    Friday, July 13, 2012 12:24 PM