Microsoft KB Archive/928961

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Visual Studio 2005 Team Edition for Database Professionals.
  2. On the File menu, point to New, and then click Project.
  3. Expand Database Projects, and then click Microsoft SQL Server.
  4. Click SQL Server 2005, type Database1 in the Name box, and then click OK.
  5. In Solution Explorer, expand Schema Objects, right-click Assemblies, point to Add, and then click New Item.
  6. Select the Programmability category, select the Assembly template, type Assembly1 in the Name box, and then click Add.
  7. 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;


REFERENCES

For more information about the CREATE ASSEMBLY statement, visit the following Microsoft Developer Network (MSDN) Web site:

Keywords: kbdevelopment kbtshoot kberrmsg kbprb KB928961