title: "Could not read schema model header information from package."
body: <p>I try to deploy a .dacpac via Code in Visual Studio C# into my MS Sql database  and whenever the .dacpac file is about to be deployed, it throws this error:</p>
  
  <p>Microsoft.SqlServer.Dac.DacServicesException: 'Could not read schema model header information from package.'</p>
  
  <p>SqlPackageException: The model version '2.9' is not supported.</p>
  
  <p>Ive gone through several threads and tried to fix it but nothing could solve my error.</p>
  
  <p>I imported Microsoft.SqlServer.Dac-x86 Nuget Package for the using Microsoft.SqlServer.Dac; namespace.</p>
  
  <p>I have SSMS18 installed too.</p>
  
  <p>I can also deploy the same .dacpac file when I do it via Visual Studios SQL Server Object Explorer (No error there and works perfectly) , but I need to do it in code..</p>
  
  <p>Connection strings and file paths all are correct.</p>
  
  <p>This is the method I am using (last line is where error appears):</p>
  
  <pre><code>        var dbServices = new DacServices(connString);
  
          var dbPackage = DacPackage.Load(new FileStream(dacpacPath, FileMode.Open, FileAccess.Read), DacSchemaModelStorageType.Memory, FileAccess.Read);
  
          var dbDeployOptions = new DacDeployOptions
          {
              CreateNewDatabase = true
          };
  
          dbServices.Deploy(dbPackage, NewDBName.Text, upgradeExisting: true, options: dbDeployOptions);
  </code></pre>
  
  <p>Has anyone a possible solution for this please?</p>