Iain
Iain

Reputation: 488

Not getting all the methods from Azure Storage package

So I'm trying to play around with Queues in Azure storage so I created a Console application and added the WindowsAzure.Storage package in NuGet. Then I put this bit of code in and it works it creates a queue for me.

    static void Main(string[] args)
    {
        string connection = "myConnectionString......";
        CloudStorageAccount storageAcc = CloudStorageAccount.Parse(connection);

        CloudQueueClient queueClient = storageAcc.CreateCloudQueueClient();
        CloudQueue queue = queueClient.GetQueueReference("myQueue");
        queue.CreateIfNotExistsAsync();
        Console.ReadKey();
    }

However there should be a non Async version I can call instead

        queue.CreateIfNotExists();

But Visual Studio 2017 is not recognising CreateIfNotExists as a member of CloudQueue.

If I try to build it it throws a compile error.

I seems like lots of non Async methods are missing such as AddMessage and GetMessage any idea what could cause this?

Upvotes: 0

Views: 234

Answers (1)

Janley Zhang
Janley Zhang

Reputation: 1587

I seems like lots of non Async methods are missing such as AddMessage and GetMessage any idea what could cause this?

According to your description, I suppose you created a Console .NET Core project. I have created a simple demo, the result like this. This .NET Core project just supports the Async methods.There is no these sync methods now. So you haven't missed these methods.

If you just want to use sync methods like queue.CreateIfNotExists(), I suggest you could choose Console App(.NET Framework) project and install the WindowsAzure.Storage package to try again. Or you could refer to this article to use Azure queue.

Upvotes: 2

Related Questions