How to reference the newest version of ChemAxon .NET API

User bc3eb0a599

07-04-2014 21:02:39

Hi,


Could you please help me on how to set up my VB .NET application so that at run time it always uses the latest installed ChemAxon .NET API?


My application has to invoke Marvin editor (MarvinSketchForm) and also render some structure to images. The application has references to "ChemAxon.NET.IKVM", "ChemAxon.NET.Windows.Forms" and "ChemAxon.NET.Base". 


It seems that the application requires the same version as used during design time.


I have also tried the BindingRedirect in the app.config file as follows:


<runtime>


    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">


      <dependentAssembly>


        <assemblyIdentity name="ChemAxon.NET.Windows.Forms" PublicKeyToken="D25CE09139C726A9" culture="neutral"/>


        <bindingRedirect oldVersion="0.0.0.0-6.2.1.21" newVersion="6.2.1.21"/>


      </dependentAssembly>


      <dependentAssembly>


        <assemblyIdentity name="ChemAxon.NET" PublicKeyToken="D25CE09139C726A9" culture="neutral"/>


        <bindingRedirect oldVersion="0.0.0.0-6.2.1.21" newVersion="6.2.1.21"/>


      </dependentAssembly>


      <dependentAssembly>


        <assemblyIdentity name="ChemAxon.NET.IKVM" publicKeyToken="D25CE09139C726A9" culture="neutral"/>


        <bindingRedirect oldVersion="0.0.0.0-6.2.1.21" newVersion="6.2.1.21"/>


      </dependentAssembly>


      <dependentAssembly>


        <assemblyIdentity name="ChemAxon.NET.Base" publicKeyToken="D25CE09139C726A9" culture="neutral"/>


        <bindingRedirect oldVersion="0.0.0.0-6.2.1.21" newVersion="6.2.1.21"/>


      </dependentAssembly>


    </assemblyBinding>


  </runtime>


Thanks for your help.


Tom


 

ChemAxon bd13b5bd77

07-04-2014 21:21:20

Hi Tom, 


 


very actual issue is what you raised.


Explanation:


We removed the redirecting policies from the installer (approx. 2 years ago), because our imagination was that every customer would place their own redirecting rule on these dlls into the GAC.


 


The basic rule is that we keep the compatibility within minor versions 6.2.1 to 6.2.2.


Between major releases there might be differences e.g. from 6.2.2 to 6.3.0.


 


You can install policies into GAC independently : http://msdn.microsoft.com/en-us/library/dz32563a(v=vs.110).aspx


<configuration>


    <runtime>


        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">


            <dependentAssembly>


                <assemblyIdentity name="ChemAxon.IKVM.aloe.1.0"


                  publicKeyToken="d25ce09139c726a9"


                  culture="neutral" />


                <bindingRedirect oldVersion="6.3.0.0-6.3.65534.65534" newVersion="6.3.0.120" />


            </dependentAssembly>


        </assemblyBinding>


    </runtime>


</configuration>



 


 Viktor

User bc3eb0a599

08-04-2014 13:36:58

Hi Viktor:


The 4 assembly DLL files that my sample application references in turn reference other more than 200 DLLs files. I found this out when I tried to create a setup project for my project. These DLLs are listed in the setup as detected references and are always copied as part of the installation. So I have the following questions:


(1) The default behavior seems to be that if I compile with version x of ChemAxon .NET API, version x must have been installed on the run time machine for it to work. It this correct?


(1)  Do these 200 or so DLLs have to be in the application folder? If not, how and which files can I exclude?.


(2) It would take me a while to create the publisher policy file with this many DLLs. Can you please send me a sample policy file with all these DLLs names so I don't have to add them one by one?


Thank you.


Tom

User bc3eb0a599

08-04-2014 14:13:24

Hi Viktor:


I know you are in a different time zone so I'm trying to post all my questions at once so I don't have to wait another day.


After looking into the installation directory of the ChemAxon .NET API, I noticed the policy assembly files are already there in the folder. Here are my new questions:


(1) If I add all the policy file assemblies to the GAC, which assembly is looked up first? The one in GAC or the one in the application directory?


(2) It seems that If I add all the policy file assemblies to the GAC I don't need to include all the DLLs in the application folder. Is it correct? If so, how do I not include them in the setup project?


Thanks.


Tom


 

ChemAxon bd13b5bd77

08-04-2014 15:12:36

Hi Tom,


let me try to answer your first set of queastions:


(1) The default behavior seems to be that if I compile with version x of ChemAxon .NET API, version x must have been installed on the run time machine for it to work. It this correct?


[Viktor] - Yes, it is correct you can do it with our official MSI or MSM (redistributable module if you would like to include it in your own MSI).


(1)  Do these 200 or so DLLs have to be in the application folder? If not, how and which files can I exclude?.


[Viktor] - 





(2) It would take me a while to create the publisher policy file with this many DLLs. Can you please send me a sample policy file with all these DLLs names so I don't have to add them one by one?


[Viktor] - All 200 Publisher policy is still available in the Program Files/ChemAxon/PublisherPolicies subfolder.

ChemAxon bd13b5bd77

08-04-2014 15:23:19

Next answers:


 


(1) If I add all the policy file assemblies to the GAC, which assembly is looked up first? The one in GAC or the one in the application directory?


[Viktor] - This article gives the detailed infromation of the loading order:  http://msdn.microsoft.com/en-us/library/yx7xezcf(v=vs.110).aspx


(2) It seems that If I add all the policy file assemblies to the GAC I don't need to include all the DLLs in the application folder. Is it correct?


[Viktor] - Yes of course however the assemblies have to be in the GAC anyway work together with the policies shoulder-by-shoulder.


The policy is only responsible for saying to the Assembly Loader to check the version range and give back the proper one instead of the version the application is looking for.


If so, how do I not include them in the setup project?


[Viktor] - Please check my previous mail our MSI package or MSM module can be reused for your installer.

User bc3eb0a599

08-04-2014 15:51:09

Hi Viktor:


I'm still not clear on how to incorporate your MSI installer package so I can avoid copying all the dependent DLLs.


This is what happens in my sample project:



I would like to just add references to the 4 main DLLs but not copy the files as part of deployment. And then at run time just use the assemblies in GAC if the compiled version or later exist. How do I do that? I've tried binding redirect in the app.config file.


Thanks.


Tom

ChemAxon bd13b5bd77

09-04-2014 07:44:27

Hi Tom,


as we discussed on the phone I created a MS Setup project in VS Studio and could reproduce that MS Setup loads all possible references to the installer package (from GAC) All the dlls except Microsoft references.


This is strange to me, I do not know the answer yet, but the workaround is that you are allowed to exlcude them with one click in the project property window. You need to select all and say Exclude = true.


All you dlls will be remaining in this way in the package. 


 


I continue with the redirecting policies you were also interested in.


Viktor