I have a .net framework 4.7.2 web API assembly that I've been building for a while using the command:

        dotnet build 'D:\proj\folder\main\source\MyProj.WebApi\MyProj.WebApi.csproj' 
          -t:Rebuild -p:Configuration=Debug -p:OutDir='D:\Projects\MyProj\Main\Build\Deployment 
           Packages\.temp\Assemblies'
          -detailedSummary:True

This has worked with no problems until now and I'm not sure what changed.

The exception I get is the following:

It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '6.0.3' (x64) was not found.

  • The following frameworks were found: 2.1.28 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.30 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.23 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

This is odd since this is not a .netcore app/library.

My project uses PackageReferences format so I have all packages referenced in the csproj file:

<ItemGroup>
    <PackageReference Include="AutoMapper" Version="10.0.0" />
    <PackageReference Include="DotNetNuke.Core" Version="9.7.2" />
    <PackageReference Include="DotNetNuke.DependencyInjection" Version="9.7.2" />
    <PackageReference Include="DotNetNuke.Instrumentation" Version="9.7.2" />
    <PackageReference Include="DotNetNuke.Web" Version="9.7.2" />
    <PackageReference Include="DotNetNuke.WebApi" Version="9.7.2" />
    <PackageReference Include="EntityFramework" Version="6.4.4" />
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
    <PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.3" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
  </ItemGroup>

I've confirmed that the target framework in the csproj file is net472:

  <PropertyGroup>
    <ProjectGuid>{4B5038E2-757F-4C80-A41D-2E3D7035B02F}</ProjectGuid>
    <TargetFramework>net472</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>true</Deterministic>
    <BaseOutputPath>bin\</BaseOutputPath>
  </PropertyGroup>

The project does reference a number of other projects, but all of these also target net472.

What else can I do to find the cause?

1

There are 1 answers

0
sixeyes On

I eventually found the answer to this, add the following line to your project file

<AzureFunctionsVersion>v1</AzureFunctionsVersion>

I added this after the TargetFramework tag.

More details can be found here