使用 Visual Studio 2008 部署 SQL 项目时,我们创建一个 .sql 文件。
在项目属性中,我们设置了部署操作:创建部署脚本。构建和部署项目时,.sql 将按预期生成。检查生成的代码时,我看到以下 SQL 代码:
block 引用>CREATE ASSEMBLY [System.Core] AUTHORIZATION [dbo] FROM 0x4D5A9.... WITH PERMISSION_SET = SAFE;
执行这段代码会抛出以下错误。
block 引用>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/