fix: ConfigurationGenerator is not generated in FluentUI
See original GitHub issueThis might very well be a user error, but i have failed to find out what i am doing wrong
🐛 Bug Report
ConfigurationGenerator is not generated Program.cs(13,35): error CS0103: The name ‘ConfigurationGenerator’ does not exist in the current context
💻 Repro or Code Sample
Using this docker image and template to make sure nothing else in setup is making problems.
FROM ubuntu:22.04
RUN apt-get update && \
apt-get -y dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install dotnet-sdk-6.0 dotnet-runtime-6.0 ca-certificates
WORKDIR /build
RUN dotnet new --install Microsoft.Fast.Templates.FluentUI::2.0.6
RUN dotnet new fluentuiblazorserver
- Change Program.cs to use ConfigurationGenerator
builder.Services.AddHttpClient();
//builder.Services.AddFluentUIComponents();
//When using icons and/or emoji replace the line above with the code below
LibraryConfiguration config = new(ConfigurationGenerator.GetIconConfiguration(), ConfigurationGenerator.GetEmojiConfiguration());
builder.Services.AddFluentUIComponents(config);
builder.Services.AddSingleton<WeatherForecastService>();
- Change build.csproj to only use .net 6.0 (did not get the -f to work ) and changed the propertygroup to
<PropertyGroup>
<PublishFluentIconAssets>true</PublishFluentIconAssets>
<FluentIconSizes>10,12,16,20,24,28,32,48</FluentIconSizes>
<FluentIconVariants>Filled,Regular</FluentIconVariants>
<PublishFluentEmojiAssets>true</PublishFluentEmojiAssets>
<FluentEmojiGroups>Activities,Animals_Nature,Flags,Food_Drink,Objects,People_Body,Smileys_Emotion,Symbols,Travel_Places</FluentEmojiGroups>
<FluentEmojiStyles>Color,Flat,HighContrast</FluentEmojiStyles>
</PropertyGroup>
Then dotnet build
root@2e3b8cfeb6bb:/build# dotnet build
Microsoft (R) Build Engine version 17.0.1+b177f8fa7 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
CSC : warning CS8032: An instance of analyzer Microsoft.Fast.Components.FluentUI.Generators.ConfigurationGenerator cannot be created from /root/.nuget/packages/microsoft.fast.components.fluentui/2.3.6/analyzers/dotnet/cs/Microsoft.Fast.Components.FluentUI.Configuration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/build/build.csproj]
/build/Program.cs(13,35): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
/build/Program.cs(13,82): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
Build FAILED.
CSC : warning CS8032: An instance of analyzer Microsoft.Fast.Components.FluentUI.Generators.ConfigurationGenerator cannot be created from /root/.nuget/packages/microsoft.fast.components.fluentui/2.3.6/analyzers/dotnet/cs/Microsoft.Fast.Components.FluentUI.Configuration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/build/build.csproj]
/build/Program.cs(13,35): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
/build/Program.cs(13,82): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
1 Warning(s)
2 Error(s)
🤔 Expected Behavior
Build without warning/error
😯 Current Behavior
CSC : warning CS8032: An instance of analyzer Microsoft.Fast.Components.FluentUI.Generators.ConfigurationGenerator cannot be created from /root/.nuget/packages/microsoft.fast.components.fluentui/2.3.6/analyzers/dotnet/cs/Microsoft.Fast.Components.FluentUI.Configuration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/build/build.csproj]
/build/Program.cs(13,35): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
/build/Program.cs(13,82): error CS0103: The name 'ConfigurationGenerator' does not exist in the current context [/build/build.csproj]
💁 Possible Solution
CSC : warning CS8032: An instance of analyzer Microsoft.Fast.Components.FluentUI.Generators.ConfigurationGenerator cannot be created from /root/.nuget/packages/microsoft.fast.components.fluentui/2.3.6/analyzers/dotnet/cs/Microsoft.Fast.Components.FluentUI.Configuration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/build/build.csproj]
Guessing i am missing something, but my attempts to fix it has failed
🔦 Context
Unable to use FluentNavMenu as it needs the icons (different setup, but same problem)
🌍 Your Environment
Ubuntu 22.04 (see ‘Repro or Code Sample’) for dockerfile
Issue Analytics
- State:
- Created 3 months ago
- Comments:12 (1 by maintainers)

Top Related StackOverflow Question
Microsoft.Fast.Components.FluentUI.Configuration references Microsoft.CodeAnalysis v4.5.0.0 (Microsoft.CodeAnalysis.CSharp v4.5.0.0 -> Microsoft.CodeAnalysis.Common v4.5.0.0), but the compiler shipped with .NET SDK 6.0 doesn’t have this version. The latest SDK (6.0.410) has Microsoft.CodeAnalysis v4.3.0.0. As a workaround, Microsoft.Net.Compilers.Toolset v4.5.0 reference can be added - it will force build of the project with a compiler shipped in the package.
It looks like the version of Microsoft.CodeAnalysis.CSharp in Microsoft.Fast.Components.FluentUI.Configuration could be downgraded to 4.2.0, it will resolve the issue at least for the majority 6.0.x SDKs. More robust option would be to implement different versions of the generator for different versions of Roslyn as Microsoft.Extensions.Logging.Abstractions does.
@mattgoedde that is a deliberate error in the demo to show runtime verification :