refit icon indicating copy to clipboard operation
refit copied to clipboard

[Bug]: Refit 10.1.6 on .NET Framework adds multiple analyzers

Open roehl-ottri opened this issue 6 months ago â€ĸ 1 comments

Describe the bug 🐞

When I upgraded my Refit reference to the latest 10.1.6 version in one of my old .NET Framework-based projects I started getting a number of duplicate attribute errors in the generated files.

Looking at the references, it appears that both the roslyn3.8 and roslyn5.0 versions of the analyzers are being included, causing multiple generated classes.

Image

For reference, I'm using Visual Studio 2026 and PackageReference style NuGet packages in .NET Framework.

Step to reproduce

  1. Create a new Class Library (.NET Framework) project in Visual Studio 2026
  2. Add a NuGet PackageReference to Refit v10.1.6
  3. Update the Class1.cs to include a Refit interface
using Refit;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace TestRefit
{
    public interface Class1
    {
        [Get("/api/values")]
        public Task<List<string>> GetValues();
    }
}
  1. Try to build the library

Reproduction repository

No response

Expected behavior

The project should compile cleanly.

Screenshots đŸ–ŧī¸

No response

IDE

No response

Operating system

WIndows

Version

No response

Device

No response

Refit Version

10.1.6

Additional information â„šī¸

  • Downgrading to v10.0.1 works as expected.

  • Converting the project to an SDK-style csproj targeting net48 also works, but I have some ASP.NET web apps that include Refit, and those cannot be converted to an SDK-style csproj at this time.

roehl-ottri avatar May 07 '26 19:05 roehl-ottri

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jul 02 '26 00:07 github-actions[bot]