Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
431 stars 184 forks source link

Azure function app removes host.json and local.settings.json #2713

Open tnlthanzeel opened 2 months ago

tnlthanzeel commented 2 months ago

Description

i have an azure function app running on :

dotnet: 8 function app version: v4 model: isolated

i have been using this function app to render razor components by setting the the csproj file to Sdk="Microsoft.NET.Sdk.Razor" referred at here

<Project Sdk="Microsoft.NET.Sdk.Razor">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="host.json" />
    <Content Include="local.settings.json" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.6.0" />
    <PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.5" />
    <PackageReference Include="Azure.Identity" Version="1.12.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\IBS.Agent.SharedKernal\IBS.Agent.SharedKernal.csproj" />
  </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>

Steps to reproduce

I have been using the Microsoft.Azure.Functions.Worker.Sdk version 1.16.4 and all were working fine.

Today i updated the Microsoft.Azure.Functions.Worker.Sdk version to 1.17.4 and then the app started to hang and the console gave me this

image

I noticed that the host.json and local.settings.json file got automatically removed from the visual studio solution explorer. so i included them back to the project and rerunning the project still gave me the above error in the image. but when i downgraded the Microsoft.Azure.Functions.Worker.Sdk version to 1.16.4 then the host.json and local.settings.json show up again and the azure function app worked.

Why does it break on Microsoft.Azure.Functions.Worker.Sdk version 1.17.4?

please help