Unable to load DLL 'fusion.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Closed this issue ยท 23 comments
From @Nefcanto on December 23, 2017 15:1
Environment:
VS 2017 Community edition 15.5.2
dotnet --version => 2.1.2
Windows 10 Enterprise
Steps to reproduce this bug:
- Create a simple console application using default template
- Add these Nuget packages:
<ItemGroup>
<PackageReference Include="WindowsAzure.Storage" Version="8.7.0" />
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" Version="3.2.3" />
</ItemGroup>
- Write these lines of codes to get a container:
var accessKey = "your access key";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(accessKey));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("images");
- Run the application
Copied from original issue: Azure/azure-storage-net#596
From @sameedaris on January 3, 2018 18:45
I was facing same issue . CloudConfigurationManager.GetSetting(accessKey) method looks into configuration files and it takes AppSetting key name only as parameter. but ironically i was passing whole connection string in place of Key so it was giving error . i think they need to correct exception message
From @user3301 on January 5, 2018 3:16
I had this issue before, when I try to load the configuration information using CloudConfigurationManager.GetSettings(key)
this exception showed up, one workaround is put your exact value of you settings in Parse(settings)
method.
I see the same issue when I try to use Microsoft.WindowsAzure.ConfigurationManager in ASP.NET Core Web Application. ASP.NET Web Application(.NET Framework) do not have this problem.
From @erezvani1529 on January 23, 2018 1:20
Thanks for reporting this issue. However, this issue should be opened on Azure Sdk repo as it is related to Microsoft.WindowsAzure.ConfigurationManager package.
Thanks!
I had the same issue with .net core console app. I couldn't make CloudConfigurationManager work so I used this approach instead
var storageCredentials = new StorageCredentials("myAccountName", "myAccountKey"); var cloudStorageAccount = new CloudStorageAccount(storageCredentials, true); var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
Once you have your cloud storage account reference you can do whatever you want. For example, creating a new container
var container = cloudBlobClient.GetContainerReference("mycontainer"); await container.CreateIfNotExistsAsync();
But remember that every remote action in the storage library is async so you have to do something like this
static void Main(string[] args)
{
MainAsync(args)).GetAwaiter().GetResult();
}
static async void MainAsync(string[] args)
{
var storageCredentials = new StorageCredentials("myAccountName", "myAccountKey");
var cloudStorageAccount = new CloudStorageAccount(storageCredentials, true);
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference("mycontainer");
await container.CreateIfNotExistsAsync();
}
Reference:
https://dotnetcoretutorials.com/2017/06/17/using-azure-blob-storage-net-core/
I only changed the Mainasync method call from
Task.Run(() => MainAsync(args)).GetAwaiter().GetResult();
to
MainAsync(args)).GetAwaiter().GetResult();
any updates on this issue? it seems Microsoft.WindowsAzure.ConfigurationManager v3.2.3 was released in Oct, 2016 and had not been updated since then
@JoyceLiang we will have a release out soon for VS 2017.
Stay tuned for specific dates.
Apologies for the delay in responding.
New version of Configuration manager has been released. Note the change in the name to align with our naming standards
Microsoft.Azure.ConfigurationManager
Please open a new issue, if you have any issues with the newly release package.
I am having this issue.
Target framework: Asp.Net Core 2.1
Nuget packages:
Configuration Manager 4.0.0
Microsoft.AspNetCore 2.1.6
Microsoft.AspNetCore.All 2.1.6
Nuget warning if it matters:
Package 'Microsoft.Azure.ConfigurationManager 4.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
Same here, using Microsoft.Azure.ConfigurationManager, Version=4.0.0.0 and getting:
Message = "Unable to load DLL 'fusion.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Also getting the warning:
Package 'Microsoft.SharePointOnline.CSOM 16.1.8412.1200' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
I was facing same issue . CloudConfigurationManager.GetSetting(accessKey) method looks into configuration files and it takes AppSetting key name only as parameter. but ironically i was passing whole connection string in place of Key so it was giving error .
Please Check if you are passing Key name or whole String?
No joy @sameedaris, I'm passing hardcoded values but GetAppOnlyAuthenticatedContext(url, appid, secret) is going belly up with Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'.
hmm strange ..
I am also facing this issue. Tried using ConfigurationManager.GetSettings for a WebJob running in Azure to get values from AppSettings under the AppService, but "Unable to load DLL fusion.dll" pops up.
Just an FYI, I was having this issue on an project using .net core 2.2
Switch the project over to .net framework 4.6.1 resolved the issue
This is still a problem with Microsoft.Azure.ConfigurationManager 4.0.0 for .NET Core.
This version of the NuGet package (4.0.0) is built against NetFx 4.5.2 and is not compatible with .NET Core
Sample code demonstrating this issue can be found at: https://github.com/csharpfritz/BrokenAzureFunctions
@shahabhijeet can you take a look?
Assuming you've hacked appsettings.json into your .NET Core console application (not included in the project template) then we're just talking about getting a connection string - not sure why they want you to use an Azure library just to get an application setting...
var connectionString = configuration.GetConnectionString("AzureStorage"); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
You can use string storageConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage");
Why is this not fixed yet? I am using VS 2019 latest update and dot net core 3.1. This issue was moved from another area to here and it still isn't fixed!!! This is inexcusable and extremely UNPROFESSIONAL!
I managed to get the settings using another approach:
`public Settings GetConfigurationSettings()
{
var config = new ConfigurationBuilder()
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
var settings = new Settings();
config.Bind(settings);
return settings;
}`
My local.settings.json looks like this:
{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "MyStorageConnection": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet" } }
And the Settings class like this
public class Settings { public string MyStorageConnection{ get; set; }
Friends, this is broken... and we should move on with a work-around.
The documentation now recommends that you fetch configuration settings as EnvironmentVariables:
System.Environment.GetEnvironmentVariable("AzureWebJobsStorage", EnvironmentVariableTarget.Process);
Let's close this issue and mark it as abandoned with this as the recommended work-around.
This is shockingly bad. So I have an azure function that needs to call into some of my repository layer azure storage code to access a connection string. That layers uses the recommended library for acessing connection strings Microsoft.Azure.ConfigurationManager. And yet, from what I can see here, that is not supported so I have to rewrite my data layer just so that it can be called from an azure function???? I tell you, working with .net has become painful.