❔ ❔ Upgrading my function app to .NET 7 - Could not load file or assembly System.ComponentModel

JJay 🐱11/10/2022
I've tried to upgrade my Azure Function App to .NET 7. But Microsoft.Azure.WebJobs.Extension.Storage.Queues is giving the error Could not load file or assembly 'System.ComponentModel, Version=7.0.0.0...; am I just too fast in that my dependencies don't support .NET 7 yet? Or is there a particular package that I need to get/update? I have the latest version of everything that I had when it worked before.
JJay 🐱11/10/2022
I also had a similar problem with System.Net.Http which I resolved by updating Microsoft.Extensions.Http; wondering if there is something I should add here to fix System.ComponentModel or if I just need to wait
JJay 🐱11/11/2022
Bump
MMMayor McCheese11/11/2022
Have you tried building a new function app from scratch to check for a minimal repro?
JJay 🐱11/11/2022
Ah, I have not. I'll try a basic repo with a storage trigger.
AAccord11/22/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
JJay 🐱11/27/2022
Been on holiday; will get back to it this week.
Ttebeco11/27/2022
welllllllll
Ttebeco11/27/2022
Image
Ttebeco11/27/2022
I'm gonna say why is that even looking for a 7.0.0
Ttebeco11/27/2022
share your csproj
Ttebeco11/27/2022
Image
Ttebeco11/27/2022
this package is deprecated since many year BTW
Ttebeco11/27/2022
Image
Ttebeco11/27/2022
or it's a typo
Ttebeco11/27/2022
but azure sdk now all starts with Azure.
JJay 🐱11/27/2022
Switching on my work laptop; I'll take a look
Ttebeco11/27/2022
and they are removing all others
JJay 🐱11/27/2022
When I last checked the Microsoft Docs were still recommending that package
Ttebeco11/27/2022
there's many docs
Ttebeco11/27/2022
for as many sdk
Ttebeco11/27/2022
Image
Ttebeco11/27/2022
something is fucked up
JJay 🐱11/27/2022
So the Microsoft.Azure.WebJobs.Extensions.Storage package adds attributes for function app triggers.
Ttebeco11/27/2022
tbh it's so weird the version and name of that package
JJay 🐱11/27/2022
I don't need queues, I just need blobs. Uninstalling Microsoft.Azure.WebJobs.Extensions.Storage and installing Microsoft.Azure.WebJobs.Extensions.Storage.Blobs to see how it goes.
JJay 🐱11/27/2022
Now it claims it cannot load/find assembly System.Collections.Concurrent, Version=7.0.0.0 in Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService
Ttebeco11/27/2022
share the csproj
JJay 🐱11/27/2022
I'll see if I can get it off of my work laptop
JJay 🐱11/27/2022
As Discord is blocked at work
Ttebeco11/27/2022
remove any name related to you org
Ttebeco11/27/2022
if you have access to gist and private gist,
Ttebeco11/27/2022
make sure you're not getting in trouble also
Ttebeco11/27/2022
i don't want to ask you anything that oculd get you fired
Ttebeco11/27/2022
so if you have any string in the csproj that ties you to your company replace it by Corp or CorpName
Ttebeco11/27/2022
something anonymizd
JJay 🐱11/27/2022
No worries, there is nothing identifying in the csproj. Thanks.
JJay 🐱11/27/2022
Trying to find a pasting site which isn't blocked...
Ttebeco11/27/2022
gist.github.com
JJay 🐱11/27/2022
JJay 🐱11/27/2022
Found one
Ttebeco11/27/2022
be patient now 😄
JJay 🐱11/27/2022
gist doesn't seem to be blocked; I'll use it in the future.
Ttebeco11/27/2022
ok so
Ttebeco11/27/2022
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
Ttebeco11/27/2022
this is a serious issue
Ttebeco11/27/2022
this will hurt you fucking bad
Ttebeco11/27/2022
why do you need that one ?
JJay 🐱11/27/2022
Ah, perhaps I can remove that as it should be redundant.
Ttebeco11/27/2022
i would try to remove it
Ttebeco11/27/2022
it's dead anyway
Ttebeco11/27/2022
there's another way to get types from it
Ttebeco11/27/2022
but definitly not like that
JJay 🐱11/27/2022
Removed it, did a clean/rebuild and tried running the function app. Same error.
JJay 🐱11/27/2022
I reckon that NuGet package was added a while ago for some redundant reason and removing it was forgotten.
Ttebeco11/27/2022
i'm installing core tool to do a comparison
Ttebeco11/27/2022
By default, this article shows you how to create C# functions that run on .NET 6 in the same process as the Functions host. These in-process C# functions are only supported on Long Term Support (LTS) .NET versions, such as .NET 6. When creating your project, you can choose to instead create a function that runs on .NET 6 in an isolated worker process. Isolated worker process supports both LTS and Standard Term Support (STS) versions of .NET. For more information, see Supported versions in the .NET Functions isolated worker process guide.
JJay 🐱11/27/2022
Ohhhhh you're right!
JJay 🐱11/27/2022
Switching it to .NET 6 and testing...
Ttebeco11/27/2022
// inprocess:
func init LocalFunctionProj --dotnet

// isolated:
func init LocalFunctionProj --worker-runtime dotnet-isolated --target-framework net6.0
JJay 🐱11/27/2022
So I don't have that problem on .NET 6
Ttebeco11/27/2022
well yes
Ttebeco11/27/2022
because net6 is LTS
Ttebeco11/27/2022
run on both
Ttebeco11/27/2022
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.8.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext"/>
  </ItemGroup>
</Project>
Ttebeco11/27/2022
that's for func init LocalFunctionProj --worker-runtime dotnet-isolated --target-framework net7.0
Ttebeco11/27/2022
(notice the net7.0 at the end)
Ttebeco11/27/2022
it added
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.8.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
JJay 🐱11/27/2022
I could either stick to .NET 6 or switch to an isolated worker process...
Ttebeco11/27/2022
you should either stick to inprocess and be limited to LTS or isolated and be free of that constraint
JJay 🐱11/27/2022
Yepppppp
JJay 🐱11/27/2022
Thanks, I'll limit myself to LTS/6.
JJay 🐱11/27/2022
This teaches me to be better at reading the docs.
JJay 🐱11/27/2022
Thank you!
JJay 🐱11/27/2022
Once this is deployed to Azure and working I'll close the thread.
Ttebeco11/27/2022
what are you trying to trigger to excactly ?
JJay 🐱11/27/2022
I have a blob function in my Azure function app
Ttebeco11/27/2022
I never use azure function ever so I'm testing the tool a bit
Ttebeco11/27/2022
"blob function" ?
Ttebeco11/27/2022
I mean , what triggers your function and what does it do ?
Ttebeco11/27/2022
and is that a serverless one of a functionapp ?
JJay 🐱11/27/2022
Whenever a file/blob is added to my blob storage, it picks up the file, parses the CSV and uploads the data to Salesforce.
Ttebeco11/27/2022
👍
JJay 🐱11/27/2022
It is serverless
AAccord11/28/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.