sql - 使用 Visual Studio 2008 部署 SQL 项目时出错

标签 sql sql-server visual-studio-2008 deployment assemblies

使用 Visual Studio 2008 部署 SQL 项目时,我们创建一个 .sql 文件。

在项目属性中,我们设置了部署操作:创建部署脚本。构建和部署项目时,.sql 将按预期生成。检查生成的代码时,我看到以下 SQL 代码:

CREATE ASSEMBLY [System.Core] AUTHORIZATION [dbo] FROM 0x4D5A9.... WITH PERMISSION_SET = SAFE;

执行这段代码会抛出以下错误。

CREATE ASSEMBLY failed because assembly 'System.Core' is a system assembly. Consider creating a user assembly to wrap desired functionality.

为什么首先生成此代码以及如何防止生成此代码? (据我所知,我们的项目中没有任何 SQLCLR 存储过程或 LINQ)

最佳答案

我不确定VS2008,但在VS2012中,数据库项目属性窗口中有一个SQLCLR选项卡。页面底部的选项之一是标记为生成 DDL 的复选框。如果选中此项,请取消选中它,然后再次构建并生成脚本。

第三段来自 How to: Work with CLR Database Objects状态:

The CLR and CLR Build property pages contain many settings for using CLR database objects in your project. Specifically, the CLR property page has a permission level setting to set permissions on the CLR assembly. It also has the "Generate DDL" setting to control whether DDL for the CLR database objects added to the project is generated. The CLR Build property page contains all the compiler options that you can set to configure the compilation of CLR code in the project. These property pages can be accessed by right-clicking your project in Solution Explorer and select Properties

有关数据库项目属性中 SQLCLR 选项的详细信息,请参阅 MSDN 文章:http://msdn.microsoft.com/en-us/library/hh272681(v=vs.103).aspx#bkmk_sqlclr_sqlclrbuild

关于sql - 使用 Visual Studio 2008 部署 SQL 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16400284/

相关文章:

c++ - 我可以在 Visual Studio 2008 中标记断点吗?

sql - 每个项目的最大日期

sql - where 子句中的多列匹配

Mysql创建 View 并逐渐增加日期时间字段

mysql - SQL Sum 查询行为异常?

c# - SqlDataAdapter.Fill 和 SqlDataReader.Read 的结果不一致

visual-studio-2008 - 如何指定 Visual Studio 安装程序条件?

sql-server - MS SQL Server:Windows 7上无法ODBC连接吗?

c# - 我可以使用C#锁来防止Web应用程序中的SQL Server死锁吗?

asp.net - 从 gridview 中的文本框获取之前的值