5 Replies Latest reply on May 20, 2015 6:15 PM by Alexandre Gragnano

    SolidWorks Document Manager API

    Alexandre Gragnano

      Hi everyone,


      I developped a tool in C# using Document Manager API (from SW 2015).

      Everything is OK but after to deploy it on a machine which has SW2014 installed,


      throws exception saying the license key is not setted.


      Have you got an idea of what is going on?

      Thanks for your help

      Best regards

        • Re: SolidWorks Document Manager API
          Keith Rice

          Starting with 2015 the DM API key is unique to that year, I believe. I know for a fact that you have request a new key for each year moving forward. I think you might be seeing the consequence of this annoying change to the DM API. I would email API support for an official answer if no one gives a certain one here. Please update this thread when you find out.



          SolidWorks API Training

          • Re: SolidWorks Document Manager API
            Abhay Kharade

            Following are the details of the change in Document manager Licensing starting from SOLIDWORKS 2015:


            The intention here
            is that with each SW release, you will need to come back and request an updated
            key to use the Document Manager to open the files of that latest release (as
            well as previous) files. If you choose not to update with a new key, your existing
            one will continue to work with the latest Document Manager, but simply not be
            able to open any files newer than your key. The key does not control which
            version of the document manager you can use, only which SW file versions it can
            be used to open. For example, if you get a key for SW2015, when the document
            manager for SW2016 comes out, it will continue to work on SW2015 and older
            files. But you would need to update that key if you wanted to add support for
            SW2016 files.


            The only issue you
            might need to work around is during the transition, feeding a new 2015 key into
            2014 document manager won’t work, as the 2014 version of the document manager
            knows nothing about all of this. So, you could try your 2015 key, and if that
            fails, use your 2014 one.


            If you use a SW2015
            style license with the SW2014 version of the Document Manager DLL you will see
            an Exception. The safest course of action is to request keys for both file
            versions and try the newer style first:


                // Create class factory

            SwDMClassFactory swClassFact = new SwDMClassFactory();


            const String
            newStyleLicense = ""// Length varies according to features requested

            const String
            oldStyleLicense = ""// 48 Character string

            SwDMApplication3 swDocMgr = null;



            // Try new style license first - will allow access to
            older files.

            swDocMgr = swClassFact.GetApplication(newStyleLicense) as


            catch (COMException


            if (comEx.ErrorCode == unchecked((int)0x80040112))


            // New style license failed -> Pre-SW2015 dll (or
            invalid key)

            // Try old style license

            // NOTE: A second exception here is not caught by
            this code sample.

            swDocMgr = swClassFact.GetApplication(oldStyleLicense) as




            // This exception is not due to a problem with the
            license. Throw it again with more context.

            throw new ApplicationException("Failed
            to get Document Manager Application object."
            , comEx);





            You need to request this license key through the Customer


            To make the request , you will need to log into the portal using an
            email address registered to a SOLIDWORKS serial number under active


            Once you reach the Self-Service page you need to click on “API
            Support” (under My Support) then “Document Manager Key Request” (on the
            References tab) and finally “Request New Document Manager License Key”.


            This will open up a form in which you will need to enter the details
            of your intended use for the key.


            Once submitted, each request requires manual approval so
            it may take a few days before the key is sent. The email containing the key is
            sometimes misidentified as spam by mail filters. Please look out for emails
            webmaster@solidworks.com or whitelist the address in advance.


            Licenses must be
            requested through the Customer Portal as described here:



            • Re: SolidWorks Document Manager API
              Alexandre Gragnano

              Thank you both for your answers,



              As I explained, my problem is that I already have a 2015 license key (long format) and I use 2015 DLL. My application works on my development machine which has SolidWorks 2014 and 2015 installed but when I deploy this app on a machine which has only SolidWorks 2014, the exception is thrown (0x80040112).



              If I want to follow your solution, how can I obtain a pre-2015 SolidWorks DM license key (old style)?

              Best regards

              • Re: SolidWorks Document Manager API
                Alexandre Gragnano

                After many searches, I better understand my problem:


                My Visual Studio project embed the 2015 SolidWorks DM COM Interop.

                So I suppose the problem is this 2015 COM Interop links my app to the 2014 COM component.

                But the 2014 COM component cannot evaluate the new license key format.


                So, according to the documentation, it is possible to share the COM Component:

                2015 SOLIDWORKS API Help - Getting Started

                You can redistribute swDocumentMgr.dll and zlib.dll.

                In my installer package, I added the both files (from SolidWorks DM 2015) :

                - "<disk>:\Program Files\Common Files\SOLIDWORKS Shared\SwDocumentMgr.dll"

                - "<disk>:\Program Files\Common Files\SOLIDWORKS Shared\zlib.dll"

                and configure the install script to register the SwDocumentMgr.dll.


                But now the problem is SwDocumentMgr.dll cannot be registered because of dependencies.

                (I tried to register it manually as described in the documentation, with same error message)


                Have you got an idea how to solve this issue?


                Thanks in advance,

                Best regards