Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Monday, March 12, 2012

References in SQL Server Projects


Hi,

I'm using Visual Studio Beta 1 with SQL Server 2005 Beta 2 and have created a SQL Server Project.

The first thing I tried was to add a reference to a C# class library project that contains many C# tools I like.

Bad news, I get the following error message:

"A reference to 'csharplibrary' could not be added. SQL Server projects can reference only other SQL Server projects."

My question is: is this behavior a limitation of any of the Betas, or is it going to stay? This greatly limits the use of the CLR in SQL Server, IMO.

Martin

Hi,

There are various different approaches you can follow to get your scenario working.
1. You can pre-register all the assemblies that you want to refer in your project - inside your SQL Server database using the CREATE ASSEMBLY statement. Once you are done with that, you can refer them in Visual Studio SQL Server projects using the add reference (they should be shown in the list).
2. You can use class library projects (that allows you to reference any assemblies on the disk) to build your assembly and then register them via SQL Server Management Studio using the CREATE ASSEMBLY statement.

The behavior that you are seeing is going to stay as-is in Visual Studio 2005.

Thanks,
-Vineet.|||
Vineet, thanks for that precious information. It's working... almost.

The assembly is registered, but I get the following error when trying to reference it in Visual Studio for the SQL Server project:
A reference to 'classlibrary' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' or 'manifest' or COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
I've used the same assembly in other VS projects and it's working fine. It's a very basic C# class library/dll with one class containing one static method (no static field).

Any suggestions?

Martin|||

Hi Martin,

This is a known bug and has been fixed in Visual Studio 2005 feb CTP onwards.

Thanks,
-Vineet.

Wednesday, March 7, 2012

Re-Engineer an Existing CUBE

Is it possible to bring a deployed CUBE into Visual Studio.NET?

My CUBE is deployed on SQL 05 Analysis Services. It is the "Portfolio Analyzer" CUBE shipped with Project Server 07.

|||

You can do it one of two ways:

1. File... Open... Analysis Services Database

2. File... New... Project... Business Intelligence Projects... Import Analysis Services 9.0 Database

You might see the Project REAL recommendations regarding your different options under the "Three Ways to Interact With Analysis Services" section of: http://www.microsoft.com/technet/prodtechnol/sql/2005/realastd.mspx

|||I can bring it into VS.NET but the measures are not associated with any Data Source views. Any idea?|||

Hmm. Maybe the cube is processed via push-mode? But even then, I thought you still had to tie a measure to a column in the data source view. So you don't see any data source views in the project?

After you do the Import command I mentioned, look on disk and open up the .cube and .partitions file in Notepad and do a search for "select " (that's select <space>) and see if you can see any out-of-line bindings. That might be how they do it.