【问题标题】:Error System.DllNotFoundException: fusion.dll on Azure storage using Visual Studio for Mac错误 System.DllNotFoundException: fusion.dll 在 Azure 存储上使用 Visual Studio for Mac
【发布时间】:2020-01-10 22:05:07
【问题描述】:

当我关注这个公会时,我正在使用 Visual Studio for Mac。 https://docs.microsoft.com/en-us/azure/storage/blobs/storage-dotnet-how-to-use-blobs

带代码:

// Parse the connection string and return a reference to the storage account.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString")); 

我遇到了这个异常:

System.DllNotFoundException: fusion.dll

我尝试在Visual Studio on Window 中做,没问题。这是 Visual Studio for Mac 的问题 你能指导我如何解决它吗? 谢谢

【问题讨论】:

    标签: visual-studio azure-blob-storage macos-sierra


    【解决方案1】:

    System.DllNotFoundException: fusion.dll

    AFAIK,Fusion.dll 是一种与适用于 Windows 操作系统的 Microsoft .NET Framework 相关联的 DLL 文件。 VS 2017 for Mac 可以为移动、Web、Xamarin 和 .NET Core 等构建应用程序。我假设这个问题是由使用包Microsoft.WindowsAzure.ConfigurationManager引起的。

    请尝试使用最新版本的WindowsAzure.Storage 并删除Microsoft.WindowsAzure.ConfigurationManager 包,然后按如下方式构建您的CloudStorageAccount 实例以缩小此问题。

    CloudStorageAccount storageAccount = CloudStorageAccount.Parse("the-value-of-your-storage-connectionstring"); 
    

    【讨论】:

    • 谢谢!但是这个包,我不能通过 CloudConfigurationManager.GetSetting() 方法使用 App.Config 文件
    • @TonyPham 我在 Mac 上尝试时遇到了同样的异常。你找到任何解决方案了吗?我也在尝试使用 app.config。
    • @raringsunny 正如我上面的评论,我不能使用 App.Config 文件。我声明了一个要替换的常量字符串变量。
    • 谢谢托尼。我也这样做了。
    【解决方案2】:

    到目前为止,我找到了另一个解决方案,可以从 Xamarin PCL 项目的 App.config 文件中获取密钥“StorageConnectionString”。

    你需要安装这个支持获取App.config文件中key值的包:PCLAppConfig

    然后就可以通过行码获取值了:

    字符串存储连接字符串 = PCLAppConfig.ConfigurationManager.AppSettings["StorageConnectionString"];

    【讨论】:

      【解决方案3】:

      为了用户 Azure webJobStorage Connection from local.settings.json 文件,您可以使用

      string storageConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage");
      

      上面一行将从 local.settings.json 文件中读取值并替换为

      CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString );
      

      【讨论】:

        【解决方案4】:
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
        

        【讨论】:

          猜你喜欢
          • 2022-08-19
          • 1970-01-01
          • 2018-07-26
          • 2017-11-28
          • 2022-09-30
          • 1970-01-01
          • 2018-01-13
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多