title: ASP.NET MVC 5 DACPAC Sql140DatabaseSchemaProvider is not valid
body: <p>I get this error when I run dacpac from VS Community 2017 MVC 5 project.</p>
  
  <pre><code>"Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.Sql140DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service."
  </code></pre>
  
  <p>The code</p>
  
  <pre><code>            var dacpacName = "setup.dacpac";                 
              var dacpacPath = Path.Combine(Server.MapPath("~/assets/dacpac"), dacpacName);
              var dp = DacPackage.Load(dacpacPath);
              var dbDeployOptions = new DacDeployOptions
              {
                  BlockOnPossibleDataLoss = false,
                  ScriptDatabaseOptions = false,
                  GenerateSmartDefaults = true,
                  CreateNewDatabase = true
              }; 
              var dbServices = new DacServices(setupDbConn.ConnectionString);
              dbServices.Deploy(dp, newDatabaseName, true, dbDeployOptions);
  </code></pre>
  
  <p>The error happens after this code:</p>
  
  <pre><code>var dbServices = new DacServices(setupDbConn.ConnectionString);
  </code></pre>
  
  <p>My SqlExpress is 2017. I've regenerated the dacpac from SqlExpress 2017 as well. The dacpac works without error when I use it in SqlExpress.</p>
  
  <p>I've been googling for hours but can't seem to find the right answer to this. I'm thinking this is some kind of compatibility issues but can't figure out how to fix the error.</p>
  
  <p>Hope someone have experienced this and can help me fix this issue.</p>