Reputation: 313
In my code I'm using both these two namespaces and all works fine until I try to use the CopyStatus that exists in both. This piece of code works just fine in LINQPad5 with the exact same namespaces, however in VS2019 I'm finding that it cannot fine CopyState in the Storage.File class.
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.File;
Code from LINQPad5
CloudFile file = share.GetRootDirectoryReference().GetFileReference(myfile);
string blobSas = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.Read,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(24)
});
Uri blobSasUri = new Uri(blob.StorageUri.PrimaryUri.ToString() + blobSas);
file.StartCopy(blobSasUri);
file.FetchAttributes();
int count=0;
while (file.CopyState.Status != Microsoft.WindowsAzure.Storage.File.CopyStatus.Success)
{
Thread.Sleep(1000);
Console.WriteLine(@"{0} - Sleep one second", count++.ToString());
file.FetchAttributes();
}
But this (almost) same code does not work in VS2109.
file.StartCopy(bpe.BlobUri);
file.FetchAttributes();
while (file.CopyState.Status != Microsoft.WindowsAzure.Storage.File.CopyStatus.Success)
Picture showing Microsoft.WindowsAzure.Storage.File.CopyStatus does not exist.
Upvotes: 0
Views: 186
Reputation: 313
The solution was to upgrade to .NET framework 4.7.2 and install Microsoft.WindowsAzure.Storage.DataMovement instead of Microsoft.WindowsAzure.Storage in NuGet.
Then qualifying the using statements:
using AF=Microsoft.WindowsAzure.Storage.File;
using AB=Microsoft.WindowsAzure.Storage.Blob;
Upvotes: 1
Reputation: 2513
This issue could be mainly caused by a missing nugget from VS 2019, I'd recommend installing the latest WindowsAzure.storage Nugget found here Restart VS then retry again.
Upvotes: 1