How to ensure that the OpenXml assembly doesn't cause a conflict with SpreadsheetLight?

Assuaging that Warning (so that it rides off into the sunset) is a matter of downgrading the version of DocumentFormat.OpenXML to Version 2.0.5022.0 (Runtime Version v2.0.50727)

I found this out because this code from the "Hello World" example here.

SLDocument sl = new SLDocument();
sl.SetCellValue("A1", true);
. . .

...failed on the first line with, "Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies"

And so, since it's expecting version 2.0, I removed my 2.5.5631.0 of that file and then NuGot "OpenXML SDK 2.0" in its stead. That is Version 2.0.5022.0 and Runtime Version v2.0.50727

So: No need to update the project file with an arcane boolean property after all.

It kind of gives me the fantods, though, to have to use an older version of an assembly.

UPDATE

The need to "go retro" with DocumentFormat.OpenXml is corroborated here.


One can solve the problem by redirection of DocumentFormat.OpenXml from Version 2.0.5022.0 to more recent version, for example to version 2.5.5631.0. To do this one should add in web.config the new <dependentAssembly> item:

<configuration>
  ...
  <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         ...
         <dependentAssembly>
            <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-2.0.5022.0" newVersion="2.5.5631.0"/>
         </dependentAssembly>
      </assemblyBinding>
  </runtime>
  ...
<configuration>

Spreadsheetlight works with DocumentFormat.OpenXml 2.5 since version 3.4.5:

"Version 3.4.5 - SmartTags is now removed from consideration (not so smart now, are you? ;). Which means the code is now ready for Open XML SDK 2.5! And yes, it now works with Open XML SDK 2.5 (have I mentioned that? lol)"

quote from: https://www.nuget.org/packages/SpreadsheetLight/