From 6879f4d8cf9a600dc44a9bee08c63f0de769eeb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Wed, 29 Jul 2026 14:10:05 +0200 Subject: [PATCH] fix: require Roslyn 5.0 instead of 5.6 for the generator and analyzers The generator and analyzers referenced Microsoft.CodeAnalysis 5.6.0, which ships with the .NET 10.0.30x SDK. Roslyn refuses to load a component that references a newer compiler than the host (CS9057), so every older host silently skipped them: no generated members, and 'Cannot resolve symbol CreateMock' throughout the IDE while the command-line build stayed green. Pin the three shipped components to the oldest Roslyn they actually need. 5.0 is the floor, not lower: the emitted Mock.g.cs declares CreateMock in a C# 14 extension block, so a C# 13 host parses it as garbage and generates no mocks at all. That also rules out any pre-C# 14 host, since a static extension member has no older equivalent. Mockolate.SourceGenerators.Tests pins the same version, so reaching for a newer Roslyn API fails the build and the generator tests here rather than silently breaking consumers' IDEs. MinimumRoslynVersion sits in the root Directory.Build.props because the test tree imports that one but not Source/Directory.Build.props. --- Directory.Build.props | 8 ++++++++ .../Mockolate.Analyzers.CodeFixers.csproj | 6 +++--- Source/Mockolate.Analyzers/Mockolate.Analyzers.csproj | 4 ++-- .../Mockolate.SourceGenerators.csproj | 2 +- .../Mockolate.SourceGenerators.Tests.csproj | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d225d952..54aab334 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,4 +6,12 @@ 0024000004800000940000000602000000240000525341310004000001000100917b2e28a0dcd1de99a208f70383c300caa03729b1f9cdad97cb11a127f822aa36aad08225cc24312de1fadf3aeafc7ab6c2c4b588d5e88c2b61f0a56e02df1b6aa11d0c3e4ee6675f24b20dbd75ee4fc229f82b0eeeafe1a5bc376d5e5f9a5c4320267921d9a962cc5f58ccc94e7127db3119bafedfb76fd3a7b1f2d22155ac + + + 5.0.0 + + diff --git a/Source/Mockolate.Analyzers.CodeFixers/Mockolate.Analyzers.CodeFixers.csproj b/Source/Mockolate.Analyzers.CodeFixers/Mockolate.Analyzers.CodeFixers.csproj index c2691888..d69dcce9 100644 --- a/Source/Mockolate.Analyzers.CodeFixers/Mockolate.Analyzers.CodeFixers.csproj +++ b/Source/Mockolate.Analyzers.CodeFixers/Mockolate.Analyzers.CodeFixers.csproj @@ -18,9 +18,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Source/Mockolate.Analyzers/Mockolate.Analyzers.csproj b/Source/Mockolate.Analyzers/Mockolate.Analyzers.csproj index afa73786..d8e761a2 100644 --- a/Source/Mockolate.Analyzers/Mockolate.Analyzers.csproj +++ b/Source/Mockolate.Analyzers/Mockolate.Analyzers.csproj @@ -22,8 +22,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Source/Mockolate.SourceGenerators/Mockolate.SourceGenerators.csproj b/Source/Mockolate.SourceGenerators/Mockolate.SourceGenerators.csproj index bf83e85a..bd2e20a4 100644 --- a/Source/Mockolate.SourceGenerators/Mockolate.SourceGenerators.csproj +++ b/Source/Mockolate.SourceGenerators/Mockolate.SourceGenerators.csproj @@ -17,7 +17,7 @@ - + diff --git a/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj b/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj index ec287860..beca3921 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj +++ b/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj @@ -8,7 +8,7 @@ - +