Cannot compile c# Function DLL with Microsoft.Azure.Workflows.Webjobs.Sdk in Visual Studio 2022


We have LogicApp application with Function DLL to include c# code.
It is working without problem.
We have MsTest UnitTests.
Everything was ok in Visual Code and Visual Studio.
But after we have added project reference to Function DLL then we got strange build error in Visual Studio:

The “Microsoft.Azure.Functions.Extensions.Workflows.Sdk.BuildTasks.FindFunctionJsonFolders” task could not be loaded from the assembly C:\Users<user>.nuget\packages\microsoft.azure.workflows.webjobs.sdk\1.2.0\build\tools\net8.0\Microsoft.Azure.Functions.Extensions.Workflows.Sdk.BuildTasks.dll. Could not find a part of the path ‘C:\Users<user>.nuget\packages\microsoft.azure.workflows.webjobs.sdk\1.2.0\build\tools\net8.0’. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Everything is ok in Visual Code.
Of course we have all files in C:\Users\<user>\.nuget\packages\microsoft.azure.workflows.webjobs.sdk\1.2.0\build\tools\net8.0

Our Function DLL project:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <IsPackable>false</IsPackable>
        <TargetFramework>net8</TargetFramework>
        <AzureFunctionsVersion>v4</AzureFunctionsVersion>
        <OutputType>Library</OutputType>
        <PlatformTarget>AnyCPU</PlatformTarget>
        <LogicAppFolderToPublish>$(MSBuildProjectDirectory)\..\cus-    02</LogicAppFolderToPublish>
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        <SelfContained>false</SelfContained>
     </PropertyGroup>
     
     <ItemGroup>
      <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0"     PrivateAssets="all" />
      <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
      <PackageReference Include="Microsoft.Azure.Workflows.Webjobs.Sdk" Version="1.2.0" />
    </ItemGroup>
    
      <Target Name="TriggerPublishOnBuild" AfterTargets="Build">
          <CallTarget Targets="Publish" />
      </Target>
    </Project>

We have created empty .net core 8.0 Console application and just add this nuget
“Microsoft.Azure.Workflows.Webjobs.Sdk” and got same error.

Ildasm and other tool cannot show IL or c# of this library.

Do you have any ideas why we have this issues in Visual Studio 2022.

We need develop and debug UnitTests in Visual Studio.

We are using this library for LogicApp UnitTests

https://github.com/LogicAppUnit/TestingFramework

Leave a Reply

Your email address will not be published. Required fields are marked *