2

私の顧客は、ストレージに Windows Azure BLOB を保存および削除するために com interop dll を必要としています (彼は VB6 を使用しており、ストレージを直接呼び出すことはできません)。以前、このような ComInterop DLL を数回作成しましたが、現在、VB6 アプリケーションから DLL を呼び出すと、ランタイム ファイルが見つからないという例外 80070002 が発生します。

「ファイルまたはアセンブリ 'Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' またはその依存関係の 1 つを読み込めませんでした。

何か案は?

ここに小さなコードスニペットがあります:

[Serializable]
[Guid("...")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComSourceInterfaces(typeof(IBlobOperations))]
[ComVisible(true)]
[ProgId("...")]
public class BlobOperations
{


    #region (Aufrufbare Funktionen) ---------------------------------------
    private const string BlobConnection =
        "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...";

    private const string Container = "...";

    public void BlobChange(string fileLocation, string blobName)
    {
        try
        {
            var storageAccount = CloudStorageAccount.Parse(BlobConnection);

            // Create the blob client.
            var blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve reference to a previously created container.
            var container = blobClient.GetContainerReference(Container);

            // Retrieve reference to a blob named "myblob".
            var blockBlob = container.GetBlockBlobReference(blobName);

            // Create or overwrite the "myblob" blob with contents from a local file.
            using (var fileStream = System.IO.File.OpenRead(fileLocation))
            {
                blockBlob.UploadFromStream(fileStream);
            }
        }
        catch (Exception e)
        {
            ...
        }
    }
4

1 に答える 1

1

Microsoft.WindowsAzure.Storage.dllへの参照を追加する必要があります。これは、Azureツールをインストールするときに開発マシンにローカルにインストールされます。

ファイルを見つけてプロジェクトから参照するだけで大​​丈夫です。

お役に立てれば。

于 2012-12-28T08:01:58.707 に答える