title: Why is an Azure Function on .NET 6 looking for System.ComponentModel Version 6.0.0.0?
body: <p>I am deploying an Azure Function called &quot;Bridge&quot; to Azure, targeting .NET 6. The project is referencing a class library called &quot;DBLibrary&quot; that I wrote, and that library is targeting .NET Standard 2.1. The Azure Function can be run locally on my PC without runtime errors.</p>
  <p>When I publish the Azure Function to Azure, I see in Azure Portal a &quot;Functions runtime error&quot; which says:</p>
  <blockquote>
  <p>Could not load file or assembly 'System.ComponentModel,
  Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  The system cannot find the file specified.</p>
  </blockquote>
  <p>I do not target System.ComponentModel directly, and I don't see a nuget package version 6.0.0 for &quot;System.ComponentModel&quot; available from any nuget feed. Why is the Azure function looking for this version 6.0.0 of System.ComponentModel? If that version does exist, why can't the Azure Function find it?</p>
  <p>Here are the relevant parts of the csproj for the &quot;Bridge&quot; Azure Function:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
      &lt;PropertyGroup&gt;
        &lt;TargetFramework&gt;net6.0&lt;/TargetFramework&gt;
        &lt;AzureFunctionsVersion&gt;v4&lt;/AzureFunctionsVersion&gt;
      &lt;/PropertyGroup&gt;
      &lt;ItemGroup&gt;
        &lt;PackageReference Include=&quot;Microsoft.Azure.Functions.Extensions&quot; Version=&quot;1.1.0&quot; /&gt;
        &lt;PackageReference Include=&quot;Microsoft.Extensions.Azure&quot; Version=&quot;1.1.1&quot; /&gt;
        &lt;PackageReference Include=&quot;Microsoft.Extensions.DependencyInjection&quot; Version=&quot;6.0.0&quot; /&gt;
        &lt;PackageReference Include=&quot;Microsoft.NET.Sdk.Functions&quot; Version=&quot;4.0.1&quot; /&gt;
      &lt;/ItemGroup&gt;
      &lt;ItemGroup&gt;
        &lt;ProjectReference Include=&quot;..\DBLibrary\DBLibrary.csproj&quot; /&gt;
      &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>Here are the relevant sections of the csproj for the &quot;DBLibrary&quot; class library that is referenced by the Azure Function project:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
      &lt;PropertyGroup&gt;
        &lt;TargetFramework&gt;netstandard2.1&lt;/TargetFramework&gt;
        &lt;ApplicationIcon /&gt;
        &lt;OutputType&gt;Library&lt;/OutputType&gt;
        &lt;StartupObject /&gt;
      &lt;/PropertyGroup&gt;
      &lt;ItemGroup&gt;
        &lt;PackageReference Include=&quot;Azure.Storage.Blobs&quot; Version=&quot;12.10.0&quot; /&gt;
        &lt;PackageReference Include=&quot;Dapper&quot; Version=&quot;2.0.123&quot; /&gt;
        &lt;PackageReference Include=&quot;Microsoft.Extensions.Logging.Abstractions&quot; Version=&quot;6.0.0&quot; /&gt;
        &lt;PackageReference Include=&quot;System.Data.SqlClient&quot; Version=&quot;4.8.3&quot; /&gt;
        &lt;PackageReference Include=&quot;System.Text.Json&quot; Version=&quot;6.0.2&quot; /&gt;
      &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>I have tried setting _FunctionsSkipCleanOutput to true in the Azure Functions csproj because that was offered as a potential solution to nuget package resolution issues here:
  <a href="https://github.com/Azure/azure-functions-host/issues/7061" rel="nofollow noreferrer">https://github.com/Azure/azure-functions-host/issues/7061</a>
  That solution did not change the runtime error I saw in the Azure portal.</p>