In the 2.1 release of Microsoft Solver Foundation, there is a bug in the sample plug-in for the XpressMPSolver. For improved performance variable/row keys are no longer specified by Solver foundation services when creating LinearModel object. In order to work correctly, the source for the XpressMPSolver plug-in should be modified to use indices instead of keys.

The following code in XpressMPSolver.cs (from line 567) in method BuildModel()

if (!IsGoal(GetIndexFromKey(entry.Key)) &&
!IsSOS1Row(GetIndexFromKey(entry.Key)) &&
!IsSOS2Row(GetIndexFromKey(entry.Key))) {

need to be changed as below to fix the issue:

if (!IsGoal(entry.Index) &&
!IsSOS1Row(entry.Index) &&
!IsSOS2Row(entry.Index)) {

Alternatively, download the source code from