I get the error Program does not contain a static Main method suitable for an entry point. I want to use the method UploadFileToBlobStorage in the main method.
Here is my main method:
public static void Main(string[] args,BlobContainerClient containerClient)
{
_ = CreateBlobClientContainerAsync();
_ = UploadFileToBlobStorage(containerClient);
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
}
and here is the UploadFileToBlobStorage method:
public static async Task<int> UploadFileToBlobStorage(BlobContainerClient containerClient)
{
// Create a local file in the ./data/ directory for uploading and downloading
string localPath = "./data/";
string fileName = "perfblob" + Guid.NewGuid().ToString() + ".txt";
string localFilePath = Path.Combine(localPath, fileName);
// Write text to the file
await File.WriteAllTextAsync(localFilePath, "Blob Upload!");
// Get a reference to a blob
BlobClient blobClient = containerClient.GetBlobClient(fileName);
Console.WriteLine("Uploading to Blob storage as blob:\n\t {0}\n", blobClient.Uri);
// Upload data from the local file
await blobClient.UploadAsync(localFilePath, true);
return 200;
}