Azure / azure-functions-dotnet-worker

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

Default isolated-process function app doesn't build #1574

Closed erichkray closed 1 year ago

erichkray commented 1 year ago
Build started...
1>------ Build started: Project: FunctionApp2, Configuration: Debug Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>FunctionApp2 -> C:\Users\erichray\source\repos\FunctionApp2\FunctionApp2\bin\Debug\net7.0\FunctionApp2.dll
1>Determining projects to restore...
1>C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj : warning NU1603: Microsoft.Azure.WebJobs 3.0.32 depends on Microsoft.Extensions.Logging (>= 2.1.1) but Microsoft.Extensions.Logging 2.1.1 was not found. An approximate best match of Microsoft.Extensions.Logging 3.0.3 was resolved.
1>C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj : warning NU1603: Microsoft.Azure.Functions.Worker.Extensions depends on Microsoft.NETCore.Targets (>= 3.0.0) but Microsoft.NETCore.Targets 3.0.0 was not found. An approximate best match of Microsoft.NETCore.Targets 5.0.0 was resolved.
1>C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Configuration from 3.0.3 to 2.1.1. Reference the package directly from the project to select a different version. 
1>C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj : error NU1605:  Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.1.3 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Logging 3.0.3 -> Microsoft.Extensions.Configuration.Binder 3.0.3 -> Microsoft.Extensions.Configuration (>= 3.0.3) 
1>C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj : error NU1605:  Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.1.3 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Configuration (>= 2.1.1)
1>Failed to restore C:\Users\erichray\AppData\Local\Temp\54o5khjb.mq3\WorkerExtensions.csproj (in 1.74 sec).
1>Done building project "WorkerExtensions.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 4:40 PM and took 03.580 seconds ==========

FunctionApp2.csproj

<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.14.1" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.0.1" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.10.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>

WorkerExtensions.csproj

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
        <LangVersion>preview</LangVersion>
        <Configuration>Release</Configuration>
        <AssemblyName>Microsoft.Azure.Functions.Worker.Extensions</AssemblyName>
        <RootNamespace>Microsoft.Azure.Functions.Worker.Extensions</RootNamespace>
        <MajorMinorProductVersion>1.0</MajorMinorProductVersion>
        <Version>$(MajorMinorProductVersion).0</Version>
        <AssemblyVersion>$(MajorMinorProductVersion).0.0</AssemblyVersion>
        <FileVersion>$(Version)</FileVersion>
        <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.NETCore.Targets" Version="3.0.0" PrivateAssets="all" />
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />

    </ItemGroup>
</Project>
kshyju commented 1 year ago

Does it make any difference if you delete the bin and obj directories under C:\Users\erichray\source\repos\FunctionApp2\FunctionApp2\ and try to build again?

Those seems to be warnings, but reported as errors. Can you check your project build settings and see you have enabled "all" warnings as errors? https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings

erichkray commented 1 year ago

Deleting bin and obj does not resolve the issue. The default setting for VS does seem to include $(WarningsAsErrors);NU1605, but removing this or even setting Warning Level to 0 - Disable all warnings does not seem to help.

image
erichkray commented 1 year ago

This is all just the boilerplate project generated by the "New > Project" menu.

image
kshyju commented 1 year ago

Are you still experiencing this issue? If so, Could you share a link to a minimal repro? I could not repro this on my side.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

erichkray commented 1 year ago

Are you still experiencing this issue? If so, Could you share a link to a minimal repro? I could not repro this on my side.

I was able to unblock myself. IIRC, I had to manually install .NET 6 SDK to get it to successfully run.

kshyju commented 1 year ago

Great! Closing. Please open a new issue if you run into other issues.