Microsoft KB Archive/928961

= Error message when you use the CREATE ASSEMBLY statement in Visual Studio 2005 Team Edition for Database Professionals &quot;CREATE ASSEMBLY statement can only have binary elements in its FROM clause&quot; =

Article ID: 928961

Article Last Modified on 12/12/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Team Edition for Database Professionals

-



SYMPTOMS
Consider the following scenario. In Microsoft Visual Studio 2005 Team Edition for Database Professionals, you create a new database project. In the database project, you use the CREATE ASSEMBLY statement to add a common language runtime (CLR) assembly to the project. You use a file path to reference the CLR assembly.

In this scenario, you may receive an error message that resembles the following:

TSD3009: CREATE ASSEMBLY statement can only have binary elements in its FROM clause.



WORKAROUND
To work around this issue, use one of the following methods.

Method 1: Use a binary representation of the file
Use a binary representation of the file in the CREATE ASSEMBLY statement. For example, use code that resembles the following code example. CREATE ASSEMBLY Test1 FROM 4D5A90000300000004000000FFFF

Method 2: Deploy to a test server
If you must include the database project in a solution that also includes a server project, deploy the server project to a test server. After you deploy the server project, follow these steps:
 * 1) Create a temporary database project.
 * 2) Import the schema from the database to which the server project was deployed.
 * 3) Copy the generated script for the CREATE ASSEMBLY statement.



STATUS
This behavior is by design.



Steps to reproduce the behavior
 Start Visual Studio 2005 Team Edition for Database Professionals. On the File menu, point to New, and then click Project. Expand Database Projects, and then click Microsoft SQL Server. Click SQL Server 2005, type Database1 in the Name box, and then click OK. In Solution Explorer, expand Schema Objects, right-click Assemblies, point to Add, and then click New Item. Select the Programmability category, select the Assembly template, type Assembly1 in the Name box, and then click Add.</li>  Replace the code in the Assembly1.assembly.sql file with code that resembles the following code example. CREATE ASSEMBLY [Assembly1]

FROM N'<AssemblyPath>\<AssemblyName>.dll'

WITH PERMISSION_SET = SAFE; </li></ol>

<div class="references_section">