I have spent literally a 1 1/2 days Googling for a solution to this issue to no avail.
I am unable to reference a compiled SQLCLR assembly from code, in another project. I can add the reference to the other project, but when I try to add a "using" directive to include the referenced component in code, I receive a "The type or namespace name 'Database1' could not be found (are you missing a using directive or an assembly reference?)"
Here's what I've done:
- Using VS 2012/2013 I have created a blank solution.
- Added a new SQL Server Database project (Database1) targeting SQL Server 2012, and the .Net 4.5 Framework (NOT the Client Profile).
- Added a new command line/winform/web app/whatever project (TestConsoleApplication1) to the solution, that ALSO targets the .Net 4.5 Framework (NOT the Client Profile).
- Added references to the Database1 assembly (have tried project reference as well), and the System.Data assembly to the TestConsoleApplication1 project.
- Added using directive for the System.Data assembly to the default class which was automatically added when I created the TestConsoleApplication1 project.
- Attempted to add a using directive for the Database1 assembly to the default class which was automatically added when I created the TestConsoleApplication1 project.
- When attempting to add the using directive for the Database1 assembly, the assembly name did not appear in intellisense, and typing in the assembly name resulted in the "red squiggle" under Database1.
- Attempted to build the project, results in the "The type or namespace name 'Database1' could not be found (are you missing a using directive or an assembly reference?)" Error.
- Checked, double, triple, quadruple...n-tuple-checked that both projects target the same .Net Framework version (4.5).
Database1 has no code, and here is the code for the "client" app (TestConsoleApplication1):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Database1; //Marked as design-time error, and throws ERROR on build
namespace TestConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
Does anybody have any idea why I can add a reference to the SQLCLR assembly, but the "client" project code appears unable to actually "see" nor access the referenced assembly?