.Net MVC部署dacpac [英] .Net MVC deploy a dacpac

查看:60
本文介绍了.Net MVC部署dacpac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署dacpac.在以下代码下运行时出现错误.

I'm trying to do deploy dacpac. I'm having errors though when running below 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
            };

运行代码时遇到错误:

The type initializer for 'Microsoft.SqlServer.Dac.DacPackage' threw an exception.

这种情况恰好发生在:

 var dp = DacPackage.Load(dacpacPath);

我的路径是:

var dacpacPath = Path.Combine(Server.MapPath("~/assets/dacpac"), dacpacName);

因此,该路径指向dacpac文件的确切位置,但是它不起作用.

So the path is pointing to the exact location of the dacpac file but it's not working.

推荐答案

我从nuget中搜索ff并进行安装,错误消失了.

I search the ff from nuget and installed it, and the error is gone.

  • T-SQL ScriptDom
  • SQLSysCLRTypes

谢谢

这篇关于.Net MVC部署dacpac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆