We are in the process of upgrading a site of one of our clients from CS 2009 to CS 11.2. The project contains some custom pipeline components and while compiling these I got the following error messages:

error CS1752: Interop type 'CommerceServer.Core.Runtime.DictionaryClass' cannot be embedded. Use the applicable interface instead.

and

error CS0143: The type 'CommerceServer.Core.Runtime.DictionaryClass' has no constructors defined

The line that gave the error was this line:

return new CommerceServer.Core.Runtime.DictionaryClass();

It turns out this is quite easy to solve.

Here is an explanation of what is happening: http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx

Solution is either:

  • Take of the Class suffix or
  • Don't embed the interop assemblies by changing this in the project reference;

Many thanks to Ben Taylor of Enticify, which by the way is a great addition to Commerce Server.