@Mj Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
I understand that you are encountering an error that says Error building configuration in an external startup class. LicenseMNG: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9'. The system cannot find the file specified.
Please try the following action plan and let me know if that helps:
1.Where is your startup class being inherited from ? Try Changing the Startup to inherit from FunctionsStartup rather than WebJobsStartup. See below:
[assembly: FunctionsStartup(typeof(Startup))]
public class Startup : FunctionsStartup { ...
public override void Configure(IFunctionsHostBuilder builder)
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.Build();
builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
builder.Services.AddHttpClient();
...
}
- Firstly make sure that you are using most recent version of
azure-functions-core-tools
3.Please check and ensure that you are using Azure Function v4.
4.Also ensure you have <AzureFunctionsVersion>v4</AzureFunctionsVersion>
within csproj and if the App is already deployed to Azure then within the App Settings have FUNCTIONS_EXTENSION_VERSION
set to ~4
5.From this nuget link try installing the 7.0.0.0 version of Microsoft.Extensions.Configuration.Abstractions package. And remove all the other references of this package from your project.
6.If you still get error with 7.0.0.0 version, Try with 6.0.0.0 version of this package from this nuget link.
7.Remove the version from the csproj for this assembly as shown below:
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
8.Try adding the below to your csproj file:
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
9.Also have the below setting within your csproj file:
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext"/>
</ItemGroup>
10.Please try downgrading ALL of Microsoft.Extensions.*
to 6.0.0
and check if that helps.
11.Was this app recently upgraded to to .NET 7 ? Is this an isolated model ? See here and here.
If none of the above action plan helps, please let me know. I would be happy to assist you further.
Sharing some of the links where similar issue was reported:
https://stackoverflow.com/questions/64809716/could-not-load-file-or-assembly-microsoft-extensions-configuration-abstractions
https://github.com/Azure/azure-functions-core-tools/issues/2304
https://stackoverflow.com/questions/43995432/could-not-load-file-or-assembly-microsoft-extensions-dependencyinjection-abstrac
https://stackoverflow.com/questions/74808187/could-not-load-file-or-assembly-microsoft-extensions-configuration-abstractions
**
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.