访问Azure存储的Com互操作DLL

访问Azure存储的Com互操作DLL,azure,com-interop,azure-storage,Azure,Com Interop,Azure Storage,我的客户需要一个com互操作dll来保存和删除存储中的Windows Azure Blob(他使用VB6,无法直接调用存储)。我以前曾多次编写过这样的ComInterop DLL,但现在,当从VB6应用程序调用DLL时,他会得到一个运行时文件not found exception 80070002: “无法加载文件或程序集”Microsoft.WindowsAzure.Storage,版本=2.0.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35“或其依赖项之

我的客户需要一个com互操作dll来保存和删除存储中的Windows Azure Blob(他使用VB6,无法直接调用存储)。我以前曾多次编写过这样的ComInterop DLL,但现在,当从VB6应用程序调用DLL时,他会得到一个运行时文件not found exception 80070002:

“无法加载文件或程序集”Microsoft.WindowsAzure.Storage,版本=2.0.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35“或其依赖项之一

有什么想法吗

下面是一个小代码片段:

[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)
        {
            ...
        }
    }

您需要添加对Microsoft.WindowsAzure.Storage.dll的引用-在安装Azure工具时,此引用将在您的开发人员计算机上本地安装

只要找到这个文件,从你的项目中引用它,你就可以了


希望这有帮助。

我确实有此dll的参考。通过一个测试项目,一切工作都很完美。我可以像charme一样添加和删除blob。仅在vb6(com互操作)中发生此运行时异常。抱歉,不准确。此引用是否设置为在应用程序生成时复制到您的Bin文件夹?如果你在一台测试机上,你可能在GAC或其他地方注册了这个文件,但在他的电脑上他可能没有。我想,你是对的。“本地副本”设置为true。我会检查出来,并张贴一个答案。谢谢不幸的是,没有任何改善。同样的错误。还有其他想法吗?嗯。找到这个>>