Missing type from Microsoft.SqlServer.Server

38 Views Asked by At

I'm trying to follow the example here

and I get to the first block of code before I get an error, The type or namespace name 'SqlProcedureAttribute' does not exist in the namespace 'Microsoft.SqlServer.Server'

using System;
using System.Data;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
  
public class HelloWorldProc
{
    [Microsoft.SqlServer.Server.SqlProcedure]
    public static void HelloWorld(out string text)
    {
        SqlContext.Pipe.Send("Hello world!" + Environment.NewLine);
        text = "Hello world!";
    }
}

My first instinct was to download the NuGetPackage Microsoft.SqlServer.Server, but this didn't resolve my issue, as SqlProcedure isn't a type in that library. It's not in Microsoft.Data.SqlClient, either. I also tried System.Data.SqlClient based on a similar SO question. My assumption is either my .net isn't the version I need to be using - the project is set to 8.0 - but I'm not sure.

0

There are 0 best solutions below