Umar
Umar

Reputation: 487

net8.0-windows is mentioned in compatible target framework(s) but while restoring nuget packages on azure pipeline, it fails

As it can be seen that net8.0-windows is mentioned in the supported target framework(s) but when I try to restore the nuget packages of the project that is targeting net8.0-windows, it gives me the following error,

##[error]The nuget command failed with exit code(1) and error(NU1202: Package Revit_All_Main_Versions_API_x64 2025.0.0 is not compatible with net80-windows (.NETFramework,Version=v8.0,Profile=windows). Package Revit_All_Main_Versions_API_x64 2025.0.0 supports: net80 (.NETFramework,Version=v8.0)

I am talking about the nuget Revit_All_Main_Versions_API_x64 2025.0.0

My csproj file has the following properties,

  <PropertyGroup>
    <TargetFramework>net8.0-windows</TargetFramework>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <PlatformTarget>x64</PlatformTarget>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <BaseOutputPath>..\bin</BaseOutputPath>
  </PropertyGroup>

Any ideas on what I am doing wrong? Or what should be the possible solution?

Upvotes: 0

Views: 830

Answers (2)

Umar
Umar

Reputation: 487

The issue for me is now resolved. Although .NET8 SDK was installed but in my YAML pipeline, I had the following version of Nuget,

    - task: NuGetToolInstaller@1
      displayName: 'Use NuGet 5.4.0'
      inputs:
        versionSpec: 5.4.0
        checkLatest: true

I updated the version to,

    - task: NuGetToolInstaller@1
      displayName: 'Use NuGet 6.10.0'
      inputs:
        versionSpec: 6.10.0
        checkLatest: true

And the issue was fixed.

Regards, Umar

Upvotes: 0

Tyress
Tyress

Reputation: 3653

I had this issue recently, solved it by removing a MSBuildSDKsPath environment variable set for another project (pointing to a .NET Core SDK).

Upvotes: 1

Related Questions