Reputation: 1
I'm using
<PackageReference Include="Microsoft.Identity.Web.Certificate" Version="1.25.3" />
in my project. The application runs successfully on my local machine. However, when deployed to any environment in Azure, I encounter a ModuleInitializeException error. This error message states that "Azure.Identity" cannot be loaded for the module C:\home\site\platform\app_data\modules\TestModule.Web.dll
.
Application Event Logs -> Error PackageReference
Upon investigation, I found that the following libraries are missing in the Azure environment, causing the issue:
Azure.Security.KeyVault.Secrets.dll
Microsoft.Identity.Client.Extensions.Msal.dll
Azure.Identity.dll
These libraries appear to be related to the Microsoft.Identity.Web.Certificate
package. I have tried upgrading and downgrading the package version, but the issue persists.
Any suggestions for resolving this error? Missing Libraries
Upvotes: -1
Views: 88
Reputation: 1087
The error you’re encountering ModuleInitializeException
is related to missing dependencies of the Microsoft.Identity.Web.Certificate
package.
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.4.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="3.0.0" />
<PackageReference Include="Azure.Identity" Version="1.9.0" />
.csproj
file is properly configured to copy all necessary files to the output directory..csproj
file<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
This setting ensures that all DLLs are copied to the output folder when building locally or in CI/CD.
Now after making the above changes I can see the DLLs in my Azure Web App.
Upvotes: 0