简体   繁体   中英

Error when deploying a SQL project with Visual Studio 2008

When deploying a SQL project with Visual Studio 2008 we create a .sql file.

In the project properties we have set the deploy action: Create a deployment script. When building and deploying the project the .sql is generated as expected. When inspecting the generated code I see the following SQL code:

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

Executing this piece of code will throw the following error.

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

Why is this code generated in the first place and how can I prevent this code to be generated? (As far as I know we don't have any SQLCLR stored procedures OR LINQ in the project)

I'm not sure about VS2008, but in VS2012 There is an SQLCLR tab in Database Project Properties window. One of the options at the bottom of the page is check box labelled Generate DDL . If this is checked, uncheck it then build and generate the script again.

Third paragraph from How to: Work with CLR Database Objects states:

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

For more information on the SQLCLR options in Database Project Properties, see the MSDN article: http://msdn.microsoft.com/en-us/library/hh272681(v=vs.103).aspx#bkmk_sqlclr_sqlclrbuild

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM