[Bug]: Refit 10.1.6 on .NET Framework adds multiple analyzers
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.
For reference, I'm using Visual Studio 2026 and PackageReference style NuGet packages in .NET Framework.
Step to reproduce
- Create a new Class Library (.NET Framework) project in Visual Studio 2026
- Add a NuGet
PackageReferenceto Refit v10.1.6 - 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();
}
}
- 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
net48also 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.
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.