title: Creating a HDF5 file
body: <p>I'm trying to create a hdf5 file with Visual Basic code:</p>
  
  <pre><code>Module file_operations
  
      Sub Main()
          Dim fileid As Long
          Dim h5 As Integer
          h5 = HDF.PInvoke.H5.open()  ' &lt;===Error at this line==&lt;&lt;
  
          fileid = HDF.PInvoke.H5F.create("file_name.h5", HDF.PInvoke.H5F.ACC_TRUNC)
          Dim group1 As Long = HDF.PInvoke.H5G.create(fileid, "/home")
          Dim group2 As Long = HDF.PInvoke.H5G.create(group1, "/music")
  
          HDF.PInvoke.H5F.close(fileid)
          Console.WriteLine("End of Program")
      End Sub
  
  End Module
  </code></pre>
  
  <p>First, I tried installing the latest HDF.PInvoke 1.10 through the Package Manager Console. Later I tried installing the HDF.PInvoke 1.8. In both situations, I had the same error when I run the program.</p>
  
  <pre><code>   System.BadImageFormatException was unhandled
        HResult=-2147024885
        Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT 0x8007000B)
        Source=HDF.PInvoke
        StackTrace:
         in HDF.PInvoke.H5.open()
         in hdf3.file_operations.Main() at C:\Users\...\hdf3\hdf3\file_operations.vb:line 6
         in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         in System.Threading.ThreadHelper.ThreadStart()
    InnerException:
  </code></pre>
  
  <p>The first time I have runned with the default option (Any CPU), so I've optained the exeption above. So I read about the <a href="https://stackoverflow.com/questions/2023766/an-attempt-was-made-to-load-a-program-with-an-incorrect-format-even-when-the-p">"An attempt was made to load a program with an incorrect format"</a> exception then  according to the recommendation I marked <code>Prefer 32-bit</code> option at the properties of my project like displays at the follow screenshot. Finally, I runned again, but the same exeption was threw.</p>
  
  <p><a href="https://i.stack.imgur.com/Ufg0V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ufg0V.png" alt="MyProject"></a></p>